mirror of
https://github.com/apache/impala.git
synced 2026-01-07 09:02:19 -05:00
1) Fix ROWS following start bound where window is never fully in partition 2) Fix sum() NULL handling over sliding windows and add/consolidate tests. sum() should return NULL when all non-NULL values are removed. Because sum only stores the current sum as the intermediate value, we can't know if the sum is actually 0 or if there are no non-NULL values in the window. (avg() doesn't have this problem because it explicitly keeps the count of the number of elements in the average as part of the intermediate state.) Instead of changing sum() to have more intermediate state (which would affect aggregations), we can just keep track of the number of calls to Update() and Remove() in the FunctionContextImpl and check in SumRemove() whether or not there are any non-null elements being summed. Added tests (verified with Oracle). 3) Fixed a bug where the state tracking the last result tuple could be wrong and resulting in a crash. 4) IMPALA-1269: Windows between a start offset to CURRENT ROW might could produce wrong results between partitions. 5) IMPALA-1273: Incorrect results with very large window and small table Tests are included for all issues. Change-Id: I0f396c24078a1494fb977e8775f1ca8c530932eb Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4397 Reviewed-by: Matthew Jacobs <mj@cloudera.com> Tested-by: jenkins