Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7d78be3
core
andrej-db Oct 23, 2024
7839e1d
revert MsSqlServerDialect build method
andrej-db Oct 23, 2024
0172c49
remove visitCaseWhen, more intuitive predicate wrapping
andrej-db Oct 23, 2024
7ae7397
imports
andrej-db Oct 23, 2024
49d742e
fix
andrej-db Oct 23, 2024
c2001d9
MsSqlServerDialect: comment
andrej-db Oct 24, 2024
8b1b2da
JdbcDialects: move aux here
andrej-db Oct 25, 2024
1f01b77
V2ExpressionBuilder: refactor
andrej-db Oct 25, 2024
7e36029
nit
andrej-db Oct 29, 2024
ab79afe
nit
andrej-db Nov 18, 2024
de38a8c
Update JdbcDialects.scala
cloud-fan Nov 19, 2024
56cea3c
Update MsSqlServerDialect.scala
cloud-fan Nov 19, 2024
21ec622
Update sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects…
cloud-fan Nov 19, 2024
468eb89
Update JdbcDialects.scala
cloud-fan Nov 19, 2024
1bc39ee
Update sql/core/src/main/scala/org/apache/spark/sql/jdbc/MsSqlServerD…
cloud-fan Nov 19, 2024
6a221c6
Update JdbcDialects.scala
cloud-fan Nov 19, 2024
ef1bcc8
Update MsSqlServerDialect.scala
cloud-fan Nov 19, 2024
5d94fa1
Update JdbcDialects.scala
andrej-db Nov 19, 2024
f94f8e5
Update MsSqlServerDialect.scala
andrej-db Nov 19, 2024
55084a3
Update MsSqlServerIntegrationSuite.scala
andrej-db Nov 19, 2024
7fb6b29
Update MsSqlServerDialect.scala
andrej-db Nov 19, 2024
ca0545a
Update MsSqlServerIntegrationSuite.scala
andrej-db Nov 19, 2024
df2fe41
Apply suggestions from code review
cloud-fan Nov 20, 2024
53a4220
Update connector/docker-integration-tests/src/test/scala/org/apache/s…
cloud-fan Nov 20, 2024
cbef9a5
Update MsSqlServerIntegrationSuite.scala
cloud-fan Nov 20, 2024
c990ec6
Update JdbcDialects.scala
cloud-fan Nov 20, 2024
ee4d4fb
Update sql/core/src/main/scala/org/apache/spark/sql/jdbc/MsSqlServerD…
cloud-fan Nov 20, 2024
6cff9f5
Update MsSqlServerIntegrationSuite.scala
andrej-db Nov 21, 2024
bca7ce8
Merge branch 'apache:master' into SPARK-50087-CaseWhen
andrej-db Nov 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update MsSqlServerIntegrationSuite.scala
  • Loading branch information
andrej-db authored Nov 21, 2024
commit 6cff9f56f6f1b9d9d00d2bd95c862ea733deeb3c
Original file line number Diff line number Diff line change
Expand Up @@ -162,45 +162,6 @@ class MsSqlServerIntegrationSuite extends DockerJDBCIntegrationV2Suite with V2JD
assert(df.collect().length == 2)
}

test("SPARK-50087: SqlServer handle booleans in IF in SELECT test") {
// This doesn't compile on SqlServer unless result boolean expressions
// in IF / CASE WHEN are wrapped with a CASE WHEN(<>, 1, 0).
val df = sql(
s"""|WITH dummy AS (
| SELECT
| DISTINCT name AS full_name,
| UPPER(name) AS test_type,
| name,
| IF(
| LOWER(name) = 'legolas' OR LOWER(name) = 'elrond',
| 'Elf',
| IF(
| LOWER(name) = 'gimli' OR LOWER(name) = 'thorin',
| 'Dwarf',
| IF(
| LOWER(name) = 'gandalf' OR LOWER(name) = 'radagast',
| 'Wizard',
| LOWER(name)
| )
| )
| ) AS test_type_name
| FROM $catalogName.employee
|),
|dummy_new AS (
| SELECT *
| FROM dummy WHERE test_type_name = 'Wizard'
|)
|SELECT * FROM dummy_new limit 1""".stripMargin
)

// scalastyle:off
assert(getExternalEngineQuery(df.queryExecution.executedPlan) ==
"""SELECT TOP (1) "name" FROM "employee" WHERE (CASE WHEN ((LOWER("name") = 'legolas') OR (LOWER("name") = 'elrond')) THEN 0 ELSE IIF((CASE WHEN ((LOWER("name") = 'gimli') OR (LOWER("name") = 'thorin')) THEN 0 ELSE IIF((CASE WHEN ((LOWER("name") = 'gandalf') OR (LOWER("name") = 'radagast')) THEN 1 ELSE IIF((LOWER("name") = 'Wizard'), 1, 0) END = 1), 1, 0) END = 1), 1, 0) END = 1) """
)
// scalastyle:on
df.collect()
}

test("SPARK-50087: SqlServer handle booleans in CASE WHEN test") {
val df = sql(
s"""|SELECT * FROM $catalogName.employee
Expand Down