dongjoon-hyun commented on a change in pull request #31908:
URL: https://github.com/apache/spark/pull/31908#discussion_r598378931



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala
##########
@@ -659,6 +659,12 @@ case class Aggregate(
     val nonAgg = 
aggregateExpressions.filter(_.find(_.isInstanceOf[AggregateExpression]).isEmpty)
     getAllValidConstraints(nonAgg)
   }
+
+  // Whether this Aggregate operator is equally the Distinct operator.
+  private[sql] def isEquallyDistinct: Boolean = {
+    groupingExpressions.size == aggregateExpressions.size &&

Review comment:
       It seems that we don't support the following case. Shall we have a test 
case for the following?
   ```scala
   scala> sql("select distinct a, a from t1 left join t2 on false").explain
   == Physical Plan ==
   AdaptiveSparkPlan isFinalPlan=false
   +- HashAggregate(keys=[a#31], functions=[])
      +- Exchange hashpartitioning(a#31, 200), ENSURE_REQUIREMENTS, [id=#194]
         +- HashAggregate(keys=[a#31], functions=[])
            +- Project [a#31, a#31]
               +- BroadcastNestedLoopJoin BuildRight, LeftOuter, false
                  :- Scan hive default.t1 [a#31], HiveTableRelation 
[`default`.`t1`, org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe, Data Cols: 
[a#31], Partition Cols: []]
                  +- BroadcastExchange IdentityBroadcastMode, [id=#189]
                     +- Scan hive default.t2 HiveTableRelation [`default`.`t2`, 
org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe, Data Cols: [b#32], 
Partition Cols: []]
   ```




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

Reply via email to