Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-47440][SQL] Fix pushing unsupported syntax to MsSqlServer
### What changes were proposed in this pull request? In this PR, I propose a change in SQLQuery builder of MsSqlServer dialect. I override build method to check for boolean operator in binary comparisons and throw exception if encountered. ### Why are the changes needed? MsSqlServer syntax prevents boolean operators in any binary comparison. Reasoning is lack of boolean data type in MsSqlServer. It was possible to construct Spark query that would generate this situation in MsSqlServer and engine would throw syntax exception on the MsSqlServer side. This PR solves this bug. For example, in table `people` there is a `name` column. In MsSqlServer if we try to execute: `SELECT * FROM people WHERE (name LIKE 'a%') = (name LIKE '%b')` we would get a syntax error. However this query is fine in other major engines. ### Does this PR introduce _any_ user-facing change? Yes, user will not encounter syntax exception in MsSqlServer when writing these queries. ### How was this patch tested? By running a unit test in MsSqlServerIntegrationSuite ### Was this patch authored or co-authored using generative AI tooling? No Closes apache#45564 from stefanbuk-db/SQLServer_like_operator_bugfix. Authored-by: Stefan Bukorovic <[email protected]> Signed-off-by: Kent Yao <[email protected]>
- Loading branch information