Skip to content
Snippets Groups Projects
Commit bc3b6cb0 authored by Nathan Howell's avatar Nathan Howell Committed by Michael Armbrust
Browse files

[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 <nhowell@godaddy.com>

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
parent 0c0e09f5
No related branches found
No related tags found
No related merge requests found
...@@ -360,7 +360,7 @@ class SchemaRDD( ...@@ -360,7 +360,7 @@ class SchemaRDD(
join: Boolean = false, join: Boolean = false,
outer: Boolean = false, outer: Boolean = false,
alias: Option[String] = None) = 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 * Returns this RDD as a SchemaRDD. Intended primarily to force the invocation of the implicit
......
...@@ -147,6 +147,14 @@ class DslQuerySuite extends QueryTest { ...@@ -147,6 +147,14 @@ class DslQuerySuite extends QueryTest {
(1, 1, 1, 2) :: Nil) (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") { test("average") {
checkAnswer( checkAnswer(
testData2.groupBy()(avg('a)), testData2.groupBy()(avg('a)),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment