-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-17425][SQL] Override sameResult in HiveTableScanExec to make ReuseExchange work in text format table #14988
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 all commits
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 |
|---|---|---|
|
|
@@ -164,4 +164,19 @@ case class HiveTableScanExec( | |
| } | ||
|
|
||
| override def output: Seq[Attribute] = attributes | ||
|
|
||
| override def sameResult(plan: SparkPlan): Boolean = plan match { | ||
| case other: HiveTableScanExec => | ||
| val thisPredicates = partitionPruningPred.map(cleanExpression) | ||
| val otherPredicates = other.partitionPruningPred.map(cleanExpression) | ||
|
|
||
| val result = relation.sameResult(other.relation) && | ||
| output.length == other.output.length && | ||
| output.zip(other.output) | ||
| .forall(p => p._1.name == p._2.name && p._1.dataType == p._2.dataType) && | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does the name matter? I'm not quite sure, but
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For example, the full output of table src is (key: Int, value: Int), and output1 is (key: Int), output2 is (value: Int), their(output1, output2) dataType are same, but they are diff and can't be resued.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| thisPredicates.length == otherPredicates.length && | ||
| thisPredicates.zip(otherPredicates).forall(p => p._1.semanticEquals(p._2)) | ||
| result | ||
| case _ => false | ||
| } | ||
| } | ||
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.
why the default one doesn't work?
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.
left.cleanArgs == right.cleanArgsin defalutsameResultreturn false, becauseequalsinMetastoreRelationcompare the output(AttributeReference) andexprIds are diff. We need to erase the exprId.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.
ah, I think all leaf nodes suffer this problem, can you follow the way how they fix it? e.g.
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.
ReuseExchangework in parquet/orc format, becauseFileSourceScanExechas override thesameResult.