ulysses-you commented on a change in pull request #1100:
URL: https://github.com/apache/incubator-kyuubi/pull/1100#discussion_r707890960
##########
File path:
dev/kyuubi-extension-spark-3-1/src/main/scala/org/apache/kyuubi/sql/zorder/Zorder.scala
##########
@@ -18,49 +18,33 @@
package org.apache.kyuubi.sql.zorder
import org.apache.spark.sql.catalyst.InternalRow
-import org.apache.spark.sql.catalyst.expressions.{BoundReference, Expression}
+import org.apache.spark.sql.catalyst.analysis.TypeCheckResult
+import org.apache.spark.sql.catalyst.expressions.Expression
import org.apache.spark.sql.catalyst.expressions.codegen.CodegenFallback
-import org.apache.spark.sql.types.{BinaryType, BooleanType, ByteType,
DataType, DateType, DecimalType, DoubleType, FloatType, IntegerType, LongType,
ShortType, StringType, TimestampType}
-import org.apache.spark.unsafe.types.UTF8String
+import org.apache.spark.sql.types.{BinaryType, DataType}
import org.apache.kyuubi.sql.KyuubiSQLExtensionException
case class Zorder(children: Seq[Expression]) extends Expression with
CodegenFallback {
- private lazy val defaultNullValues = {
- children.map {
- case bf: BoundReference =>
- bf.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 d: DecimalType =>
- Long.MaxValue
- case other: Any =>
- throw new KyuubiSQLExtensionException("Unsupported z-order type: "
+ other.getClass)
- }
- case other: Any =>
- throw new KyuubiSQLExtensionException("Unknown z-order column: " +
other)
+ override def foldable: Boolean = children.forall(_.foldable)
+ override def nullable: Boolean = false
+ override def dataType: DataType = BinaryType
+ override def prettyName: String = "zorder"
+
+ override def checkInputDataTypes(): TypeCheckResult = {
Review comment:
now we fail at analyzer side instead of execution
--
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]