ilicmarkodb commented on code in PR #47521:
URL: https://github.com/apache/spark/pull/47521#discussion_r1720742864
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/types/PhysicalDataType.scala:
##########
@@ -234,10 +234,72 @@ case object PhysicalLongType extends PhysicalLongType
case class PhysicalMapType(keyType: DataType, valueType: DataType,
valueContainsNull: Boolean)
extends PhysicalDataType {
- override private[sql] def ordering =
- throw
QueryExecutionErrors.orderedOperationUnsupportedByDataTypeError("PhysicalMapType")
- override private[sql] type InternalType = Any
+ // maps are not orderable, we use `ordering` just to support group by queries
+ override private[sql] def ordering = interpretedOrdering
+ override private[sql] type InternalType = MapData
@transient private[sql] lazy val tag = typeTag[InternalType]
+
+ @transient
+ private[sql] lazy val interpretedOrdering: Ordering[MapData] = new
Ordering[MapData] {
+ private[this] val keyOrdering =
+ PhysicalDataType(keyType).ordering.asInstanceOf[Ordering[Any]]
+ private[this] val valuesOrdering =
+ PhysicalDataType(valueType).ordering.asInstanceOf[Ordering[Any]]
+
+ override def compare(left: MapData, right: MapData): Int = {
Review Comment:
But order by is also not supported in codegen path.
--
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]