dtenedor commented on code in PR #46918:
URL: https://github.com/apache/spark/pull/46918#discussion_r1631794722


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/FunctionTableSubqueryArgumentExpression.scala:
##########
@@ -165,20 +165,18 @@ case class FunctionTableSubqueryArgumentExpression(
    * when the partition has changed.
    */
   lazy val partitioningExpressionIndexes: Seq[Int] = {
-    val extraPartitionByExpressionsToIndexes: Map[Expression, Int] =
-      extraProjectedPartitioningExpressions.map(_.child).zipWithIndex.toMap
-    partitionByExpressions.map { e =>
-      subqueryOutputs.getOrElse(e, extraPartitionByExpressionsToIndexes(e) + 
plan.output.length)
+    (0 until extraProjectedPartitioningExpressions.length).map { i =>
+      if (selectedInputExpressions.nonEmpty) {
+        selectedInputExpressions.length + i

Review Comment:
   Good catch. This is related to `selectedInputExpressions` because if they 
are set, we want to use different indexes here [1]. I switched to update that 
location instead, which should no longer break the location you mentioned.
   
   [1] 
https://github.com/apache/spark/blob/201df0d7ac81f6bd5c39f513b0a06cb659dc9a3f/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala#L2211



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to