-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-24781][SQL] Using a reference from Dataset in Filter/Sort might not work #21745
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
97837a4
b99d0c7
38a935d
eff3af2
6eda8d2
8432b00
860d433
a98f416
9e00db9
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 |
|---|---|---|
|
|
@@ -60,7 +60,8 @@ abstract class LogicalPlan | |
| * [[org.apache.spark.sql.catalyst.analysis.UnresolvedRelation UnresolvedRelation]] | ||
| * should return `false`). | ||
| */ | ||
| lazy val resolved: Boolean = expressions.forall(_.resolved) && childrenResolved | ||
| lazy val resolved: Boolean = expressions.forall(_.resolved) && childrenResolved && | ||
| missingInput.isEmpty | ||
|
||
|
|
||
| override protected def statePrefix = if (!resolved) "'" else super.statePrefix | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -119,4 +119,16 @@ class LogicalPlanSuite extends SparkFunSuite { | |
| OneRowRelation()) | ||
| assert(result.sameResult(expected)) | ||
| } | ||
|
|
||
| test("Logical plan with missing inputs should be unresolved") { | ||
| // Normally we won't add a missing resolved reference into a logical plan, | ||
| // but a valid query like `df.select(df("name")).filter(df("id") === 0)` can make a query | ||
| // like this. | ||
| val relation = LocalRelation(AttributeReference("a", IntegerType, nullable = true)()) | ||
| val plan = Project(Stream(AttributeReference("b", IntegerType, nullable = true)()), relation) | ||
|
||
| assert(plan.expressions.forall(_.resolved)) | ||
| assert(plan.childrenResolved) | ||
| assert(plan.missingInput.nonEmpty) | ||
| assert(!plan.resolved) | ||
| } | ||
| } | ||
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.
We should also fix in
Aggregatecase?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.
I might miss something, but how about
val missingAttrs = AttributeSet(newExprs) -- p.outputSet?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.
For
Aggregate, I've tested it. SeemsResolveAggregateFunctionsalready covers it.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.
Yeah, I think using
p.outputSetis simpler. Will update later.