sunchao commented on code in PR #37749:
URL: https://github.com/apache/spark/pull/37749#discussion_r961777107


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/V2ExpressionUtils.scala:
##########
@@ -105,18 +105,27 @@ object V2ExpressionUtils extends SQLConfHelper with 
Logging {
           TransformExpression(bound, resolvedRefs, Some(numBuckets))
         }
       }
-    case NamedTransform(name, refs)
-        if refs.length == 1 && refs.forall(_.isInstanceOf[NamedReference]) =>

Review Comment:
   I'm also +1 on the first option. I also tried on my side, and it's possible 
to trigger the assertion error with the following example in 
`EnsureRequirementsSuite`:
   ```scala
     test("multiple named references in transform") {
       val plan1 = DummySparkPlan(
         outputPartitioning = KeyGroupedPartitioning(
           truncate(exprD, exprA) :: bucket(16, exprB) :: Nil, 4)
       )
       val plan2 = DummySparkPlan(
         outputPartitioning = KeyGroupedPartitioning(
           truncate(exprD, exprA) :: bucket(16, exprC) :: Nil, 4)
       )
       val smjExec = SortMergeJoinExec(
         exprD :: exprA :: exprB :: Nil, exprD :: exprA :: exprC :: Nil, Inner, 
None, plan1, plan2)
       EnsureRequirements.apply(smjExec) match {
         case SortMergeJoinExec(_, _, _, _,
           SortExec(_, _, DummySparkPlan(_, _, left: KeyGroupedPartitioning, _, 
_), _),
           SortExec(_, _, DummySparkPlan(_, _, right: KeyGroupedPartitioning, 
_, _), _), _) =>
           assert(left.expressions === Seq(truncate(exprD, exprA), bucket(16, 
exprB)))
           assert(right.expressions === Seq(truncate(exprD, exprA), bucket(16, 
exprC)))
         case other => fail(other.toString)
       }
     }
   ```



-- 
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]

Reply via email to