smallx opened a new pull request, #6305: URL: https://github.com/apache/iceberg/pull/6305
Deserialization of POJOs in Flink will call the default parameterless constructor to generate a new instance. However, `Comparators` uses the `PrimitiveType` instance as the key of `Map`: https://github.com/apache/iceberg/blob/master/api/src/main/java/org/apache/iceberg/types/Comparators.java#L33-L47 We need to override `equals` and `hashCode` methods for primitive types, otherwise, exception will occur after serializing `Schema`: ``` java.lang.UnsupportedOperationException: Cannot determine comparator for type: int at org.apache.iceberg.types.Comparators.forType(Comparators.java:71) at org.apache.iceberg.types.Comparators.internal(Comparators.java:77) at org.apache.iceberg.types.Comparators.access$300(Comparators.java:31) at org.apache.iceberg.types.Comparators$StructLikeComparator.lambda$new$0(Comparators.java:109) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) at java.base/java.util.Collections$2.tryAdvance(Collections.java:4747) at java.base/java.util.Collections$2.forEachRemaining(Collections.java:4755) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:550) at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:517) at org.apache.iceberg.types.Comparators$StructLikeComparator.<init>(Comparators.java:112) at org.apache.iceberg.types.Comparators$StructLikeComparator.<init>(Comparators.java:102) at org.apache.iceberg.types.Comparators.forType(Comparators.java:53) at org.apache.iceberg.util.StructLikeWrapper.<init>(StructLikeWrapper.java:43) at org.apache.iceberg.util.StructLikeWrapper.forType(StructLikeWrapper.java:34) at org.apache.iceberg.util.StructLikeMap.put(StructLikeMap.java:87) at org.apache.iceberg.util.StructLikeMap.put(StructLikeMap.java:32) at org.apache.iceberg.io.BaseTaskWriter$BaseEqualityDeltaWriter.write(BaseTaskWriter.java:125) at org.apache.iceberg.flink.sink.BaseDeltaTaskWriter.write(BaseDeltaTaskWriter.java:79) at org.apache.iceberg.flink.sink.BaseDeltaTaskWriter.write(BaseDeltaTaskWriter.java:39) ``` -- 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]
