This is an automated email from the ASF dual-hosted git repository.
andygrove pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-comet.git
The following commit(s) were added to refs/heads/main by this push:
new 926b5caab4 test: cover array date cast fallback (#4593)
926b5caab4 is described below
commit 926b5caab43a42058f12bcc7e93ad03b95caf29f
Author: Manu Zhang <[email protected]>
AuthorDate: Fri Jun 5 05:16:50 2026 +0800
test: cover array date cast fallback (#4593)
Co-authored-by: Codex <[email protected]>
---
.../scala/org/apache/comet/CometCastSuite.scala | 27 +++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/spark/src/test/scala/org/apache/comet/CometCastSuite.scala
b/spark/src/test/scala/org/apache/comet/CometCastSuite.scala
index 76b5433100..6c93481fe0 100644
--- a/spark/src/test/scala/org/apache/comet/CometCastSuite.scala
+++ b/spark/src/test/scala/org/apache/comet/CometCastSuite.scala
@@ -36,7 +36,7 @@ import org.apache.spark.sql.types.{ArrayType, BinaryType,
BooleanType, ByteType,
import org.apache.comet.expressions.{CometCast, CometEvalMode}
import org.apache.comet.rules.CometScanTypeChecker
-import org.apache.comet.serde.{Compatible, Incompatible}
+import org.apache.comet.serde.{Compatible, Incompatible, Unsupported}
class CometCastSuite extends CometTestBase with AdaptiveSparkPlanHelper {
@@ -1635,6 +1635,31 @@ class CometCastSuite extends CometTestBase with
AdaptiveSparkPlanHelper {
testArrayCastMatrix(types, ArrayType(_), generateArrays(100, _))
}
+ test("cast ArrayType(DateType) to unsupported ArrayType falls back") {
+ val fromType = ArrayType(DateType)
+ val unsupportedElementTypes =
+ Seq(BooleanType, ByteType, ShortType, LongType, FloatType, DoubleType,
DecimalType(10, 2))
+ val input = generateArrays(100, DateType)
+
+ withTempPath { dir =>
+ val data = roundtripParquet(input, dir).coalesce(1)
+
+ withSQLConf(SQLConf.ANSI_ENABLED.key -> "false") {
+ unsupportedElementTypes.foreach { toElementType =>
+ val toType = ArrayType(toElementType)
+ val expectedMessage = s"Cast from $fromType to $toType is not
supported"
+
+ assert(
+ CometCast.isSupported(fromType, toType, None,
CometEvalMode.LEGACY) ==
+ Unsupported(Some(expectedMessage)))
+ checkSparkAnswerAndFallbackReason(
+ data.select(col("a").cast(toType).as("converted")),
+ expectedMessage)
+ }
+ }
+ }
+ }
+
// https://github.com/apache/datafusion-comet/issues/3906
test("cast nested ArrayType to nested ArrayType") {
val types = Seq(
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]