Uh oh!
There was an error while loading. Please reload this page.
[SPARK-18141][SQL] Fix to quote column names in the predicate clause of the JDBC RDD generated sql statement - #15662
Conversation
SparkQA
commented
Oct 27, 2016
Test build #67662 has finished for PR 15662 at commit
|
sureshthalamati
commented
Oct 27, 2016
Test failed is org.apache.spark.sql.streaming.StreamingQuerySuite, unrelated to this change. Might have been fixed in commit 79fd0cc |
sureshthalamati
commented
Oct 27, 2016
retest this please |
SparkQA
commented
Oct 27, 2016
Test build #67669 has finished for PR 15662 at commit
|
sureshthalamati
commented
Nov 1, 2016
There was a problem hiding this comment.
Add a nested function in compileFilter
defquote(colName: String):String= dialect.quoteIdentifier(colName)Then, your code changes can look cleaner.
0944e05 to
2afe990Comparesureshthalamati
commented
Nov 3, 2016
Thank you very much for the feed back @gatorsmile . Addressed the review comments. |
There was a problem hiding this comment.
What is the purpose of the above two statements?
There was a problem hiding this comment.
Those two statements test String StartsWith , and Contains filters. They are pushed to jdbc data source, and mapped to SQL LIKE expression.
I will fix the inconsistent column name in above two statements.
gatorsmile
commented
Nov 3, 2016
This sounds a right and critical fix to me; otherwise we are unable to resolve the columns of predicates in the case sensitive JDBC sources. @sureshthalamati Could you post the following exception in your PR description? cc @srowen Could you please check it? Any comment? Thanks! |
SparkQA
commented
Nov 3, 2016
Test build #68044 has finished for PR 15662 at commit
|
sureshthalamati
commented
Nov 3, 2016
Thank you for reviewing, @gatorsmile . Updated the PR description , and addressed all the review comments. |
SparkQA
commented
Nov 3, 2016
Test build #68056 has finished for PR 15662 at commit
|
sureshthalamati
commented
Nov 10, 2016
@gatorsmile I addressed all the review comments , can you please take a look. |
gatorsmile
commented
Nov 11, 2016
@srowen Any comment on this? |
There was a problem hiding this comment.
This is an unnecessary change, right?
gatorsmile
commented
Nov 26, 2016
@sureshthalamati Could you resolve the conflict? Thanks! |
…of the JDBC RDD generated sql statement
4e22e3c to
2178e3fCompareSparkQA
commented
Nov 29, 2016
Test build #69269 has finished for PR 15662 at commit
|
sureshthalamati
commented
Nov 29, 2016
Thanks, @gatorsmile . Resolved the conflicts, and also added test case for empty in clause with mixed case column name. |
| assert(sql("SELECT * FROM mixedCaseCols WHERE Name IS NULL").collect().size == 1) | ||
| assert(sql("SELECT * FROM mixedCaseCols WHERE Name IS NOT NULL").collect().size == 2) | ||
| assert(sql("SELECT * FROM mixedCaseCols") | ||
| .filter($"Name".isin(Array[String]() : _*)).collect().size == 0) |
There was a problem hiding this comment.
.filter($"Name".isin(Array[String]() :_*)).collect().size ==0)->
.filter($"Name".isin()).collect().size ==0)gatorsmile
commented
Nov 30, 2016
LGTM except a minor comment cc @cloud-fan |
SparkQA
commented
Nov 30, 2016
Test build #69427 has finished for PR 15662 at commit
|
gatorsmile
commented
Nov 30, 2016
retest this please |
SparkQA
commented
Dec 1, 2016
Test build #69434 has finished for PR 15662 at commit
|
cloud-fan
commented
Dec 2, 2016
LGTM |
…of the JDBC RDD generated sql statement
## What changes were proposed in this pull request?
SQL query generated for the JDBC data source is not quoting columns in the predicate clause. When the source table has quoted column names, spark jdbc read fails with column not found error incorrectly.
Error:
org.h2.jdbc.JdbcSQLException: Column "ID" not found;
Source SQL statement:
SELECT "Name","Id" FROM TEST."mixedCaseCols" WHERE (Id < 1)
This PR fixes by quoting column names in the generated SQL for predicate clause when filters are pushed down to the data source.
Source SQL statement after the fix:
SELECT "Name","Id" FROM TEST."mixedCaseCols" WHERE ("Id" < 1)
## How was this patch tested?
Added new test case to the JdbcSuite
Author: sureshthalamati <suresh.thalamati@gmail.com>
Closes#15662 from sureshthalamati/filter_quoted_cols-SPARK-18141.
(cherry picked from commit 70c5549)
Signed-off-by: gatorsmile <gatorsmile@gmail.com>gatorsmile
commented
Dec 2, 2016
Merging to master/2.1! Thanks! |
…of the JDBC RDD generated sql statement
## What changes were proposed in this pull request?
SQL query generated for the JDBC data source is not quoting columns in the predicate clause. When the source table has quoted column names, spark jdbc read fails with column not found error incorrectly.
Error:
org.h2.jdbc.JdbcSQLException: Column "ID" not found;
Source SQL statement:
SELECT "Name","Id" FROM TEST."mixedCaseCols" WHERE (Id < 1)
This PR fixes by quoting column names in the generated SQL for predicate clause when filters are pushed down to the data source.
Source SQL statement after the fix:
SELECT "Name","Id" FROM TEST."mixedCaseCols" WHERE ("Id" < 1)
## How was this patch tested?
Added new test case to the JdbcSuite
Author: sureshthalamati <suresh.thalamati@gmail.com>
Closesapache#15662 from sureshthalamati/filter_quoted_cols-SPARK-18141.sureshthalamati
commented
Dec 3, 2016
Thank you , @gatorsmile@cloud-fan |
…of the JDBC RDD generated sql statement
## What changes were proposed in this pull request?
SQL query generated for the JDBC data source is not quoting columns in the predicate clause. When the source table has quoted column names, spark jdbc read fails with column not found error incorrectly.
Error:
org.h2.jdbc.JdbcSQLException: Column "ID" not found;
Source SQL statement:
SELECT "Name","Id" FROM TEST."mixedCaseCols" WHERE (Id < 1)
This PR fixes by quoting column names in the generated SQL for predicate clause when filters are pushed down to the data source.
Source SQL statement after the fix:
SELECT "Name","Id" FROM TEST."mixedCaseCols" WHERE ("Id" < 1)
## How was this patch tested?
Added new test case to the JdbcSuite
Author: sureshthalamati <suresh.thalamati@gmail.com>
Closesapache#15662 from sureshthalamati/filter_quoted_cols-SPARK-18141.…of the JDBC RDD generated sql statement
## What changes were proposed in this pull request?
SQL query generated for the JDBC data source is not quoting columns in the predicate clause. When the source table has quoted column names, spark jdbc read fails with column not found error incorrectly.
Error:
org.h2.jdbc.JdbcSQLException: Column "ID" not found;
Source SQL statement:
SELECT "Name","Id" FROM TEST."mixedCaseCols" WHERE (Id < 1)
This PR fixes by quoting column names in the generated SQL for predicate clause when filters are pushed down to the data source.
Source SQL statement after the fix:
SELECT "Name","Id" FROM TEST."mixedCaseCols" WHERE ("Id" < 1)
## How was this patch tested?
Added new test case to the JdbcSuite
Author: sureshthalamati <suresh.thalamati@gmail.com>
Closesapache#15662 from sureshthalamati/filter_quoted_cols-SPARK-18141.
What changes were proposed in this pull request?
SQL query generated for the JDBC data source is not quoting columns in the predicate clause. When the source table has quoted column names, spark jdbc read fails with column not found error incorrectly.
Error:
org.h2.jdbc.JdbcSQLException: Column "ID" not found;
Source SQL statement:
SELECT "Name","Id" FROM TEST."mixedCaseCols" WHERE (Id < 1)
This PR fixes by quoting column names in the generated SQL for predicate clause when filters are pushed down to the data source.
Source SQL statement after the fix:
SELECT "Name","Id" FROM TEST."mixedCaseCols" WHERE ("Id" < 1)
How was this patch tested?
Added new test case to the JdbcSuite