MaxGekk commented on a change in pull request #31979:
URL: https://github.com/apache/spark/pull/31979#discussion_r602909924



##########
File path: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveInspectors.scala
##########
@@ -346,6 +347,20 @@ private[hive] trait HiveInspectors {
         withNullSafe(o => getTimestampWritable(o))
       case _: TimestampObjectInspector =>
         withNullSafe(o => DateTimeUtils.toJavaTimestamp(o.asInstanceOf[Long]))
+      case _: HiveIntervalDayTimeObjectInspector  if x.preferWritable() =>
+        withNullSafe(o => getDayTimeIntervalWritable(o))
+      case _: HiveIntervalDayTimeObjectInspector =>
+        withNullSafe(o => {
+          val duration = IntervalUtils.microsToDuration(o.asInstanceOf[Long])
+          new HiveIntervalDayTime(duration.getSeconds, duration.getNano)
+        })
+      case _: HiveIntervalYearMonthObjectInspector if x.preferWritable() =>
+        withNullSafe(o => getYearMonthIntervalWritable(o))
+      case _: HiveIntervalYearMonthObjectInspector =>
+        withNullSafe(o => {
+          val period = IntervalUtils.monthsToPeriod(o.asInstanceOf[Int])
+          new HiveIntervalYearMonth(period.getYears, period.getMonths)
+        })

Review comment:
       ```suggestion
           withNullSafe(o => new HiveIntervalYearMonth(o.asInstanceOf[Int]))
   ```




-- 
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:
us...@infra.apache.org



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

Reply via email to