Repository: spark
Updated Branches:
  refs/heads/master 0c0e09f56 -> bc3b6cb06


[SPARK-3858][SQL] Pass the generator alias into logical plan node

The alias parameter is being ignored, which makes it more difficult to specify 
a qualifier for Generator expressions.

Author: Nathan Howell <[email protected]>

Closes #2721 from NathanHowell/SPARK-3858 and squashes the following commits:

8aa0f43 [Nathan Howell] [SPARK-3858][SQL] Pass the generator alias into logical 
plan node


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/bc3b6cb0
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/bc3b6cb0
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/bc3b6cb0

Branch: refs/heads/master
Commit: bc3b6cb06153d6b05f311dd78459768b6cf6a404
Parents: 0c0e09f
Author: Nathan Howell <[email protected]>
Authored: Thu Oct 9 15:03:01 2014 -0700
Committer: Michael Armbrust <[email protected]>
Committed: Thu Oct 9 15:03:01 2014 -0700

----------------------------------------------------------------------
 sql/core/src/main/scala/org/apache/spark/sql/SchemaRDD.scala | 2 +-
 .../src/test/scala/org/apache/spark/sql/DslQuerySuite.scala  | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/bc3b6cb0/sql/core/src/main/scala/org/apache/spark/sql/SchemaRDD.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/SchemaRDD.scala 
b/sql/core/src/main/scala/org/apache/spark/sql/SchemaRDD.scala
index 594bf8f..948122d 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/SchemaRDD.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/SchemaRDD.scala
@@ -360,7 +360,7 @@ class SchemaRDD(
       join: Boolean = false,
       outer: Boolean = false,
       alias: Option[String] = None) =
-    new SchemaRDD(sqlContext, Generate(generator, join, outer, None, 
logicalPlan))
+    new SchemaRDD(sqlContext, Generate(generator, join, outer, alias, 
logicalPlan))
 
   /**
    * Returns this RDD as a SchemaRDD.  Intended primarily to force the 
invocation of the implicit

http://git-wip-us.apache.org/repos/asf/spark/blob/bc3b6cb0/sql/core/src/test/scala/org/apache/spark/sql/DslQuerySuite.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/DslQuerySuite.scala 
b/sql/core/src/test/scala/org/apache/spark/sql/DslQuerySuite.scala
index d001abb..45e58af 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/DslQuerySuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/DslQuerySuite.scala
@@ -147,6 +147,14 @@ class DslQuerySuite extends QueryTest {
       (1, 1, 1, 2) :: Nil)
   }
 
+  test("SPARK-3858 generator qualifiers are discarded") {
+    checkAnswer(
+      arrayData.as('ad)
+        .generate(Explode("data" :: Nil, 'data), alias = Some("ex"))
+        .select("ex.data".attr),
+      Seq(1, 2, 3, 2, 3, 4).map(Seq(_)))
+  }
+
   test("average") {
     checkAnswer(
       testData2.groupBy()(avg('a)),


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

Reply via email to