stevenzwu commented on a change in pull request #3681:
URL: https://github.com/apache/iceberg/pull/3681#discussion_r778991990
##########
File path:
flink/v1.13/flink/src/main/java/org/apache/iceberg/flink/FlinkSchemaUtil.java
##########
@@ -149,14 +158,44 @@ public static TableSchema toSchema(RowType rowType) {
* @param schema iceberg schema to convert.
* @return Flink TableSchema.
*/
- public static TableSchema toSchema(Schema schema) {
+ public static TableSchema toSchema(Schema schema, Map<String, String>
properties) {
TableSchema.Builder builder = TableSchema.builder();
// Add columns.
for (RowType.RowField field : convert(schema).getFields()) {
builder.field(field.getName(),
TypeConversions.fromLogicalToDataType(field.getType()));
}
+ // Add watermark
+ final int watermarkCount =
+ properties.keySet().stream()
+ .filter(
+ (k) ->
+ k.startsWith(flinkPrefix + DescriptorProperties.WATERMARK)
&&
+ k.endsWith('.' +
DescriptorProperties.WATERMARK_ROWTIME))
+ .mapToInt((k) -> 1)
+ .sum();
+ if (watermarkCount > 0) {
+ for (int i = 0; i < watermarkCount; i++) {
+ final String rowtimeKey =
+ flinkPrefix + DescriptorProperties.WATERMARK + '.' + i + '.' +
DescriptorProperties.WATERMARK_ROWTIME;
Review comment:
saw you did static important on the constant in the test class. you want
to apply it here too for consistency?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]