spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [spark] cloud-fan commented on a change in pull request #26680: [SPARK-30047][SQL] Support interval types in UnsafeRow
Date Wed, 27 Nov 2019 09:01:43 GMT
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message