-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-16995][SQL] TreeNodeException when flat mapping RelationalGroupedDataset created from DataFrame containing a column created with lit/expr #14648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -727,6 +727,13 @@ object FoldablePropagation extends Rule[LogicalPlan] { | |
| case j @ Join(_, _, LeftOuter | RightOuter | FullOuter, _) => | ||
| stop = true | ||
| j | ||
|
|
||
| // Operators that operate on objects should only have expressions from encoders, which | ||
| // should never have foldable expressions. | ||
| case o: ObjectConsumer => o | ||
|
||
| case o: ObjectProducer => o | ||
| case a: AppendColumns => a | ||
|
|
||
| case p: LogicalPlan if !stop => p.transformExpressions { | ||
| case a: AttributeReference if foldableMap.contains(a) => | ||
| foldableMap(a) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -878,6 +878,21 @@ class DatasetSuite extends QueryTest with SharedSQLContext { | |
| val ds = spark.createDataset(data)(enc) | ||
| checkDataset(ds, (("a", "b"), "c"), (null, "d")) | ||
| } | ||
|
|
||
| test("SPARK-16995: flat mapping on Dataset containing a column created with lit/expr") { | ||
| val df = Seq("1").toDF("a") | ||
|
|
||
| import df.sparkSession.implicits._ | ||
|
|
||
| assertResult(Seq()) { | ||
|
||
| df.withColumn("b", lit(0)).as[ClassData] | ||
| .groupByKey(_.a).flatMapGroups { case (x, iter) => List[Int]() }.collect().toSeq | ||
| } | ||
| assertResult(Seq()) { | ||
| df.withColumn("b", expr("0")).as[ClassData] | ||
| .groupByKey(_.a).flatMapGroups { case (x, iter) => List[Int]() }.collect().toSeq | ||
| } | ||
| } | ||
| } | ||
|
|
||
| case class Generic[T](id: T, value: Double) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.