GitHub user gatorsmile opened a pull request:

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

    [SPARK-12721] [SQL] SQL Generation for Script Transformation

    #### What changes were proposed in this pull request?
    
    This PR is to convert to SQL from analyzed logical plans containing 
operator `ScriptTransformation`. 
    
    For example, below is the SQL containing `Transform`
    ```
    SELECT TRANSFORM (a, b, c, d) USING 'cat' FROM parquet_t2
    ```
    
    Its logical plan is like 
    ```
    ScriptTransformation [a#210L,b#211L,c#212L,d#213L], cat, 
[key#208,value#209], 
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),true)
    +- SubqueryAlias parquet_t2
       +- Relation[a#210L,b#211L,c#212L,d#213L] ParquetRelation
    ```
    
    The generated SQL will be like
    ```
    SELECT TRANSFORM (`parquet_t2`.`a`, `parquet_t2`.`b`, `parquet_t2`.`c`, 
`parquet_t2`.`d`) USING 'cat' AS (`key` string, `value` string) FROM 
`default`.`parquet_t2`
    ```
    ## How was this patch tested?
    
    Seven test cases are added to `LogicalPlanToSQLSuite`. 

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

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

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

    https://github.com/apache/spark/pull/11503.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 #11503
    
----
commit a39def82e2ad09c1c311e9ca062d7ac16304eee5
Author: gatorsmile <[email protected]>
Date:   2016-03-03T23:52:01Z

    SQL generation for script transformation

----


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