You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/04/29 07:30:37 UTC

[GitHub] [spark] viirya commented on a change in pull request #24482: [SPARK-27581][SQL] DataFrame countDistinct("*") shouldn't fail with AnalysisException

viirya commented on a change in pull request #24482: [SPARK-27581][SQL] DataFrame countDistinct("*") shouldn't fail with AnalysisException
URL: https://github.com/apache/spark/pull/24482#discussion_r279257949
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/functions.scala
 ##########
 @@ -358,9 +358,10 @@ object functions {
    * @since 1.3.0
    */
   @scala.annotation.varargs
-  def countDistinct(expr: Column, exprs: Column*): Column = {
-    withAggregateFunction(Count.apply((expr +: exprs).map(_.expr)), isDistinct = true)
-  }
+  def countDistinct(expr: Column, exprs: Column*): Column =
+    // For usage like countDistinct("*"), we should let analyzer expand star and
 
 Review comment:
   `count("*")` doesn't go into Analyzer. It is transformed to `count(1)` in `AstBuilder` and `functions` before analysis.
   
   https://github.com/apache/spark/blob/0407070945fc090c84dde7a84e1b24a1acb131d4/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala#L1363-L1370
   
   https://github.com/apache/spark/blob/90085a184797f8bddbff8ca6ec7a60f3899c1a86/sql/core/src/main/scala/org/apache/spark/sql/functions.scala#L337-L343

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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