Skip to content

Conversation

@mihailom-db
Copy link
Contributor

@mihailom-db mihailom-db commented May 15, 2024

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.

@github-actions github-actions bot added the SQL label May 15, 2024
@mihailom-db mihailom-db changed the title [SPARK-48172][SQL] Fix reverted PR [SPARK-48172][SQL] Fix escaping issues in JDBCDialects May 15, 2024
@cloud-fan
Copy link
Contributor

cloud-fan commented May 15, 2024

thanks, merging to master/3.5/3.4!

@cloud-fan cloud-fan closed this in 9e386b4 May 15, 2024
cloud-fan pushed a commit that referenced this pull request May 15, 2024
This PR is a fix of #46437. The previous PR was reverted as `LONGTEXT` is not supported by all dialects.

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.

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.

Yes

Tests for each existing dialect.

No.

Closes #46588 from mihailom-db/SPARK-48172.

Authored-by: Mihailo Milosevic <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
(cherry picked from commit 9e386b4)
Signed-off-by: Wenchen Fan <[email protected]>
cloud-fan pushed a commit that referenced this pull request May 15, 2024
This PR is a fix of #46437. The previous PR was reverted as `LONGTEXT` is not supported by all dialects.

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.

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.

Yes

Tests for each existing dialect.

No.

Closes #46588 from mihailom-db/SPARK-48172.

Authored-by: Mihailo Milosevic <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
(cherry picked from commit 9e386b4)
Signed-off-by: Wenchen Fan <[email protected]>
@yaooqinn
Copy link
Member

https://github.com/apache/spark/actions/workflows/build_branch35.yml
https://github.com/apache/spark/actions/workflows/build_branch34.yml

These daily jobs for branch-3.4 and 3.5 seem to be broken by this PR?

cc @cloud-fan @mihailom-db , also cc @LuciferYang

@mihailom-db
Copy link
Contributor Author

Getting back from the vacation tomorrow, will take a look at this early in the morning.

@yaooqinn
Copy link
Member

Thank you @mihailom-db

@mihailom-db
Copy link
Contributor Author

Found the error. It seems to be due to the JDK version under which the jobs are run. #46803 this PR proposes a change for 3.4. @yaooqinn @cloud-fan

yaooqinn pushed a commit that referenced this pull request May 31, 2024
### What changes were proposed in this pull request?
Removal of stripMargin from the code in `DockerJDBCIntegrationV2Suite`.

### Why are the changes needed?
#46588
Given PR was merged to master/3.5/3.4. This PR broke daily jobs for `OracleIntegrationSuite`. Upon inspection, it was noted that 3.4 and 3.5 are run with JDK8 while master is run with JDK21 and stripMargin was behaving differently in those cases. Upon removing stripMargin and spliting `INSERT INTO` statements into multiple lines, all integration tests have passed.

### Does this PR introduce _any_ user-facing change?
No, only loading of the test data was changed to follow language requirements.

### How was this patch tested?
Existing suite was aborted in the job and now it is running.

### Was this patch authored or co-authored using generative AI tooling?
No

Closes #46806

Closes #46807 from mihailom-db/FixOracleMaster.

Authored-by: Mihailo Milosevic <[email protected]>
Signed-off-by: Kent Yao <[email protected]>
yaooqinn pushed a commit that referenced this pull request May 31, 2024
### What changes were proposed in this pull request?
Removal of stripMargin from the code in `DockerJDBCIntegrationV2Suite`.

### Why are the changes needed?
#46588
Given PR was merged to master/3.5/3.4. This PR broke daily jobs for `OracleIntegrationSuite`. Upon inspection, it was noted that 3.4 and 3.5 are run with JDK8 while master is run with JDK21 and stripMargin was behaving differently in those cases. Upon removing stripMargin and spliting `INSERT INTO` statements into multiple lines, all integration tests have passed.

### Does this PR introduce _any_ user-facing change?
No, only loading of the test data was changed to follow language requirements.

### How was this patch tested?
Existing suite was aborted in the job and now it is running.

### Was this patch authored or co-authored using generative AI tooling?
No

Closes #46806

Closes #46807 from mihailom-db/FixOracleMaster.

Authored-by: Mihailo Milosevic <[email protected]>
Signed-off-by: Kent Yao <[email protected]>
(cherry picked from commit 4360ec7)
Signed-off-by: Kent Yao <[email protected]>
yaooqinn pushed a commit that referenced this pull request May 31, 2024
### What changes were proposed in this pull request?
Removal of stripMargin from the code in `DockerJDBCIntegrationV2Suite`.

### Why are the changes needed?
#46588
Given PR was merged to master/3.5/3.4. This PR broke daily jobs for `OracleIntegrationSuite`. Upon inspection, it was noted that 3.4 and 3.5 are run with JDK8 while master is run with JDK21 and stripMargin was behaving differently in those cases. Upon removing stripMargin and spliting `INSERT INTO` statements into multiple lines, all integration tests have passed.

### Does this PR introduce _any_ user-facing change?
No, only loading of the test data was changed to follow language requirements.

### How was this patch tested?
Existing suite was aborted in the job and now it is running.

### Was this patch authored or co-authored using generative AI tooling?
No

Closes #46806

Closes #46807 from mihailom-db/FixOracleMaster.

Authored-by: Mihailo Milosevic <[email protected]>
Signed-off-by: Kent Yao <[email protected]>
(cherry picked from commit 4360ec7)
Signed-off-by: Kent Yao <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants