Thomas Tauber-Marshall has uploaded this change for review. ( 
http://gerrit.cloudera.org:8080/8854


Change subject: IMPALA-6295: Fix mix/max handling of 'nan' and 'inf'
......................................................................

IMPALA-6295: Fix mix/max handling of 'nan' and 'inf'

This patch fixes several issues related to the min/max aggregate
functions and their handling of 'nan' and 'inf':
- Previously, if 'inf' or '-inf' was the only value for the min/max
  and codegen was being used, the result would be incorrect. This
  occurred, for example in the case of 'inf' and 'min', because we
  set an initial value of numeric_limits::max, which is less than
  'inf', so the returned min was numeric_limits::max when it should be
  'inf'. The fix is to set the initial value to
  numeric_limits::infinity.
- Previously, if one of the values was 'nan', the result of min/max
  was non-deterministic depending on the order the values were
  evaluated in. This occurs because 'nan' < or > 'any value' is always
  false, so if the first value added was 'nan', all other comparisons
  would be false and 'nan' would be returned, whereas if the first
  value wasn't 'nan' then the 'nan' wouldn't be returned. The fix is
  to treat 'nan' specially and to always return 'nan' if there is a
  single 'nan' value.

Testing:
- Added e2e tests for both scenarios.

Change-Id: Ia1e206105937ce5afc75ca5044597d39b3dc6a81
---
M be/src/codegen/llvm-codegen.cc
M be/src/codegen/llvm-codegen.h
M be/src/exec/partitioned-aggregation-node.cc
M be/src/exprs/aggregate-functions-ir.cc
M be/src/exprs/expr-value.h
M testdata/workloads/functional-query/queries/QueryTest/aggregation.test
6 files changed, 72 insertions(+), 35 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/54/8854/1
--
To view, visit http://gerrit.cloudera.org:8080/8854
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia1e206105937ce5afc75ca5044597d39b3dc6a81
Gerrit-Change-Number: 8854
Gerrit-PatchSet: 1
Gerrit-Owner: Thomas Tauber-Marshall <tmarsh...@cloudera.com>

Reply via email to