You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/11/29 15:26:12 UTC

[GitHub] [spark] MaxGekk commented on a change in pull request #34716: [SPARK-37468][SQL] Support ANSI intervals and TimestampNTZ for UnionEstimation

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/statsEstimation/UnionEstimation.scala
##########
@@ -50,13 +50,23 @@ object UnionEstimation {
     case TimestampType => (a: Any, b: Any) =>
       TimestampType.ordering.lt(a.asInstanceOf[TimestampType.InternalType],
         b.asInstanceOf[TimestampType.InternalType])
+    case TimestampNTZType => (a: Any, b: Any) =>
+      TimestampNTZType.ordering.lt(a.asInstanceOf[TimestampNTZType.InternalType],
+        b.asInstanceOf[TimestampNTZType.InternalType])
+    case y: YearMonthIntervalType => (a: Any, b: Any) =>
+      y.ordering.lt(a.asInstanceOf[y.InternalType],
+        b.asInstanceOf[y.InternalType])
+    case d: DayTimeIntervalType => (a: Any, b: Any) =>
+      d.ordering.lt(a.asInstanceOf[d.InternalType],
+        b.asInstanceOf[d.InternalType])
     case _ =>
       throw new IllegalStateException(s"Unsupported data type: ${dt.catalogString}")
   }
 
   private def isTypeSupported(dt: DataType): Boolean = dt match {
     case ByteType | IntegerType | ShortType | FloatType | LongType |
-         DoubleType | DateType | _: DecimalType | TimestampType => true
+         DoubleType | DateType | _: DecimalType | TimestampType | TimestampNTZType |
+         _: YearMonthIntervalType | _: DayTimeIntervalType => true

Review comment:
       ```suggestion
            _: AnsiIntervalType => true
   ```

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/statsEstimation/UnionEstimation.scala
##########
@@ -50,13 +50,23 @@ object UnionEstimation {
     case TimestampType => (a: Any, b: Any) =>
       TimestampType.ordering.lt(a.asInstanceOf[TimestampType.InternalType],
         b.asInstanceOf[TimestampType.InternalType])
+    case TimestampNTZType => (a: Any, b: Any) =>
+      TimestampNTZType.ordering.lt(a.asInstanceOf[TimestampNTZType.InternalType],
+        b.asInstanceOf[TimestampNTZType.InternalType])
+    case y: YearMonthIntervalType => (a: Any, b: Any) =>
+      y.ordering.lt(a.asInstanceOf[y.InternalType],
+        b.asInstanceOf[y.InternalType])
+    case d: DayTimeIntervalType => (a: Any, b: Any) =>
+      d.ordering.lt(a.asInstanceOf[d.InternalType],
+        b.asInstanceOf[d.InternalType])

Review comment:
       ```suggestion
       case i: AnsiIntervalType => (a: Any, b: Any) =>
         i.ordering.lt(a.asInstanceOf[i.InternalType], b.asInstanceOf[i.InternalType])
   ```




-- 
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