openinx commented on code in PR #4561:
URL: https://github.com/apache/iceberg/pull/4561#discussion_r851995001
##########
flink/v1.14/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java:
##########
@@ -400,6 +400,30 @@ void createIcebergTable(ObjectPath tablePath,
CatalogBaseTable table, boolean ig
}
}
+ private static void validateTableSchemaAndPartition(CatalogTable ct1,
CatalogTable ct2) {
+ TableSchema ts1 = ct1.getSchema();
+ TableSchema ts2 = ct2.getSchema();
+ boolean equalsPrimary = false;
+ if (ts1.getPrimaryKey().isPresent() && ts2.getPrimaryKey().isPresent()) {
+ equalsPrimary =
ts1.getPrimaryKey().get().getType().equals(ts2.getPrimaryKey().get().getType())
&&
+
ts1.getPrimaryKey().get().getColumns().equals(ts2.getPrimaryKey().get().getColumns());
+ } else if (!ts1.getPrimaryKey().isPresent() &&
!ts2.getPrimaryKey().isPresent()) {
+ equalsPrimary = true;
+ }
Review Comment:
Okay, that sounds reasonable.
Then I think we can use `Objects.equals` to check the equality for both
`type` and `columns` fields.
--
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]