Github user hvanhovell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9566#discussion_r44514711
  
    --- Diff: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/AggregationQuerySuite.scala
 ---
    @@ -545,19 +576,21 @@ abstract class AggregationQuerySuite extends 
QueryTest with SQLTestUtils with Te
               |  count(distinct value2),
               |  sum(distinct value2),
               |  count(distinct value1, value2),
    +          |  longProductSum(distinct value1, value2),
    --- End diff --
    
    Yes and No.
    
    The input we care about only consists of these tuples: ```[value1=null, 
value2=null], [value1=null, value2=1], [value1=1, value2=null], and [value1=1, 
value2=1]```
    
    However in the current implementation a distinct aggregate will see more 
input than those. It will also see records from other groups. However, the 
values in these records are nulled out. The assumption here is that an 
AggregateFunction is not changed by an all NULL update. The only case I can 
think of that would be problematic is a ```FIRST(DISTINCT ...)```; which 
shouldn't be used like that anyway.
    
    We could solve this by wrapping AggregateFunctions with an operator which 
will only update if the group id is correct.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to