Skip to content

Commit

Permalink
SNOW-1658905 PR fixes 2
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-mbobowski committed Sep 19, 2024
1 parent bbfe1a0 commit c36cf76
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,24 @@ public class IcebergConfigValidator implements StreamingConfigValidator {
@Override
public ImmutableMap<String, String> validate(Map<String, String> inputConfig) {
boolean isIcebergEnabled = Boolean.parseBoolean(inputConfig.get(ICEBERG_ENABLED));

if (!isIcebergEnabled) {
return ImmutableMap.of();
}

Map<String, String> validationErrors = new HashMap<>();

if (isIcebergEnabled) {
boolean isSchematizationEnabled =
Boolean.parseBoolean(
inputConfig.get(SnowflakeSinkConnectorConfig.ENABLE_SCHEMATIZATION_CONFIG));
IngestionMethodConfig ingestionMethod =
IngestionMethodConfig.valueOf(inputConfig.get(INGESTION_METHOD_OPT).toUpperCase());

if (!isSchematizationEnabled) {
validationErrors.put(ENABLE_SCHEMATIZATION_CONFIG, NO_SCHEMATIZATION_ERROR_MESSAGE);
}
if (ingestionMethod != SNOWPIPE_STREAMING) {
validationErrors.put(INGESTION_METHOD_OPT, INCOMPATIBLE_INGESTION_METHOD);
}
boolean isSchematizationEnabled =
Boolean.parseBoolean(
inputConfig.get(SnowflakeSinkConnectorConfig.ENABLE_SCHEMATIZATION_CONFIG));
IngestionMethodConfig ingestionMethod =
IngestionMethodConfig.valueOf(inputConfig.get(INGESTION_METHOD_OPT).toUpperCase());

if (!isSchematizationEnabled) {
validationErrors.put(ENABLE_SCHEMATIZATION_CONFIG, NO_SCHEMATIZATION_ERROR_MESSAGE);
}
if (ingestionMethod != SNOWPIPE_STREAMING) {
validationErrors.put(INGESTION_METHOD_OPT, INCOMPATIBLE_INGESTION_METHOD);
}

return ImmutableMap.copyOf(validationErrors);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import java.util.Map;

/**
* This is a builder class for the connector config For now it returns map. Let's change it to a
* This is a builder class for the connector config. For now it returns map. Let's change it to a
* more convenient abstraction when we have it.
*/
public class SnowflakeSinkConnectorConfigBuilder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,7 @@ public static List<SinkRecord> createBigAvroRecords(
}

/** @deprecated use SnowflakeSinkConnectorConfigBuilder instead */
@Deprecated
public static Map<String, String> getConfig() {
return SnowflakeSinkConnectorConfigBuilder.snowpipeConfig().build();
}
Expand Down

0 comments on commit c36cf76

Please sign in to comment.