amaliujia commented on code in PR #40651:
URL: https://github.com/apache/spark/pull/40651#discussion_r1157600655
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/types/PhysicalDataType.scala:
##########
@@ -17,53 +17,234 @@
package org.apache.spark.sql.catalyst.types
-import org.apache.spark.sql.types._
-
+import scala.reflect.runtime.universe.TypeTag
+import scala.reflect.runtime.universe.typeTag
+import scala.util.control.NonFatal
+import org.apache.spark.sql.catalyst.util.SQLOrderingUtil
+import org.apache.spark.sql.errors.QueryExecutionErrors
+import org.apache.spark.sql.types.{AtomicType, BinaryType, BooleanType,
ByteType, DataType, DateType, DayTimeIntervalType, Decimal, DecimalType,
DoubleType, FloatType, IntegerType, LongType, NullType, NumericType, ShortType,
StringType, StructField, TimestampNTZType, TimestampType}
+import org.apache.spark.unsafe.types.{ByteArray, UTF8String}
sealed abstract class PhysicalDataType
-sealed abstract class PhysicalPrimitiveType extends PhysicalDataType
+object PhysicalDataType {
+ def apply(dt: DataType): PhysicalDataType = dt match {
+ case NullType => PhysicalNullType
+ case BooleanType => PhysicalBooleanType
+ case ByteType => PhysicalByteType
+ case ShortType => PhysicalShortType
+ case IntegerType => PhysicalIntegerType
+ case LongType => PhysicalLongType
+ case FloatType => PhysicalFloatType
+ case DoubleType => PhysicalDoubleType
+ case DecimalType.Fixed(p, s) => PhysicalDecimalType(p, s)
+ case BinaryType => PhysicalBinaryType
+ case _ => UninitializedPhysicalType
+ }
+}
+
+trait PhysicalPrimitiveType
Review Comment:
https://github.com/apache/spark/pull/40400
Because this PR above introduced an abstract class `PhysicalPrimitiveType`
which does not work well with our DataType classes. So I switch it to a trait
and then adding those physical version of atomic, numeric, etc. types
--
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]