Skip to content

Commit

Permalink
Map avro schemas to be backwards compatible with sqrl 0.5 (#969)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Henneberger <git@danielhenneberger.com>
  • Loading branch information
henneberger authored Nov 7, 2024
1 parent 8f9533d commit d06145e
Showing 1 changed file with 1 addition and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,11 @@ public RelDataType map(TableSchema schema, TableConfig tableConfig, Name tableNa

boolean legacyTimestampMapping = getLegacyTimestampMapping(tableConfig);


AvroToRelDataTypeConverter converter = new AvroToRelDataTypeConverter(errors, legacyTimestampMapping);
return converter.convert(avroSchema);
}

private boolean getLegacyTimestampMapping(TableConfig tableConfig) {
if (tableConfig == null) return true;
Map<String, Object> configMap = tableConfig.getConnectorConfig().toMap();
Object legacy = configMap.get("avro.timestamp_mapping.legacy");
if (legacy instanceof Boolean) {
return (Boolean) legacy;
} else if (legacy != null) {
log.warn("Expected boolean type for 'timestamp_mapping.legacy'");
}

log.warn("Avro value 'timestamp_mapping.legacy' is not set to 'false'. "
+ "This should be added to your table config for flink version 1.19 and later.");
return true; //default value
return false;
}
}

0 comments on commit d06145e

Please sign in to comment.