cloud-fan commented on a change in pull request #30145:
URL: https://github.com/apache/spark/pull/30145#discussion_r604855556
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/SubstituteUnresolvedOrdinals.scala
##########
@@ -27,13 +27,23 @@ import org.apache.spark.sql.types.IntegerType
* Replaces ordinal in 'order by' or 'group by' with UnresolvedOrdinal
expression.
*/
object SubstituteUnresolvedOrdinals extends Rule[LogicalPlan] {
- private def isIntLiteral(e: Expression) = e match {
+ private def containIntLiteral(e: Expression): Boolean = e match {
case Literal(_, IntegerType) => true
+ case Cube(_, groupByExprs) => groupByExprs.exists(containIntLiteral)
+ case Rollup(_, groupByExprs) => groupByExprs.exists(containIntLiteral)
+ case GroupingSets(_, flatGroupingSets, groupByExprs) =>
+ flatGroupingSets.exists(containIntLiteral) ||
groupByExprs.exists(containIntLiteral)
case _ => false
}
+ private def resolveOrdinal(expression: Expression): Expression = expression
match {
Review comment:
the name is weird as it returns `UnresolvedOrdinal`. how about
`substituteUnresolvedOrdinal`?
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]