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/10 15:10:07 UTC

[GitHub] [spark] ychr removed a comment on issue #24335: [SPARK-27425] Add count_if functions

ychr removed a comment on issue #24335: [SPARK-27425] Add count_if functions
URL: https://github.com/apache/spark/pull/24335#issuecomment-481731585
 
 
   > we wouldn't add a new function unless it were standard SQL. 
   
   Would you mind if I ask you the reason? 
   [Presto](https://prestodb.github.io/docs/current/functions/aggregate.html#count_if) and [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/aggregate_functions#countif) provide this nevertheless it isn't ISO/ANSI standards.
   
   > With Spark SQL, it's pretty trivial to express count-if with a filter and count.
   
   As you said, we can archive this with existing functions like followings, which are a little bit inconvenient.
   
   - `COUNT(IF(very_complex_condition, 1, NULL))`
   - `COUNT(CASE WHEN very_complex_condition THEN 1 END)`
   - `SUM(IF(very_complex_condition, 1, NULL))`
   - `SUM(CASE WHEN very_complex_condition THEN 1 END)`
   
   However, I think that these are a little bit inconvenient and painful.

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