Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/11341#discussion_r54072101
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
---
@@ -382,7 +382,14 @@ object ColumnPruning extends Rule[LogicalPlan] {
val required = child.references ++ p.references
if ((child.inputSet -- required).nonEmpty) {
val newChildren = child.children.map(c => prunedChild(c, required))
- p.copy(child = child.withNewChildren(newChildren))
+ val newChild = child.withNewChildren(newChildren)
+ val sameOutput = newChild.output.size == p.output.size &&
+ newChild.output.zip(p.output).forall(pair =>
pair._1.semanticEquals(pair._2))
--- End diff --
what if we use `semanticEquals` in the above case? i.e.
```
def sameOutput(outpuq1, output2): Boolean = {
output1.size == output2.size && output1.zip(output2).forall { case (a1,
a2) => a1 semanticEquals a2 }
}
// Eliminate no-op Projects
case p @ Project(projectList, child) if sameOutput(o.output, child.output)
=> child
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]