dengziming commented on code in PR #26594:
URL: https://github.com/apache/flink/pull/26594#discussion_r2110781697


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/data/binary/BinaryArrayData.java:
##########
@@ -372,7 +372,11 @@ public void setDecimal(int pos, DecimalData value, int 
precision) {
 
         if (DecimalData.isCompact(precision)) {
             // compact format
-            setLong(pos, value.toUnscaledLong());
+            if (value == null) {

Review Comment:
   Thanks for this suggestion, the motivation makes sense. The effort required 
to unify these abstractions is significant, and it's overkill to do this in the 
PR, so I just left a todo here for now.



##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/data/writer/AbstractBinaryWriter.java:
##########
@@ -165,8 +165,11 @@ public void writeDecimal(int pos, DecimalData value, int 
precision) {
         assert value == null || (value.precision() == precision);
 
         if (DecimalData.isCompact(precision)) {
-            assert value != null;
-            writeLong(pos, value.toUnscaledLong());
+            if (value == null) {
+                setNullBit(pos);

Review Comment:
   Good catch, I reviewed the code, `setNullBit` only sets the null-tracking 
bit of this field, and `setNullAt` sets null-bit and sets the fixed-length data 
to 0, so it should be `setNullAt(pos)`.



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to