thswlsqls opened a new issue, #17274:
URL: https://github.com/apache/iceberg/issues/17274

   **Apache Iceberg version**
   main @ 8550723a7
   
   **Query engine**
   Flink
   
   **Please describe the bug**
   `RANGE` distribution mode in the dynamic sink ignores user-specified 
equality fields and routes rows round-robin.
   
   `HashKeyGenerator.getKeySelector()` `case RANGE` 
(`flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/HashKeyGenerator.java`
 line 176) tests `schema.identifierFieldIds().isEmpty()`, while sibling `case 
NONE` (line 127) and `case HASH` (line 138) test the `equalityFields` 
parameter. RANGE then passes `equalityFields` to `equalityFieldKeySelector` 
(line 189) — it checks the schema but uses the parameter.
   
   `equalityFields` comes from 
`DynamicSinkUtil.resolveEqualityFieldNames(record.equalityFields(), schema)` 
(line 83): user-specified fields when set, otherwise 
`schema.identifierFieldNames()`. The conditions diverge only when a user sets 
equality fields on a schema without identifier fields — RANGE falls back to 
`tableKeySelector` (round-robin) and logs `"because there are no equality 
fields set"`, contradicting the actual state.
   
   `DynamicWriter` (line 109) honors the user-specified fields, so rows sharing 
a key land on different subtasks while equality deletes are still emitted.
   
   **Steps to reproduce**
   Write with `DistributionMode.RANGE` and equality fields `{"id"}` to a table 
whose schema declares no identifier fields.
   Expected: rows sharing an `id` route to one subtask. Actual: round-robin.
   
   **Additional context**
   #16243 lifted the equality-field fallback into the caller 
(`resolveEqualityFieldNames`), making the RANGE schema check redundant.
   
   


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