JingsongLi commented on a change in pull request #7931: [FLINK-11854]
[table-planner-blink] Introduce batch physical nodes
URL: https://github.com/apache/flink/pull/7931#discussion_r263655776
##########
File path:
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryRow.java
##########
@@ -63,6 +91,22 @@ public static int calculateFixPartSizeInBytes(int arity) {
return calculateBitSetWidthInBytes(arity) + 8 * arity;
}
+ /**
+ * If it is a fixed-length field, we can call this BinaryRow's setXX
method for in-place updates.
+ * If it is variable-length field, can't use this method, because the
underlying data is stored continuously.
+ */
+ public static boolean isFixedLength(InternalType type) {
+ if (type instanceof DecimalType) {
+ return ((DecimalType) type).precision() <=
DecimalType.MAX_COMPACT_PRECISION;
+ } else {
+ return MUTABLE_FIELD_TYPES.contains(type);
+ }
+ }
+
+ public static boolean isMutable(InternalType type) {
+ return MUTABLE_FIELD_TYPES.contains(type) || type instanceof
DecimalType;
Review comment:
No matter how precision is, it is mutable.
Precision is compact, Decimal is stored in 8 bytes in fix-length-part.
Precision is not compact, Decimal is stored in 16 bytes in var-length-part.
It can always be update.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services