You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[SPARK-48172][SQL] Fix escaping issues in JDBCDialects
This PR is a fix of #46437. The previous PR was reverted as `LONGTEXT` is not supported by all dialects.
### What changes were proposed in this pull request?
Special case escaping for MySQL and fix issues with redundant escaping for ' character.
New changes introduced in the fix include change `LONGTEXT` -> `VARCHAR(50)`, as well as fix for table naming in the tests.
### Why are the changes needed?
When pushing down startsWith, endsWith and contains they are converted to LIKE. This requires addition of escape characters for these expressions. Unfortunately, MySQL uses ESCAPE '\' syntax instead of ESCAPE '' which would cause errors when trying to push down.
### Does this PR introduce any user-facing change?
Yes
### How was this patch tested?
Tests for each existing dialect.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes#46588 from mihailom-db/SPARK-48172.
Authored-by: Mihailo Milosevic <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
Copy file name to clipboardExpand all lines: connector/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/v2/DockerJDBCIntegrationV2Suite.scala
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -38,6 +38,17 @@ abstract class DockerJDBCIntegrationV2Suite extends DockerJDBCIntegrationSuite {
38
38
.executeUpdate()
39
39
connection.prepareStatement("INSERT INTO employee VALUES (6, 'jen', 12000, 1200)")
Copy file name to clipboardExpand all lines: connector/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/v2/MsSqlServerIntegrationSuite.scala
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -70,6 +70,12 @@ class MsSqlServerIntegrationSuite extends DockerJDBCIntegrationV2Suite with V2JD
Copy file name to clipboardExpand all lines: connector/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/v2/MySQLIntegrationSuite.scala
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -73,6 +73,12 @@ class MySQLIntegrationSuite extends DockerJDBCIntegrationV2Suite with V2JDBCTest
73
73
connection.prepareStatement(
74
74
"CREATE TABLE employee (dept INT, name VARCHAR(32), salary DECIMAL(20, 2),"+
Copy file name to clipboardExpand all lines: connector/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/v2/OracleIntegrationSuite.scala
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -93,6 +93,12 @@ class OracleIntegrationSuite extends DockerJDBCIntegrationV2Suite with V2JDBCTes
93
93
connection.prepareStatement(
94
94
"CREATE TABLE employee (dept NUMBER(32), name VARCHAR2(32), salary NUMBER(20, 2),"+
Copy file name to clipboardExpand all lines: connector/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/v2/PostgresIntegrationSuite.scala
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -59,6 +59,12 @@ class PostgresIntegrationSuite extends DockerJDBCIntegrationV2Suite with V2JDBCT
59
59
connection.prepareStatement(
60
60
"CREATE TABLE employee (dept INTEGER, name VARCHAR(32), salary NUMERIC(20, 2),"+
0 commit comments