[SPARK-56541][SQL][TESTS] Add test coverage for try_to_date() in DateFunctionSuite#55418
[SPARK-56541][SQL][TESTS] Add test coverage for try_to_date() in DateFunctionSuite#55418pratham76 wants to merge 1 commit intoapache:masterfrom
Conversation
|
@MaxGekk @cloud-fan Could you please have a look. FYI @mihailomilosevic2001. Just following up on your initial PR #51555, which added support for |
9d45d2e to
3ccaa47
Compare
|
CI has passed. @HyukjinKwon @MaxGekk Could we check this in? |
| df2.select(try_to_date(col("s"), "yyyy-dd-MM")), | ||
| Seq(Row(null), Row(Date.valueOf("2014-12-31")))) | ||
|
|
||
| // invalid dates - returns NULL |
There was a problem hiding this comment.
nit: These are not only invalid dates, but invalid string inputs in general.
There was a problem hiding this comment.
Noted. Have updated the comment as invalid format
| Seq(Row(Date.valueOf("2015-07-22")), Row(null))) | ||
| checkAnswer( | ||
| df2.select(try_to_date(col("s"), "yyyy-dd-MM")), | ||
| Seq(Row(null), Row(Date.valueOf("2014-12-31")))) |
There was a problem hiding this comment.
We need a test coverage for selectExpr too.
There was a problem hiding this comment.
Thanks! Updated the test case to have selectExpr as well
3ccaa47 to
e12bd27
Compare
|
+1, LGTM. Merging to master. |
What changes were proposed in this pull request?
Added comprehensive test coverage for the try_to_date function in DateFunctionsSuite.
Why are the changes needed?
The try_to_date function was added as part of SPARK-52866, but comprehensive test coverage in DateFunctionsSuite seems to have been missed at that time.
Does this PR introduce any user-facing change?
No
How was this patch tested?
UT framework
Was this patch authored or co-authored using generative AI tooling?
No