-
Notifications
You must be signed in to change notification settings - Fork 28.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-13535] [SQL] Fix Analysis Exceptions when Using Backticks in Transform Clause #11415
Conversation
@hvanhovell @viirya Could you review the changes? Thanks! |
I don't get it. Is the pull request about supporting backticks? Or change something to use backticks? |
Before the PR fix, if we use backticks in Script Transform Outputs, Analyzer is unable to correctly process it. The root cause is from In this example, before the PR fix, we do not clean backticks. The name of
The error message is pretty confusing. This message is issued from a.failAnalysis(s"cannot resolve '${a.sql}' given input columns: [$from]") The backstick in the first ' |
This PR is to make it works. FROM
(FROM test SELECT TRANSFORM(key, value) USING 'cat' AS (`thing1` int, thing2 string)) t
SELECT thing1 + 1 The issue was exposed when we generate SQL from the plan containing |
Test build #52135 has finished for PR 11415 at commit
|
Can you update the title? The current title is fairly confusing, and I'm not sure if it accurately captures what you are fixing. |
Sure, let me do it. |
retest this please |
Test build #52136 has finished for PR 11415 at commit
|
retest this please |
Test build #52138 has finished for PR 11415 at commit
|
retest this please |
@gatorsmile the failed test is not related to this, I have sumbitted a pr to fix it. Before it is merged, the test you ask to retest will be failed very frequently. |
yeah, but this PR is so unlucky. 100% failure : ) |
Test build #52169 has finished for PR 11415 at commit
|
@cloud-fan Could you take a look at this? Thanks! |
ping @cloud-fan : ) I think this is a simple fix. Could you review it? Another PR for converting Script Transform to SQL is waiting for this fix. Thank you! |
LGTM. cc @hvanhovell |
Thank you! @cloud-fan : ) |
LGTM |
Merging this to master. Thanks! |
…ansform Clause #### What changes were proposed in this pull request? ```SQL FROM (FROM test SELECT TRANSFORM(key, value) USING 'cat' AS (`thing1` int, thing2 string)) t SELECT thing1 + 1 ``` This query returns an analysis error, like: ``` Failed to analyze query: org.apache.spark.sql.AnalysisException: cannot resolve '`thing1`' given input columns: [`thing1`, thing2]; line 3 pos 7 'Project [unresolvedalias(('thing1 + 1), None)] +- SubqueryAlias t +- ScriptTransformation [key#2,value#3], cat, [`thing1`apache#6,thing2#7], HiveScriptIOSchema(List(),List(),Some(org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe),Some(org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe),List((field.delim, )),List((field.delim, )),Some(org.apache.hadoop.hive.ql.exec.TextRecordReader),Some(org.apache.hadoop.hive.ql.exec.TextRecordWriter),false) +- SubqueryAlias test +- Project [_1#0 AS key#2,_2#1 AS value#3] +- LocalRelation [_1#0,_2#1], [[1,1],[2,2],[3,3],[4,4],[5,5]] ``` The backpacks of \`thing1\` should be cleaned before entering Parser/Analyzer. This PR fixes this issue. #### How was this patch tested? Added a test case and modified an existing test case Author: gatorsmile <gatorsmile@gmail.com> Closes apache#11415 from gatorsmile/scriptTransform.
What changes were proposed in this pull request?
This query returns an analysis error, like:
The backpacks of
thing1
should be cleaned before entering Parser/Analyzer. This PR fixes this issue.How was this patch tested?
Added a test case and modified an existing test case