cloud-fan commented on a change in pull request #26680: [SPARK-30047][SQL]
Support interval types in UnsafeRow
URL: https://github.com/apache/spark/pull/26680#discussion_r351161664
##########
File path:
sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java
##########
@@ -297,6 +298,22 @@ public void setDecimal(int ordinal, Decimal value, int
precision) {
}
}
+ @Override
+ public void setInterval(int ordinal, CalendarInterval value) {
+ assertIndexIsValid(ordinal);
+ long cursor = getLong(ordinal) >>> 32;
+ assert cursor > 0 : "invalid cursor " + cursor;
+ if (value == null) {
+ setNullAt(ordinal);
+ Platform.putLong(baseObject, getFieldOffset(ordinal), (cursor << 32) |
16L);
Review comment:
This is different from decimal, which is var-length. We know the length is
always 16 for interval values.
Anyway, it doesn't hurt to encode the length here. Let's keep it.
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]