zhengxiang378928908-code commented on code in PR #18602:
URL: https://github.com/apache/iceberg/pull/18602#discussion_r4396555164
##########
flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/HashKeyGenerator.java:
##########
@@ -344,7 +346,7 @@ static class SelectorKey {
this.branch = branch;
this.schemaId = tableSchemaId;
this.specId = tableSpecId;
- this.schema = tableSchemaId == null ? schema : null;
+ this.schema = tableSchemaId == null ? schema.asStruct() : null;
Review Comment:
It decides how the schema is represented in the cache key. When a resolved
table schema is passed, its ID identifies the schema within the table.
Otherwise the key holds the input schema's struct.
In `emit`, the row is first converted to the resolved table schema, so
records with different input schemas can share a selector once they map to the
same table schema (and the rest of the key — spec, equality fields,
distribution mode, parallelism — matches).
The deferred update path calls `generateKey(record)` with the record's
original schema, spec and row, so the input schema has to be in the key.
Comparing by `asStruct()` lets structurally equal schema instances reuse the
selector.
--
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]