[SPARK-51906][SQL][FOLLOW-UP] Enforce ANSI mode in previous tests #50851
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Limit the tests added in #50701 and #50593 only for ANSI_ENABLED mode.
Why are the changes needed?
These tests fail in non-ANSI mode. The reason is that https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/V2ExpressionUtils.scala only converts majority of catalyst => V2 expressions in ANSI mode. So , we do not get any V2Expression in non-ANSI case.
Does this PR introduce any user-facing change?
No
How was this patch tested?
Existing unit test run with SPARK_ANSI_SQL_MODE=false
Was this patch authored or co-authored using generative AI tooling?
No