GitHub user jianqiao opened a pull request: https://github.com/apache/incubator-quickstep/pull/277
Fix a bug with min/max aggregation. This PR fixes the bug with min/max aggregation (that produces incorrect results) when the aggregated column is stored with **leading-zero-truncation compression**. The bug happens because the untyped value (i.e. a `const void *` pointer) obtained from the leading-zero-truncation compressed column's corresponding `ValueAccessor` is [the address of a temporary buffer](https://github.com/apache/incubator-quickstep/blob/master/storage/CompressedColumnStoreValueAccessor.hpp#L112) -- i.e. the value pointer becomes invalid when the next `accessor->next()` gets called. [Keeping the value pointer](https://github.com/apache/incubator-quickstep/blob/master/types/operations/comparisons/LiteralComparators-inl.hpp#L546) across [multiple iterations of](https://github.com/apache/incubator-quickstep/blob/master/types/operations/comparisons/LiteralComparators-inl.hpp#L568) accessor->next() causes the problem. The fix is to copy the value pointer's underlying value to a local variable (so that the value remains valid across iterations of accessor->next()). You can merge this pull request into a Git repository by running: $ git pull https://github.com/apache/incubator-quickstep fix-compare-aggregate Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-quickstep/pull/277.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #277 ---- commit f3b792bf532aad41724b91cf88c97fcfbbdc1ea9 Author: Jianqiao Zhu <jianq...@cs.wisc.edu> Date: 2017-08-02T20:47:30Z Fix the bug with min/max aggregation. ---- --- 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. ---