@@ -149,11 +149,27 @@ public void validate(FailureCollector collector) {
149149 TransactionIsolationLevel .validate (getTransactionIsolationLevel (), collector );
150150 }
151151
152- if ((!containsMacro (TABLE_NAME ) && !containsMacro (IMPORT_QUERY )) &&
153- (Strings .isNullOrEmpty (tableName ) && Strings .isNullOrEmpty (importQuery ))) {
154- collector .addFailure (" Import Query must be specified." ,
155- " Import Query, Can not be empty." )
152+ if (!containsMacro (PROPERTY_IMPORT_QUERY_TYPE )) {
153+ ImportQueryType importQueryType = ImportQueryType .fromString (getImportQueryType ());
154+
155+ boolean isImportQuerySelected = importQueryType == ImportQueryType .IMPORT_QUERY ;
156+ if (isImportQuerySelected && !containsMacro (IMPORT_QUERY ) &&
157+ Strings .isNullOrEmpty (importQuery )) {
158+ collector .addFailure ("Import Query cannot be empty." , null )
156159 .withConfigProperty (IMPORT_QUERY );
160+
161+ } else if (!isImportQuerySelected && !containsMacro (TABLE_NAME ) &&
162+ Strings .isNullOrEmpty (tableName )) {
163+ collector .addFailure ("Import Query cannot be empty" , null )
164+ .withConfigProperty (TABLE_NAME );
165+ }
166+ } else {
167+ if (!containsMacro (IMPORT_QUERY ) && Strings .isNullOrEmpty (importQuery ) &&
168+ !containsMacro (TABLE_NAME ) && Strings .isNullOrEmpty (tableName )) {
169+ collector .addFailure ("Import Query cannot be empty" , null )
170+ .withConfigProperty (IMPORT_QUERY )
171+ .withConfigProperty (TABLE_NAME );
172+ }
157173 }
158174 if (!Strings .isNullOrEmpty (importQuery ) &&
159175 (!hasOneSplit && !containsMacro (IMPORT_QUERY ) && !getImportQuery ().contains ("$CONDITIONS" ))) {
0 commit comments