amaliujia commented on code in PR #40651:
URL: https://github.com/apache/spark/pull/40651#discussion_r1159317608
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/types/PhysicalDataType.scala:
##########
@@ -17,53 +17,237 @@
package org.apache.spark.sql.catalyst.types
-import org.apache.spark.sql.types._
-
-
-sealed abstract class PhysicalDataType
-
-sealed abstract class PhysicalPrimitiveType extends PhysicalDataType
-
-case class PhysicalArrayType(elementType: DataType, containsNull: Boolean)
extends PhysicalDataType
-
-class PhysicalBinaryType() extends PhysicalDataType
+import scala.reflect.runtime.universe.TypeTag
+import scala.reflect.runtime.universe.typeTag
+
+import org.apache.spark.sql.catalyst.expressions.{Ascending, BoundReference,
InterpretedOrdering, SortOrder}
+import org.apache.spark.sql.catalyst.util.{ArrayData, SQLOrderingUtil}
+import org.apache.spark.sql.errors.QueryExecutionErrors
+import org.apache.spark.sql.types.{ArrayType, BinaryType, BooleanType,
ByteType, DataType, DateType, DayTimeIntervalType, Decimal, DecimalType,
DoubleType, FloatType, IntegerType, LongType, MapType, NullType, ShortType,
StringType, StructField, StructType, TimestampNTZType, TimestampType,
YearMonthIntervalType}
+import org.apache.spark.unsafe.types.{ByteArray, UTF8String}
+
+sealed abstract class PhysicalDataType {
+ private[sql] type InternalType
+ private[sql] def ordering: Ordering[InternalType]
+ private[sql] val tag: TypeTag[InternalType]
+}
+
+object PhysicalDataType {
+ def apply(dt: DataType): PhysicalDataType = dt match {
+ case NullType => PhysicalNullType
+ case ByteType => PhysicalByteType
+ case ShortType => PhysicalShortType
+ case IntegerType => PhysicalIntegerType
+ case LongType => PhysicalLongType
+ case StringType => PhysicalStringType
+ case FloatType => PhysicalFloatType
+ case DoubleType => PhysicalDoubleType
+ case DecimalType.Fixed(p, s) => PhysicalDecimalType(p, s)
+ case BooleanType => PhysicalBooleanType
+ case BinaryType => PhysicalBinaryType
+ case TimestampType => PhysicalLongType
+ case TimestampNTZType => PhysicalLongType
+ case DayTimeIntervalType(_, _) => PhysicalLongType
+ case YearMonthIntervalType(_, _) => PhysicalIntegerType
+ case DateType => PhysicalIntegerType
+ case ArrayType(elementType, containsNull) =>
PhysicalArrayType(elementType, containsNull)
Review Comment:
I am honestly not sure. The current way is the PhysicalDataType contains
element type as logical type and when needs to access those physical
properties, it does the required conversion.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]