viirya commented on code in PR #36510:
URL: https://github.com/apache/spark/pull/36510#discussion_r870855199
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala:
##########
@@ -1014,12 +1014,14 @@ object CollapseProject extends Rule[LogicalPlan] with
AliasHelper {
}
}
- @scala.annotation.tailrec
- private def isExtractOnly(expr: Expression, ref: Attribute): Boolean = expr
match {
- case a: Alias => isExtractOnly(a.child, ref)
- case e: ExtractValue => isExtractOnly(e.children.head, ref)
- case a: Attribute => a.semanticEquals(ref)
- case _ => false
+ private def isExtractOnly(expr: Expression, ref: Attribute): Boolean = {
+ def hasRefInNonExtractValue(e: Expression): Boolean = e match {
+ case a: Attribute => a.semanticEquals(ref)
+ // The fisrt child of `ExtractValue` is the complex type to be extracted.
Review Comment:
```suggestion
// The first child of `ExtractValue` is the complex type to be
extracted.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]