sunchao commented on code in PR #6170:
URL: https://github.com/apache/datafusion-comet/pull/6170#discussion_r4178984852
##########
spark/src/test/scala/org/apache/comet/CometNativeCastSuite.scala:
##########
@@ -1751,6 +1751,22 @@ class CometNativeCastSuite extends CometTestBase with
AdaptiveSparkPlanHelper {
}
}
+ test("collation casts retain Spark fallback") {
+ assume(CometSparkSessionExtensions.isSpark40Plus)
+ withSQLConf(CometConf.COMET_SCALA_UDF_CODEGEN_ENABLED.key -> "false") {
+ withParquetTable(Seq(("a", "A"), ("x ", "x")), "collation_cast") {
+ for (collation <- Seq("UTF8_LCASE", "UTF8_BINARY_RTRIM")) {
+ val a = s"CAST(_1 AS STRING COLLATE $collation)"
+ val b = s"CAST(_2 AS STRING COLLATE $collation)"
+ checkSparkAnswerAndFallbackReason(
+ s"SELECT array_contains(array($a), $b), " +
+ s"arrays_overlap(array($a), array($b)) FROM collation_cast",
+ "Cast from StringType")
Review Comment:
[P2] Use `CometCast.nonDefaultCollationReason` for this assertion. On Spark
4.x with dispatch disabled, these collated casts correctly fall back, but the
current guard reports `Cast involving a non-default string collation is not
supported ...`, which does not contain `Cast from StringType`. Consequently,
the newly added `collation casts retain Spark fallback` test fails
deterministically despite correct fallback behavior, failing all three Spark
4.x expression jobs and Required Checks.
Evidence: Exact-head CI reproduces this assertion failure on Spark 4.0, 4.1,
and 4.2. Spark 4.1 log:
https://github.com/apache/datafusion-comet/actions/runs/37222748605/job/111502757158.
It reports `Expected fallback reason 'Cast from StringType' not found in [Cast
involving a non-default string collation is not supported ...]`. The pinned
head defines that actual message in `CometCast.nonDefaultCollationReason`, and
`checkSparkAnswerAndFallbackReasons` requires a substring match. Both files and
this test are unchanged between the pinned head and CI’s tested merge.
--
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]