You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "hvanhovell (via GitHub)" <gi...@apache.org> on 2023/09/12 15:07:56 UTC

[GitHub] [spark] hvanhovell commented on a diff in pull request #42847: [SPARK-45128][SQL] Support `CalendarIntervalType` in Arrow

hvanhovell commented on code in PR #42847:
URL: https://github.com/apache/spark/pull/42847#discussion_r1323190219


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/execution/arrow/ArrowWriter.scala:
##########
@@ -464,3 +466,15 @@ private[arrow] class DurationWriter(val valueVector: DurationVector)
     valueVector.set(count, input.getLong(ordinal))
   }
 }
+
+private[arrow] class IntervalMonthDayNanoWriter(val valueVector: IntervalMonthDayNanoVector)
+  extends ArrowFieldWriter {
+  override def setNull(): Unit = {
+    valueVector.setNull(count)
+  }
+
+  override def setValue(input: SpecializedGetters, ordinal: Int): Unit = {
+    val ci = input.getInterval(ordinal)
+    valueVector.setSafe(count, ci.months, ci.days, ci.microseconds * 1000)

Review Comment:
   Should add an overflow check here?



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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