JingsongLi commented on a change in pull request #10105:
[Flink-14599][table-planner-blink] Support precision of TimestampType in blink
planner
URL: https://github.com/apache/flink/pull/10105#discussion_r345657021
##########
File path:
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryArray.java
##########
@@ -361,6 +378,32 @@ public void setDecimal(int pos, Decimal value, int
precision) {
}
}
+ @Override
+ public void setTimestamp(int pos, SqlTimestamp value, int precision) {
+ assertIndexIsValid(pos);
+
+ if (SqlTimestamp.isCompact(precision)) {
+ setLong(pos, value.getMillisecond());
+ } else {
+ int fieldOffset = getElementOffset(pos, 8);
+ int cursor = (int) (SegmentsUtil.getLong(segments,
fieldOffset) >>> 32);
+ assert cursor > 0 : "invalid cursor " + cursor;
+
+ // zero-out the bytes
+ SegmentsUtil.setLong(segments, offset + cursor, 0L);
Review comment:
move this setLong to `if (value == null)`. This is not decimal, timestamp is
fix-length.
Others format too.
----------------------------------------------------------------
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