minyyy commented on a change in pull request #35850:
URL: https://github.com/apache/spark/pull/35850#discussion_r826170557
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/NestedColumnAliasing.scala
##########
@@ -395,12 +434,11 @@ object GeneratorNestedColumnAliasing {
val updatedGenerate = rewrittenG.copy(generatorOutput =
updatedGeneratorOutput)
// Replace nested column accessor with generator output.
- val attrExprIdsOnGenerator =
attrToExtractValuesOnGenerator.keys.map(_.exprId).toSet
+ val generateOutputAttrExprId =
attrToExtractValuesOnGenerator.keys.map(_.exprId).head
+ val generateOutputAttr = updatedGenerate.output
+ .find(_.exprId == generateOutputAttrExprId).get
Review comment:
I changed the .getOrElse to .get to make it clearer - we should never
fail to find the generator output attribute, if we want to be safer, we can use
a require to check and return here, but should not use getOrElse because IMO if
we run into the "else" branch it means an error.
--
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]