maropu commented on issue #26420: [SPARK-27986][SQL] Support ANSI SQL filter 
predicate for aggregate expression.
URL: https://github.com/apache/spark/pull/26420#issuecomment-553785466
 
 
   This case?
   ```
   //PgSQL
   postgres=# select * from t;
    k | v1 | v2 
   ---+----+----
    1 |  1 |  1
    2 |  2 |  2
   (2 rows)
   
   postgres=# select k, sum(v1) filter (where v1 > (select 1)), avg(v2) from t 
group by k;
    k | sum |          avg           
   ---+-----+------------------------
    2 |   2 |     2.0000000000000000
    1 |     | 1.00000000000000000000
   (2 rows)
   
   // This pr
   scala> sql("select k, sum(v1) filter (where v1 > (select 1)), avg(v2) from t 
group by k").show()
   19/11/14 16:48:15 ERROR Executor: Exception in task 1.0 in stage 13.0 (TID 
207)
   java.io.InvalidClassException: 
org.apache.spark.sql.catalyst.expressions.ScalarSubquery; no valid constructor
        at 
java.io.ObjectStreamClass$ExceptionInfo.newInvalidClassException(ObjectStreamClass.java:169)
        at 
java.io.ObjectStreamClass.checkDeserialize(ObjectStreamClass.java:874)
        at 
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2043)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1573)
        at 
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2287)
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2211)
        at 
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2069)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream
   
   ```
   I personally think we consider more about the exact BNF grammar for 
aggregate filters that we will support in this pr. 

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


With regards,
Apache Git Services

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

Reply via email to