Skip to content

Commit

Permalink
[SPARK-39321][SQL][TESTS][FOLLOW-UP] Respect CastWithAnsiOffSuite.ans…
Browse files Browse the repository at this point in the history
…iEnabled 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 <[email protected]>
Signed-off-by: Hyukjin Kwon <[email protected]>
  • Loading branch information
HyukjinKwon committed Jun 8, 2022
1 parent 54aabb0 commit 25f38b1
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ class CastWithAnsiOffSuite extends CastSuiteBase {
}

test("cast string to date #2") {
checkEvaluation(Cast(Literal("2015-03-18X"), DateType), null)
checkEvaluation(Cast(Literal("2015/03/18"), DateType), null)
checkEvaluation(Cast(Literal("2015.03.18"), DateType), null)
checkEvaluation(Cast(Literal("20150318"), DateType), null)
checkEvaluation(Cast(Literal("2015-031-8"), DateType), null)
checkEvaluation(cast(Literal("2015-03-18X"), DateType), null)
checkEvaluation(cast(Literal("2015/03/18"), DateType), null)
checkEvaluation(cast(Literal("2015.03.18"), DateType), null)
checkEvaluation(cast(Literal("20150318"), DateType), null)
checkEvaluation(cast(Literal("2015-031-8"), DateType), null)
}

test("casting to fixed-precision decimals") {
Expand Down

0 comments on commit 25f38b1

Please sign in to comment.