openinx commented on a change in pull request #2898:
URL: https://github.com/apache/iceberg/pull/2898#discussion_r815251386
##########
File path:
flink/v1.14/flink/src/main/java/org/apache/iceberg/flink/sink/FlinkSink.java
##########
@@ -338,6 +345,27 @@ private String operatorName(String suffix) {
return uidPrefix != null ? uidPrefix + "-" + suffix : suffix;
}
+ private List<Integer> checkAndGetEqualityFieldIds() {
+ List<Integer> equalityFieldIds =
Lists.newArrayList(table.schema().identifierFieldIds());
+ if (equalityFieldColumns != null && equalityFieldColumns.size() > 0) {
+ Set<Integer> equalityFieldSet =
Sets.newHashSetWithExpectedSize(equalityFieldColumns.size());
+ for (String column : equalityFieldColumns) {
+ org.apache.iceberg.types.Types.NestedField field =
table.schema().findField(column);
+ Preconditions.checkNotNull(field, "Missing required equality field
column '%s' in table schema %s",
+ column, table.schema());
+ equalityFieldSet.add(field.fieldId());
+ }
+
+ if (!equalityFieldSet.equals(table.schema().identifierFieldIds())) {
Review comment:
The `identifierFieldsIds` will be a `ImmutableHashSet`, while the
`equalityFieldSet` will be a `HashSet`, the the `.equals` will always be
false, right ?
I think it's better to change to check set size & elements for two sets.
--
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]