Guosmilesmile commented on code in PR #11662:
URL: https://github.com/apache/iceberg/pull/11662#discussion_r1861436171
##########
flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/sink/shuffle/SortKeySerializer.java:
##########
@@ -124,6 +124,14 @@ public void serialize(SortKey record, DataOutputView
target) throws IOException
for (int i = 0; i < size; ++i) {
int fieldId = transformedFields[i].fieldId();
Type.TypeID typeId = transformedFields[i].type().typeId();
+ Object value = record.get(i, Object.class);
Review Comment:
@stevenzwu I have looked at the current implementation in Flink, and the
serialization for null values references the implementation of
NullableSerializer. The underlying approach is also to add a boolean flag at
the beginning of the field to distinguish, which is quite similar to the
approach in this PR. Can we use the current method to fix this issue for now,
or are there any other better handling methods?
```java
NullableSerializer<T> extends TypeSerializer<T>
@Override
public void serialize(T record, DataOutputView target) throws
IOException {
if (record == null) {
target.writeBoolean(true);
target.write(padding);
} else {
target.writeBoolean(false);
originalSerializer.serialize(record, target);
}
}
@Override
public T deserialize(DataInputView source) throws IOException {
boolean isNull = deserializeNull(source);
return isNull ? null : originalSerializer.deserialize(source);
}
```
--
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]