diff --git a/dev/kyuubi-extension-spark-3-1/src/main/scala/org/apache/kyuubi/sql/zorder/Zorder.scala b/dev/kyuubi-extension-spark-3-1/src/main/scala/org/apache/kyuubi/sql/zorder/Zorder.scala index 16863eef9..49661e068 100644 --- a/dev/kyuubi-extension-spark-3-1/src/main/scala/org/apache/kyuubi/sql/zorder/Zorder.scala +++ b/dev/kyuubi-extension-spark-3-1/src/main/scala/org/apache/kyuubi/sql/zorder/Zorder.scala @@ -46,7 +46,6 @@ case class Zorder(children: Seq[Expression]) extends Expression { private lazy val defaultNullValues: Array[Array[Byte]] = children.map(_.dataType) .map(ZorderBytesUtils.defaultValue) - .map(ZorderBytesUtils.toByte) .toArray override def eval(input: InternalRow): Any = { diff --git a/dev/kyuubi-extension-spark-3-1/src/main/scala/org/apache/kyuubi/sql/zorder/ZorderBytesUtils.scala b/dev/kyuubi-extension-spark-3-1/src/main/scala/org/apache/kyuubi/sql/zorder/ZorderBytesUtils.scala index a64f4581e..b14d74987 100644 --- a/dev/kyuubi-extension-spark-3-1/src/main/scala/org/apache/kyuubi/sql/zorder/ZorderBytesUtils.scala +++ b/dev/kyuubi-extension-spark-3-1/src/main/scala/org/apache/kyuubi/sql/zorder/ZorderBytesUtils.scala @@ -171,30 +171,27 @@ object ZorderBytesUtils { result } - def defaultValue(dataType: DataType): Any = dataType match { - case BooleanType => - false - case ByteType => - Byte.MaxValue - case ShortType => - Short.MaxValue - case IntegerType => - Int.MaxValue - case LongType => - Long.MaxValue - case FloatType => - Float.MaxValue - case DoubleType => - Double.MaxValue - case StringType => - UTF8String.fromBytes(new Array[Byte](0)) - case TimestampType => - Long.MaxValue - case DateType => - Int.MaxValue - case _: DecimalType => - Long.MaxValue - case other: Any => - throw new KyuubiSQLExtensionException(s"Unsupported z-order type: ${other.catalogString}") + def defaultValue(dataType: DataType): Array[Byte] = { + val v = dataType match { + case BooleanType => + false + case ByteType => + Byte.MaxValue + case ShortType => + Short.MaxValue + case IntegerType | DateType => + Int.MaxValue + case LongType | TimestampType | _: DecimalType => + Long.MaxValue + case FloatType => + Float.MaxValue + case DoubleType => + Double.MaxValue + case StringType => + UTF8String.fromBytes(new Array[Byte](0)) + case other: Any => + throw new KyuubiSQLExtensionException(s"Unsupported z-order type: ${other.catalogString}") + } + toByte(v) } }