GitHub user gatorsmile opened a pull request:

    https://github.com/apache/spark/pull/11415

    [SPARK-13535] [SQL] Use Backtick in Script Transform Outputs

    #### 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`#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
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/gatorsmile/spark scriptTransform

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/11415.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #11415
    
----
commit d18603525e6806a4de907a13a88c5759225065e8
Author: gatorsmile <[email protected]>
Date:   2016-02-28T02:36:55Z

    use backtick in script transform outputs

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to