You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by dilipbiswal <gi...@git.apache.org> on 2016/03/09 03:20:00 UTC

[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

GitHub user dilipbiswal opened a pull request:

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

    [SPARK-12719][SQL] [WIP] SQL generation support for generators, including UDTF

    ## What changes were proposed in this pull request?
    This is a alternate way to convert SQL from analyzed logical plans containing Generate operator.
    In this PR , generators in projection list are expressed as LATERAL VIEW.
    
    Sample Plan :
    ```
    GlobalLimit 3
    +- LocalLimit 3
       +- Project [gencol2#204]
          +- Generate explode(gencol1#203), true, false, Some(gentab2), [gencol2#204]
             +- Generate explode(array(array(1, 2, 3))), true, false, Some(gentab1), [gencol1#203]
                +- MetastoreRelation default, t4, None
    ```
    Generated Query:
    
    ```
    SELECT `gentab2`.`gencol2` FROM `default`.`t4` LATERAL VIEW explode(array(array(1, 2, 3))) `gentab1` AS `gencol1` LATERAL VIEW explode(`gentab1`.`gencol1`) `gentab2` AS `gencol2` LIMIT 3
    ```
    
    
    ## How was this patch tested?
    
    Tests added to LogicalPlanToSQLSuite
    
    (If this patch involves UI changes, please attach a screenshot; otherwise, remove this)
    


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

    $ git pull https://github.com/dilipbiswal/spark SPARK-12719-2

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

    https://github.com/apache/spark/pull/11596.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 #11596
    
----
commit fe8b0642994fd976681d7e675712738bb6f7076b
Author: Dilip Biswal <db...@us.ibm.com>
Date:   2016-03-05T09:49:58Z

    [SPARK-13698] Fix Analysis Exceptions when Using Backticks in Generate

commit 1e9b683febba74192d5a882bcd38d0a47dd630bf
Author: Dilip Biswal <db...@us.ibm.com>
Date:   2016-03-07T07:42:00Z

    [SPARK-12719] SQL generation support for generators (including UDTF)

commit 865f5a5afaaff2c1eb101630328c362dc63e0ddf
Author: Dilip Biswal <db...@us.ibm.com>
Date:   2016-03-07T21:28:48Z

    Code review comments

commit c037d8ccc008bcba518a4be62da385d1fd037756
Author: Dilip Biswal <db...@us.ibm.com>
Date:   2016-03-08T02:36:21Z

    Review comments from Reynold

commit e10883a720c7e10d5a5294093c473ff6ff358d0c
Author: Dilip Biswal <db...@us.ibm.com>
Date:   2016-03-08T07:35:46Z

    Alternative approach.

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-196313956
  
    Hi @dilipbiswal , sorry that recently I made a major refactor to `SQLBuilder`, and it changed some assumptions to the `Generate` SQL generation, so I took over your PR and send a new one with some simplification: #11696, do you mind taking a look?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-195466246
  
    **[Test build #52930 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/52930/consoleFull)** for PR 11596 at commit [`bea871f`](https://github.com/apache/spark/commit/bea871f6b43de7ffcb6c58089521401ca39a7145).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-195496238
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/52930/
    Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-194074398
  
    Can one of the admins verify this patch?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-195250469
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/52915/
    Test FAILed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11596#discussion_r55471184
  
    --- Diff: sql/hive/src/test/scala/org/apache/spark/sql/hive/LogicalPlanToSQLSuite.scala ---
    @@ -445,4 +461,98 @@ class LogicalPlanToSQLSuite extends SQLBuilderTest with SQLTestUtils {
           "f1", "b[0].f1", "f1", "c[foo]", "d[0]"
         )
       }
    +
    +  test("SQL generator for explode in projection list") {
    +    // Basic Explode
    +    checkHiveQl("SELECT explode(array(1,2,3)) FROM src")
    +
    +    // Explode with Alias
    +    checkHiveQl("SELECT explode(array(1,2,3)) as value FROM src")
    +
    +    // Explode without FROM
    +    checkHiveQl("select explode(array(1,2,3)) AS gencol")
    +
    +    // non-generated columns in projection list
    +    checkHiveQl("SELECT key as c1, explode(array(1,2,3)) as c2, value as c3 FROM t1")
    +  }
    +
    +  test("SQL generation for json_tuple as generator") {
    +    checkHiveQl("SELECT key, json_tuple(jstring, 'f1', 'f2', 'f3', 'f4', 'f5') FROM parquet_t3")
    +  }
    +
    +  test("SQL generation for lateral views") {
    +    // Filter and OUTER clause
    +    checkHiveQl(
    +      """
    +        |SELECT key, value
    +        |FROM t1
    +        |LATERAL VIEW OUTER explode(value) gentab as gencol
    +        |WHERE key = 1
    +      """.stripMargin
    +    )
    +
    +    // single lateral view
    +    checkHiveQl(
    +      """
    +        |SELECT *
    +        |FROM t1
    +        |LATERAL VIEW explode(array(1,2,3)) gentab AS gencol
    +        |SORT BY key ASC, gencol ASC LIMIT 1
    +      """.stripMargin
    +    )
    +
    +    // multiple lateral views
    +    checkHiveQl(
    +      """
    +        |SELECT gentab2.*
    +        |FROM t1
    +        |LATERAL VIEW explode(array(array(1,2,3))) gentab1 AS gencol1
    +        |LATERAL VIEW explode(gentab1.gencol1) gentab2 AS gencol2 LIMIT 3
    +      """.stripMargin
    +    )
    +
    +    // No generated column aliases
    +    checkHiveQl(
    +      """SELECT gentab.*
    +        |FROM t1
    +        |LATERAL VIEW explode(map('key1', 100, 'key2', 200)) gentab limit 2
    +      """.stripMargin
    +    )
    +  }
    +
    +  test("SQL generation for lateral views in subquery") {
    +    // Subquries in FROM clause using Generate
    +    checkHiveQl(
    +      """
    +        |SELECT subq.gencol
    +        |FROM
    +        |(SELECT * from t1 LATERAL VIEW explode(value) gentab AS gencol) subq
    +      """.stripMargin)
    +
    +    checkHiveQl(
    +      """
    +        |SELECT subq.key
    +        |FROM
    +        |(SELECT key, value from t1 LATERAL VIEW explode(value) gentab AS gencol) subq
    +      """.stripMargin
    +    )
    +  }
    +
    +  test("SQL generation for UDTF") {
    --- End diff --
    
    Please add more UDTF cases, as what @cloud-fan suggested.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by dilipbiswal <gi...@git.apache.org>.
Github user dilipbiswal commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-194130778
  
    @cloud-fan Thank you.
    1. Can any Generate operator be converted to a LATERAL VIEW? Does the plan tree have to match some kind of pattern?
    
    Yes, based on the tests i have tried. I am testing this more to see if i uncover any issue. Now i am converting
    ```SQL
    select explode(array(1,2,3)) from t1
    ``` 
    to
    ```SQL
    select tablequalifier.colname from t1 LATERAL VIEW explode(array(1,2,3)) tablequalifier as colname
    ``` 
    2. Can any Generate operator be converted to a "SELECT ...udtf..." format?
    
    No. As we have a restriction of allowing one generate in a projection list. Thats why we try to
    use the LATERAL VIEW clause.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-195495907
  
    **[Test build #52930 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/52930/consoleFull)** for PR 11596 at commit [`bea871f`](https://github.com/apache/spark/commit/bea871f6b43de7ffcb6c58089521401ca39a7145).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-195248289
  
    **[Test build #52915 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/52915/consoleFull)** for PR 11596 at commit [`bea871f`](https://github.com/apache/spark/commit/bea871f6b43de7ffcb6c58089521401ca39a7145).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-194153084
  
    Merged build finished. Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by dilipbiswal <gi...@git.apache.org>.
Github user dilipbiswal commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11596#discussion_r55791864
  
    --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/SQLBuilder.scala ---
    @@ -94,6 +94,12 @@ class SQLBuilder(logicalPlan: LogicalPlan, sqlContext: SQLContext) extends Loggi
         case Distinct(p: Project) =>
           projectToSQL(p, isDistinct = true)
     
    +    case p@ Project(_, g: Generate) =>
    +      generateToSQL(p)
    +
    +    case g: Generate =>
    --- End diff --
    
    @cloud-fan Sorry Wenchen for getting back to you a bit late. Actually the two cases do different things. First one builds the top level SELECT clause and the second one builds the LATERAL VIEW clause. Do you have any suggestion for a better name for these two functions ? :-)


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-194152170
  
    I'm not sure which one is better, it depends on which one is easier to understand and implement. I'm ok to generate verbose SQL string, but the generator itself should be as simple and robust as possible.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-194098012
  
    **[Test build #52719 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/52719/consoleFull)** for PR 11596 at commit [`e10883a`](https://github.com/apache/spark/commit/e10883a720c7e10d5a5294093c473ff6ff358d0c).
     * This patch **fails Scala style tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-194133518
  
    But a `Generate` operator only has one `generator`, so I think we can convert any kind of `Generate` to SELECT?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by dilipbiswal <gi...@git.apache.org>.
Github user dilipbiswal commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11596#discussion_r55484267
  
    --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/SQLBuilder.scala ---
    @@ -297,6 +303,65 @@ class SQLBuilder(logicalPlan: LogicalPlan, sqlContext: SQLContext) extends Loggi
         )
       }
     
    +  /* This function handles the SQL generation when generators.
    +   * sample plan :
    +   *   +- Project [mycol2#192]
    +   *     +- Generate explode(myCol#191), true, false, Some(mytable2), [mycol2#192]
    +   *       +- Generate explode(array(array(1, 2, 3))), true, false, Some(mytable), [mycol#191]
    +   *         +- MetastoreRelation default, src, None
    +   *
    +   */
    +  private def generateToSQL(plan: Generate): String = {
    +    val columnAliases = plan.generatorOutput.map(a => quoteIdentifier(a.name)).mkString(",")
    --- End diff --
    
    Sure. Thx


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by dilipbiswal <gi...@git.apache.org>.
Github user dilipbiswal closed the pull request at:

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


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-195463951
  
    retest this please


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by dilipbiswal <gi...@git.apache.org>.
Github user dilipbiswal commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11596#discussion_r55475944
  
    --- Diff: sql/hive/src/test/scala/org/apache/spark/sql/hive/LogicalPlanToSQLSuite.scala ---
    @@ -445,4 +461,98 @@ class LogicalPlanToSQLSuite extends SQLBuilderTest with SQLTestUtils {
           "f1", "b[0].f1", "f1", "c[foo]", "d[0]"
         )
       }
    +
    +  test("SQL generator for explode in projection list") {
    +    // Basic Explode
    +    checkHiveQl("SELECT explode(array(1,2,3)) FROM src")
    +
    +    // Explode with Alias
    +    checkHiveQl("SELECT explode(array(1,2,3)) as value FROM src")
    +
    +    // Explode without FROM
    +    checkHiveQl("select explode(array(1,2,3)) AS gencol")
    +
    +    // non-generated columns in projection list
    +    checkHiveQl("SELECT key as c1, explode(array(1,2,3)) as c2, value as c3 FROM t1")
    +  }
    +
    +  test("SQL generation for json_tuple as generator") {
    +    checkHiveQl("SELECT key, json_tuple(jstring, 'f1', 'f2', 'f3', 'f4', 'f5') FROM parquet_t3")
    +  }
    +
    +  test("SQL generation for lateral views") {
    --- End diff --
    
    OK.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11596#discussion_r55470961
  
    --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/SQLBuilder.scala ---
    @@ -94,6 +94,12 @@ class SQLBuilder(logicalPlan: LogicalPlan, sqlContext: SQLContext) extends Loggi
         case Distinct(p: Project) =>
           projectToSQL(p, isDistinct = true)
     
    +    case p@ Project(_, g: Generate) =>
    --- End diff --
    
    Nit: added a space after `p`


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11596#discussion_r55471043
  
    --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/SQLBuilder.scala ---
    @@ -297,6 +303,60 @@ class SQLBuilder(logicalPlan: LogicalPlan, sqlContext: SQLContext) extends Loggi
         )
       }
     
    +  /* This function handles the SQL generation when generators.
    --- End diff --
    
    style issue: please use `/**` 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11596#discussion_r55471264
  
    --- Diff: sql/hive/src/test/scala/org/apache/spark/sql/hive/LogicalPlanToSQLSuite.scala ---
    @@ -445,4 +461,98 @@ class LogicalPlanToSQLSuite extends SQLBuilderTest with SQLTestUtils {
           "f1", "b[0].f1", "f1", "c[foo]", "d[0]"
         )
       }
    +
    +  test("SQL generator for explode in projection list") {
    +    // Basic Explode
    +    checkHiveQl("SELECT explode(array(1,2,3)) FROM src")
    +
    +    // Explode with Alias
    +    checkHiveQl("SELECT explode(array(1,2,3)) as value FROM src")
    +
    +    // Explode without FROM
    +    checkHiveQl("select explode(array(1,2,3)) AS gencol")
    +
    +    // non-generated columns in projection list
    +    checkHiveQl("SELECT key as c1, explode(array(1,2,3)) as c2, value as c3 FROM t1")
    +  }
    +
    +  test("SQL generation for json_tuple as generator") {
    +    checkHiveQl("SELECT key, json_tuple(jstring, 'f1', 'f2', 'f3', 'f4', 'f5') FROM parquet_t3")
    +  }
    +
    +  test("SQL generation for lateral views") {
    --- End diff --
    
    Please add another test case for joining the lateral view with a regular table. Thanks! 
    
    ```LATERAL VIEW ......,  t1 as table1```  


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by dilipbiswal <gi...@git.apache.org>.
Github user dilipbiswal commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11596#discussion_r55475915
  
    --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/SQLBuilder.scala ---
    @@ -94,6 +94,12 @@ class SQLBuilder(logicalPlan: LogicalPlan, sqlContext: SQLContext) extends Loggi
         case Distinct(p: Project) =>
           projectToSQL(p, isDistinct = true)
     
    +    case p@ Project(_, g: Generate) =>
    --- End diff --
    
    Will do. Thanks.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-194098015
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/52719/
    Test FAILed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by dilipbiswal <gi...@git.apache.org>.
Github user dilipbiswal commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-194139575
  
    @cloud-fan Yeah.. that should be possible, You are thinking to represent each Generate as a sub select clause ?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-194153085
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/52725/
    Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-194173318
  
    ah makes sense, then we should always generate a LATERAL VIEW format SQL.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11596#discussion_r55470832
  
    --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/SQLBuilder.scala ---
    @@ -297,6 +303,60 @@ class SQLBuilder(logicalPlan: LogicalPlan, sqlContext: SQLContext) extends Loggi
         )
       }
     
    +  /* This function handles the SQL generation when generators.
    +   * sample plan :
    +   *   +- Project [mycol2#192]
    +   *     +- Generate explode(myCol#191), true, false, Some(mytable2), [mycol2#192]
    +   *       +- Generate explode(array(array(1, 2, 3))), true, false, Some(mytable), [mycol#191]
    +   *         +- MetastoreRelation default, src, None
    +   *
    +   */
    +  private def generateToSQL(plan: Generate): String = {
    +    val columnAliases = plan.generatorOutput.map(a => quoteIdentifier(a.name)).mkString(",")
    +    val generatorAlias = if (plan.qualifier.isEmpty) "" else plan.qualifier.get
    +    val outerClause = if (plan.outer) "OUTER" else ""
    +    build(
    +      if (plan.child == OneRowRelation) s"(SELECT 1) ${SQLBuilder.newSubqueryName}" else toSQL(plan.child),
    +      "LATERAL VIEW",
    +      outerClause,
    +      plan.generator.sql,
    +      quoteIdentifier(generatorAlias),
    +      "AS",
    +      columnAliases
    +    )
    +  }
    +
    +  private def generateToSQL(plan: Project): String = {
    +    // assert if child is a generate or not.
    --- End diff --
    
    Please add an assert here. 
    ```
    assert(join == true || plan.projectList == 1)
    ```


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-194106587
  
    hi @dilipbiswal , thanks for working on this!  Some high-level questions:
    
    1. Can any `Generate` operator  be converted to a LATERAL VIEW? Does the plan tree have to match some kind of pattern?
    2. Can any `Generate` operator  be converted to a "SELECT ...udtf..." format?
    
    Generally speaking, we should use one unified format for `Generator`'s SQL string if possible, whatever the original SQL string is.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-195250446
  
    **[Test build #52915 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/52915/consoleFull)** for PR 11596 at commit [`bea871f`](https://github.com/apache/spark/commit/bea871f6b43de7ffcb6c58089521401ca39a7145).
     * This patch **fails to build**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by dilipbiswal <gi...@git.apache.org>.
Github user dilipbiswal commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-194167614
  
    @cloud-fan Thanks !! Actually i remember exploring this option. There is a generate syntax for outer lateral view like following -
    ```SQL
    SELECT * FROM src LATERAL VIEW OUTER explode(array()) C AS a limit 10;
    ```
    I thought if we converted this generate operator as  a sub select where the generator is in projection 
    list , we will loose the outer semantics. Thats why i felt safer to generate as a LATERAL VIEW
    clause.



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11596#discussion_r55492401
  
    --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/SQLBuilder.scala ---
    @@ -94,6 +94,12 @@ class SQLBuilder(logicalPlan: LogicalPlan, sqlContext: SQLContext) extends Loggi
         case Distinct(p: Project) =>
           projectToSQL(p, isDistinct = true)
     
    +    case p@ Project(_, g: Generate) =>
    +      generateToSQL(p)
    +
    +    case g: Generate =>
    --- End diff --
    
    not quite sure, but can we convert this to `Project(g.outpur, g)` and share the same code path with the above case?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by dilipbiswal <gi...@git.apache.org>.
Github user dilipbiswal commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11596#discussion_r55475917
  
    --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/SQLBuilder.scala ---
    @@ -297,6 +303,60 @@ class SQLBuilder(logicalPlan: LogicalPlan, sqlContext: SQLContext) extends Loggi
         )
       }
     
    +  /* This function handles the SQL generation when generators.
    --- End diff --
    
    Will do. Thanks.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-194097849
  
    **[Test build #52719 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/52719/consoleFull)** for PR 11596 at commit [`e10883a`](https://github.com/apache/spark/commit/e10883a720c7e10d5a5294093c473ff6ff358d0c).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by dilipbiswal <gi...@git.apache.org>.
Github user dilipbiswal commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11596#discussion_r55475930
  
    --- Diff: sql/hive/src/test/scala/org/apache/spark/sql/hive/LogicalPlanToSQLSuite.scala ---
    @@ -445,4 +461,98 @@ class LogicalPlanToSQLSuite extends SQLBuilderTest with SQLTestUtils {
           "f1", "b[0].f1", "f1", "c[foo]", "d[0]"
         )
       }
    +
    +  test("SQL generator for explode in projection list") {
    +    // Basic Explode
    +    checkHiveQl("SELECT explode(array(1,2,3)) FROM src")
    +
    +    // Explode with Alias
    +    checkHiveQl("SELECT explode(array(1,2,3)) as value FROM src")
    +
    +    // Explode without FROM
    +    checkHiveQl("select explode(array(1,2,3)) AS gencol")
    +
    +    // non-generated columns in projection list
    +    checkHiveQl("SELECT key as c1, explode(array(1,2,3)) as c2, value as c3 FROM t1")
    +  }
    +
    +  test("SQL generation for json_tuple as generator") {
    +    checkHiveQl("SELECT key, json_tuple(jstring, 'f1', 'f2', 'f3', 'f4', 'f5') FROM parquet_t3")
    +  }
    +
    +  test("SQL generation for lateral views") {
    +    // Filter and OUTER clause
    +    checkHiveQl(
    +      """
    +        |SELECT key, value
    +        |FROM t1
    +        |LATERAL VIEW OUTER explode(value) gentab as gencol
    +        |WHERE key = 1
    +      """.stripMargin
    +    )
    +
    +    // single lateral view
    +    checkHiveQl(
    +      """
    +        |SELECT *
    +        |FROM t1
    +        |LATERAL VIEW explode(array(1,2,3)) gentab AS gencol
    +        |SORT BY key ASC, gencol ASC LIMIT 1
    +      """.stripMargin
    +    )
    +
    +    // multiple lateral views
    +    checkHiveQl(
    +      """
    +        |SELECT gentab2.*
    +        |FROM t1
    +        |LATERAL VIEW explode(array(array(1,2,3))) gentab1 AS gencol1
    +        |LATERAL VIEW explode(gentab1.gencol1) gentab2 AS gencol2 LIMIT 3
    +      """.stripMargin
    +    )
    +
    +    // No generated column aliases
    +    checkHiveQl(
    +      """SELECT gentab.*
    +        |FROM t1
    +        |LATERAL VIEW explode(map('key1', 100, 'key2', 200)) gentab limit 2
    +      """.stripMargin
    +    )
    +  }
    +
    +  test("SQL generation for lateral views in subquery") {
    +    // Subquries in FROM clause using Generate
    +    checkHiveQl(
    +      """
    +        |SELECT subq.gencol
    +        |FROM
    +        |(SELECT * from t1 LATERAL VIEW explode(value) gentab AS gencol) subq
    +      """.stripMargin)
    +
    +    checkHiveQl(
    +      """
    +        |SELECT subq.key
    +        |FROM
    +        |(SELECT key, value from t1 LATERAL VIEW explode(value) gentab AS gencol) subq
    +      """.stripMargin
    +    )
    +  }
    +
    +  test("SQL generation for UDTF") {
    --- End diff --
    
    OK. 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-194109656
  
    LGTM


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-194152932
  
    **[Test build #52725 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/52725/consoleFull)** for PR 11596 at commit [`d7f0207`](https://github.com/apache/spark/commit/d7f020701b3b063beb00293af3ff4149211926ab).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-195496237
  
    Merged build finished. Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11596#discussion_r55483740
  
    --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/SQLBuilder.scala ---
    @@ -297,6 +303,65 @@ class SQLBuilder(logicalPlan: LogicalPlan, sqlContext: SQLContext) extends Loggi
         )
       }
     
    +  /* This function handles the SQL generation when generators.
    +   * sample plan :
    +   *   +- Project [mycol2#192]
    +   *     +- Generate explode(myCol#191), true, false, Some(mytable2), [mycol2#192]
    +   *       +- Generate explode(array(array(1, 2, 3))), true, false, Some(mytable), [mycol#191]
    +   *         +- MetastoreRelation default, src, None
    +   *
    +   */
    +  private def generateToSQL(plan: Generate): String = {
    +    val columnAliases = plan.generatorOutput.map(a => quoteIdentifier(a.name)).mkString(",")
    --- End diff --
    
    you can just do `plan.generatorOutput.map(_.sql).mkString(", ")`


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by dilipbiswal <gi...@git.apache.org>.
Github user dilipbiswal commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-194074582
  
    @rxin @cloud-fan @liancheng @gatorsmile  Hi Reynold and Wenchen, 
    I have made change to generate LATERAL view for all generators specified in projection list as well as in from clause. I am still testing it and adding more tests. Please let me know what you think..


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-194097163
  
    ok to test


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-194126735
  
    **[Test build #52725 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/52725/consoleFull)** for PR 11596 at commit [`d7f0207`](https://github.com/apache/spark/commit/d7f020701b3b063beb00293af3ff4149211926ab).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-194098014
  
    Merged build finished. Test FAILed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-195250466
  
    Merged build finished. Test FAILed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by dilipbiswal <gi...@git.apache.org>.
Github user dilipbiswal commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-196557733
  
    Closing this in favor of 
    [#11696] (http://github.com/apache/spark/pull/11696)


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12719][SQL] [WIP] SQL generation suppor...

Posted by dilipbiswal <gi...@git.apache.org>.
Github user dilipbiswal commented on the pull request:

    https://github.com/apache/spark/pull/11596#issuecomment-195435909
  
    @cloud-fan Can you please help trigger a retest ? This does not seem related to my changes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org