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


##########
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:
   this if code is duplicated more than once by this fix,  can we refactor to a 
method remove the duplication.
   Better still could we have an enumeration for each type then use the 
enumeration to call a common method. Maybe the enumeration could be something 
likesomething like:
   
   ```
     SetLongSemantics( Object type, boolean isUnScaledLong) {
           this.type = type;
           this.isUnScaledLong = isUnScaledLong;
       }
   
    TimestampDataValueAsLong(TimestampData, true),
    TimestampDataValueAsMilliseconds(TimestampData, false),
   .... 
   ```
   
   If setNullBit is import then include that.
   
   WDYT?



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