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 2022/08/08 12:29:25 UTC

[GitHub] [spark] zhengruifeng opened a new pull request, #37438: [SPARK-40007][PYTHON] Add function 'mode' to PySpark

zhengruifeng opened a new pull request, #37438:
URL: https://github.com/apache/spark/pull/37438

   ### What changes were proposed in this pull request?
   expose 'mode' to `functions`
   
   
   ### Why are the changes needed?
   to support `mode` in PySpark
   
   
   ### Does this PR introduce _any_ user-facing change?
   yes, new API
   
   
   ### How was this patch tested?
   added doctest


-- 
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-unsubscribe@spark.apache.org

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


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


[GitHub] [spark] zhengruifeng closed pull request #37438: [SPARK-40007][PYTHON][SQL] Add 'mode' to functions

Posted by GitBox <gi...@apache.org>.
zhengruifeng closed pull request #37438: [SPARK-40007][PYTHON][SQL] Add 'mode' to functions
URL: https://github.com/apache/spark/pull/37438


-- 
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-unsubscribe@spark.apache.org

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


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


[GitHub] [spark] zhengruifeng commented on a diff in pull request #37438: [SPARK-40007][PYTHON] Add function 'mode' to PySpark

Posted by GitBox <gi...@apache.org>.
zhengruifeng commented on code in PR #37438:
URL: https://github.com/apache/spark/pull/37438#discussion_r940181869


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Mode.scala:
##########
@@ -49,7 +49,7 @@ case class Mode(
   // Returns null for empty inputs
   override def nullable: Boolean = true
 
-  override val dataType: DataType = child.dataType
+  override def dataType: DataType = child.dataType

Review Comment:
   this change is needed, otherwise:
   ```
   scala> df.groupBy("a").agg(mode(col("b")))
   org.apache.spark.sql.catalyst.analysis.UnresolvedException: Invalid call to dataType on unresolved object
     at org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute.dataType(unresolved.scala:137)
     at org.apache.spark.sql.catalyst.expressions.aggregate.Mode.<init>(Mode.scala:52)
     at org.apache.spark.sql.functions$.mode(functions.scala:679)
     ... 49 elided
   
   ```



-- 
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-unsubscribe@spark.apache.org

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


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


[GitHub] [spark] zhengruifeng commented on pull request #37438: [SPARK-40007][PYTHON][SQL] Add 'mode' to functions

Posted by GitBox <gi...@apache.org>.
zhengruifeng commented on PR #37438:
URL: https://github.com/apache/spark/pull/37438#issuecomment-1208869289

   Merged to master!


-- 
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-unsubscribe@spark.apache.org

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


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