Skip to content

Commit 25f38b1

Browse files
committed
[SPARK-39321][SQL][TESTS][FOLLOW-UP] Respect CastWithAnsiOffSuite.ansiEnabled in 'cast string to date #2'
### What changes were proposed in this pull request? This PR fixes the test to make `CastWithAnsiOffSuite` properly respect `ansiEnabled` in `cast string to date #2` test by using `CastWithAnsiOffSuite.cast` instead of `Cast` expression. ### Why are the changes needed? To make the tests pass. Currently it fails when ANSI mode is on: https://github.com/apache/spark/runs/6786744647 ### Does this PR introduce _any_ user-facing change? No, test-only. ### How was this patch tested? Manually tested in my IDE. Closes apache#36802 from HyukjinKwon/SPARK-39321-followup. Authored-by: Hyukjin Kwon <gurwls223@apache.org> Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
1 parent 54aabb0 commit 25f38b1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CastWithAnsiOffSuite.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ class CastWithAnsiOffSuite extends CastSuiteBase {
6565
}
6666

6767
test("cast string to date #2") {
68-
checkEvaluation(Cast(Literal("2015-03-18X"), DateType), null)
69-
checkEvaluation(Cast(Literal("2015/03/18"), DateType), null)
70-
checkEvaluation(Cast(Literal("2015.03.18"), DateType), null)
71-
checkEvaluation(Cast(Literal("20150318"), DateType), null)
72-
checkEvaluation(Cast(Literal("2015-031-8"), DateType), null)
68+
checkEvaluation(cast(Literal("2015-03-18X"), DateType), null)
69+
checkEvaluation(cast(Literal("2015/03/18"), DateType), null)
70+
checkEvaluation(cast(Literal("2015.03.18"), DateType), null)
71+
checkEvaluation(cast(Literal("20150318"), DateType), null)
72+
checkEvaluation(cast(Literal("2015-031-8"), DateType), null)
7373
}
7474

7575
test("casting to fixed-precision decimals") {

0 commit comments

Comments
 (0)