Skip to content

Commit f1e33c0

Browse files
committed
PLUGIN-1883 : Rework
1 parent fa1d3a8 commit f1e33c0

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/main/java/io/cdap/plugin/snowflake/sink/batch/SnowflakeSinkConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import io.cdap.plugin.snowflake.common.BaseSnowflakeConfig;
2424
import io.cdap.plugin.snowflake.common.client.SnowflakeAccessor;
2525
import io.cdap.plugin.snowflake.common.util.SchemaHelper;
26+
2627
import javax.annotation.Nullable;
2728

2829
/**

src/main/java/io/cdap/plugin/snowflake/source/batch/ImportQueryType.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,16 @@ public enum ImportQueryType {
2525
TABLE_NAME;
2626

2727
public static ImportQueryType fromString(String value) {
28+
if (value == null) {
29+
return ImportQueryType.IMPORT_QUERY;
30+
}
31+
2832
for (ImportQueryType type : ImportQueryType.values()) {
2933
if (type.name().equalsIgnoreCase(value)) {
3034
return type;
3135
}
3236
}
33-
throw new IllegalArgumentException(
34-
String.format("Unsupported importQueryType '%s'. Supported types are: importQuery, tableName.", value));
37+
38+
return ImportQueryType.IMPORT_QUERY;
3539
}
3640
}

src/main/java/io/cdap/plugin/snowflake/source/batch/SnowflakeBatchSourceConfig.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import io.cdap.cdap.api.annotation.Name;
2323
import io.cdap.cdap.etl.api.FailureCollector;
2424
import io.cdap.plugin.snowflake.common.BaseSnowflakeConfig;
25+
2526
import java.util.Objects;
2627
import javax.annotation.Nullable;
2728

@@ -59,8 +60,9 @@ public class SnowflakeBatchSourceConfig extends BaseSnowflakeConfig {
5960

6061

6162
@Name(PROPERTY_TABLE_NAME)
62-
@Nullable
6363
@Description("The name of the table used to retrieve the schema.")
64+
@Macro
65+
@Nullable
6466
private final String tableName;
6567

6668
@Name("importQueryType")
@@ -114,8 +116,9 @@ public String getTableName() {
114116
return tableName;
115117
}
116118

119+
@Nullable
117120
public ImportQueryType getImportQueryType() {
118-
return importQueryType;
121+
return importQueryType == null ? ImportQueryType.IMPORT_QUERY : importQueryType;
119122
}
120123

121124
public void validate(FailureCollector collector) {

0 commit comments

Comments
 (0)