mxm commented on code in PR #18668:
URL: https://github.com/apache/iceberg/pull/18668#discussion_r4414643371


##########
flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/HashKeyGenerator.java:
##########
@@ -117,23 +122,44 @@ private KeySelector<RowData, Integer> getKeySelector(
       PartitionSpec spec,
       DistributionMode mode,
       Set<String> equalityFields,
-      int writeParallelism) {
+      int writeParallelism,
+      Set<String> distributionFields) {
     LOG.debug(
         "Creating new KeySelector for table '{}' with distribution mode '{}'", 
tableName, mode);
+
     switch (mode) {
       case NONE:
+        if (!distributionFields.isEmpty()) {
+          LOG.warn(
+              "{}: Distribution fields {} are ignored when distribution mode 
is set to NONE",
+              tableName,
+              distributionFields);
+        }
+
         if (equalityFields.isEmpty()) {
           return tableKeySelector(tableName, writeParallelism, 
maxWriteParallelism);
         } else {
           LOG.info(
               "{}: Distribute rows by equality fields, because there are 
equality fields set",
               tableName);
-          return equalityFieldKeySelector(
-              tableName, schema, equalityFields, writeParallelism, 
maxWriteParallelism);
+          return fieldKeySelector(
+              tableName,
+              schema,
+              DynamicSinkUtil.getEqualityFieldIds(equalityFields, schema),
+              writeParallelism,
+              maxWriteParallelism);
         }
 
       case HASH:
-        if (equalityFields.isEmpty()) {
+        if (!distributionFields.isEmpty()) {

Review Comment:
   This is right, we should not allow changing the write parallelism within the 
same checkpoint. On this note, we have a similar issue with schema changes, see 
https://github.com/apache/iceberg/pull/18675.



-- 
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]

Reply via email to