You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@impala.apache.org by "anujphadke (Code Review)" <ge...@cloudera.org> on 2017/01/26 08:34:35 UTC

[Impala-ASF-CR] IMPALA-4738: STDDEV SAMP should return NULL for single record input

anujphadke has uploaded a new change for review.

  http://gerrit.cloudera.org:8080/5800

Change subject: IMPALA-4738: STDDEV_SAMP should return NULL for single record input
......................................................................

IMPALA-4738: STDDEV_SAMP should return NULL for single record input

In calculating the STDDEV_SAMP of N rows a divion by N-1 rows is involved.
Hence STDDEV_SAMP for a single row  involves a division by 0. This change
returns a NULL instead of a 0 when calculating STDDEV_SAMP for a single row.
STDDEV_POP for single row will still return a 0 since this does not
involve  a division by 0.

Change-Id: Ide8af752cd8a2e554a2cd5a1ec948967a80de1fe
---
M be/src/exprs/aggregate-functions-ir.cc
M testdata/workloads/functional-query/queries/QueryTest/aggregation.test
2 files changed, 4 insertions(+), 4 deletions(-)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ide8af752cd8a2e554a2cd5a1ec948967a80de1fe
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: anujphadke <ap...@cloudera.com>

[Impala-ASF-CR] IMPALA-4738: STDDEV SAMP should return NULL for single record input

Posted by "anujphadke (Code Review)" <ge...@cloudera.org>.
anujphadke has posted comments on this change.

Change subject: IMPALA-4738: STDDEV_SAMP should return NULL for single record input
......................................................................


Patch Set 2:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/5800/1/testdata/workloads/functional-query/queries/QueryTest/aggregation.test
File testdata/workloads/functional-query/queries/QueryTest/aggregation.test:

PS1, Line 26: SELECT variance(tinyint_col), stddev(smallint_col),stddev_samp(smallint_col),
            : variance_pop(int_col),
> please add a col for stddev_samp as well. even though they're aliased now, 
Done


-- 
To view, visit http://gerrit.cloudera.org:8080/5800
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ide8af752cd8a2e554a2cd5a1ec948967a80de1fe
Gerrit-PatchSet: 2
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: anujphadke <ap...@cloudera.com>
Gerrit-Reviewer: Matthew Jacobs <mj...@cloudera.com>
Gerrit-Reviewer: anujphadke <ap...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-4738: STDDEV SAMP should return NULL for single record input

Posted by "Matthew Jacobs (Code Review)" <ge...@cloudera.org>.
Matthew Jacobs has posted comments on this change.

Change subject: IMPALA-4738: STDDEV_SAMP should return NULL for single record input
......................................................................


Patch Set 3: Code-Review+2

(2 comments)

Thanks! Please let John know that the existing doc needs to be updated.

http://gerrit.cloudera.org:8080/#/c/5800/3//COMMIT_MSG
Commit Message:

PS3, Line 9: In calculating the STDDEV_SAMP/VARIANCE of N rows a divion by N-1 rows is involved.
           : Hence STDDEV_SAMP/VARIANCE for a single row  involves a division by 0. This change
           : returns a NULL instead of a 0 when calculating STDDEV_SAMP/VARIANCE for a single row.
           : STDDEV_POP/VARIANCE_POP for single row will still return a 0 since this does not involve  a division
           : by 0.
nit wrap at 80 chars


Line 14: 
please mention this matches postgres behavior


-- 
To view, visit http://gerrit.cloudera.org:8080/5800
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ide8af752cd8a2e554a2cd5a1ec948967a80de1fe
Gerrit-PatchSet: 3
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: anujphadke <ap...@cloudera.com>
Gerrit-Reviewer: Matthew Jacobs <mj...@cloudera.com>
Gerrit-Reviewer: anujphadke <ap...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-4738: STDDEV SAMP should return NULL for single record input

Posted by "Matthew Jacobs (Code Review)" <ge...@cloudera.org>.
Matthew Jacobs has posted comments on this change.

Change subject: IMPALA-4738: STDDEV_SAMP should return NULL for single record input
......................................................................


Patch Set 1:

(2 comments)

http://gerrit.cloudera.org:8080/#/c/5800/1/be/src/exprs/aggregate-functions-ir.cc
File be/src/exprs/aggregate-functions-ir.cc:

PS1, Line 1348: DoubleVal AggregateFunctions::KnuthStddevFinalize(FunctionContext* ctx,
              :     const StringVal& state_sv) {
              :   DCHECK(!state_sv.is_null);
              :   DCHECK_EQ(state_sv.len, sizeof(KnuthVarianceState));
              :   KnuthVarianceState* state = reinterpret_cast<KnuthVarianceState*>(state_sv.ptr);
              :   if (state->count == 0 || state->count == 1) return DoubleVal::null();
              :   re
> STDDEV is an alias for STDDEV_SAMP according the impala documentation. Shou
If that's the case, though it is concerning Oracle's behavior differs. I see postgres does just alias them, so I guess that's fine as long as we're clear in the docs. Thanks for checking that.


http://gerrit.cloudera.org:8080/#/c/5800/1/testdata/workloads/functional-query/queries/QueryTest/aggregation.test
File testdata/workloads/functional-query/queries/QueryTest/aggregation.test:

PS1, Line 26: SELECT variance(tinyint_col), stddev(smallint_col), variance_pop(int_col),
            : stddev_pop(bigint_col)
please add a col for stddev_samp as well. even though they're aliased now, let's make sure we cover both fns anyway for the future.


-- 
To view, visit http://gerrit.cloudera.org:8080/5800
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ide8af752cd8a2e554a2cd5a1ec948967a80de1fe
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: anujphadke <ap...@cloudera.com>
Gerrit-Reviewer: Matthew Jacobs <mj...@cloudera.com>
Gerrit-Reviewer: anujphadke <ap...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-4738: STDDEV SAMP should return NULL for single record input

Posted by "anujphadke (Code Review)" <ge...@cloudera.org>.
anujphadke has uploaded a new patch set (#2).

Change subject: IMPALA-4738: STDDEV_SAMP should return NULL for single record input
......................................................................

IMPALA-4738: STDDEV_SAMP should return NULL for single record input

In calculating the STDDEV_SAMP of N rows a divion by N-1 rows is involved.
Hence STDDEV_SAMP for a single row  involves a division by 0. This change
returns a NULL instead of a 0 when calculating STDDEV_SAMP for a single row.
STDDEV_POP for single row will still return a 0 since this does not
involve  a division by 0.

Change-Id: Ide8af752cd8a2e554a2cd5a1ec948967a80de1fe
---
M be/src/exprs/aggregate-functions-ir.cc
M testdata/workloads/functional-query/queries/QueryTest/aggregation.test
2 files changed, 7 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/00/5800/2
-- 
To view, visit http://gerrit.cloudera.org:8080/5800
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ide8af752cd8a2e554a2cd5a1ec948967a80de1fe
Gerrit-PatchSet: 2
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: anujphadke <ap...@cloudera.com>
Gerrit-Reviewer: Matthew Jacobs <mj...@cloudera.com>
Gerrit-Reviewer: anujphadke <ap...@cloudera.com>

[Impala-ASF-CR] IMPALA-4738: STDDEV SAMP should return NULL for single record input

Posted by "Matthew Jacobs (Code Review)" <ge...@cloudera.org>.
Matthew Jacobs has posted comments on this change.

Change subject: IMPALA-4738: STDDEV_SAMP should return NULL for single record input
......................................................................


Patch Set 1:

(1 comment)

I think you need a new finalize function to separate stddev and stddev_samp

http://gerrit.cloudera.org:8080/#/c/5800/1/be/src/exprs/aggregate-functions-ir.cc
File be/src/exprs/aggregate-functions-ir.cc:

PS1, Line 1348: DoubleVal AggregateFunctions::KnuthStddevFinalize(FunctionContext* ctx,
              :     const StringVal& state_sv) {
              :   DCHECK(!state_sv.is_null);
              :   DCHECK_EQ(state_sv.len, sizeof(KnuthVarianceState));
              :   KnuthVarianceState* state = reinterpret_cast<KnuthVarianceState*>(state_sv.ptr);
              :   if (state->count == 0 || state->count == 1) return DoubleVal::null();
              :   re
this gets used by both stddev and stddev_samp, but it looks like Oracle (not sure about other DBs) do not return null for stddev when there is 1 row:

https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions159.htm

... It differs from STDDEV_SAMP in that STDDEV returns zero when it has only 1 row of input data, whereas STDDEV_SAMP returns null. ...


-- 
To view, visit http://gerrit.cloudera.org:8080/5800
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ide8af752cd8a2e554a2cd5a1ec948967a80de1fe
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: anujphadke <ap...@cloudera.com>
Gerrit-Reviewer: Matthew Jacobs <mj...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-4738: STDDEV SAMP should return NULL for single record input

Posted by "anujphadke (Code Review)" <ge...@cloudera.org>.
anujphadke has posted comments on this change.

Change subject: IMPALA-4738: STDDEV_SAMP should return NULL for single record input
......................................................................


Patch Set 4:

(2 comments)

http://gerrit.cloudera.org:8080/#/c/5800/3//COMMIT_MSG
Commit Message:

PS3, Line 9: In calculating the STDDEV_SAMP/VARIANCE of N rows a divion by
           : N-1 rows is involved. Hence STDDEV_SAMP/VARIANCE for a single
           : row involves a division by 0. This change returns a NULL instead
           : of a 0 when calculating STDDEV_SAMP/VARIANCE for a single row.
           : STDDE
> nit wrap at 80 chars
Done


Line 14: this does not involve  a division by 0. This matches the postgres
> please mention this matches postgres behavior
Done


-- 
To view, visit http://gerrit.cloudera.org:8080/5800
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ide8af752cd8a2e554a2cd5a1ec948967a80de1fe
Gerrit-PatchSet: 4
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: anujphadke <ap...@cloudera.com>
Gerrit-Reviewer: Matthew Jacobs <mj...@cloudera.com>
Gerrit-Reviewer: anujphadke <ap...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-4738: STDDEV SAMP should return NULL for single record input

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has submitted this change and it was merged.

Change subject: IMPALA-4738: STDDEV_SAMP should return NULL for single record input
......................................................................


IMPALA-4738: STDDEV_SAMP should return NULL for single record input

In calculating the STDDEV_SAMP/VARIANCE of N rows a divion by
N-1 rows is involved. Hence STDDEV_SAMP/VARIANCE for a single
row involves a division by 0. This change returns a NULL instead
of a 0 when calculating STDDEV_SAMP/VARIANCE for a single row.
STDDEV_POP/VARIANCE_POP for single row will still return a 0 since
this does not involve  a division by 0. This matches the postgres
behavior.

Change-Id: Ide8af752cd8a2e554a2cd5a1ec948967a80de1fe
Reviewed-on: http://gerrit.cloudera.org:8080/5800
Reviewed-by: Matthew Jacobs <mj...@cloudera.com>
Tested-by: Impala Public Jenkins
---
M be/src/exprs/aggregate-functions-ir.cc
M testdata/workloads/functional-query/queries/QueryTest/aggregation.test
2 files changed, 8 insertions(+), 7 deletions(-)

Approvals:
  Impala Public Jenkins: Verified
  Matthew Jacobs: Looks good to me, approved



-- 
To view, visit http://gerrit.cloudera.org:8080/5800
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ide8af752cd8a2e554a2cd5a1ec948967a80de1fe
Gerrit-PatchSet: 5
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: anujphadke <ap...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins
Gerrit-Reviewer: Matthew Jacobs <mj...@cloudera.com>
Gerrit-Reviewer: anujphadke <ap...@cloudera.com>

[Impala-ASF-CR] IMPALA-4738: STDDEV SAMP should return NULL for single record input

Posted by "Matthew Jacobs (Code Review)" <ge...@cloudera.org>.
Matthew Jacobs has posted comments on this change.

Change subject: IMPALA-4738: STDDEV_SAMP should return NULL for single record input
......................................................................


Patch Set 2: Code-Review+2

(2 comments)

please let john know we should doc this change

http://gerrit.cloudera.org:8080/#/c/5800/2/testdata/workloads/functional-query/queries/QueryTest/aggregation.test
File testdata/workloads/functional-query/queries/QueryTest/aggregation.test:

PS2, Line 26: ,
please add a space


PS2, Line 30: 0,0
so all of these match postgres now?


-- 
To view, visit http://gerrit.cloudera.org:8080/5800
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ide8af752cd8a2e554a2cd5a1ec948967a80de1fe
Gerrit-PatchSet: 2
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: anujphadke <ap...@cloudera.com>
Gerrit-Reviewer: Matthew Jacobs <mj...@cloudera.com>
Gerrit-Reviewer: anujphadke <ap...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-4738: STDDEV SAMP should return NULL for single record input

Posted by "anujphadke (Code Review)" <ge...@cloudera.org>.
Hello Matthew Jacobs,

I'd like you to reexamine a change.  Please visit

    http://gerrit.cloudera.org:8080/5800

to look at the new patch set (#4).

Change subject: IMPALA-4738: STDDEV_SAMP should return NULL for single record input
......................................................................

IMPALA-4738: STDDEV_SAMP should return NULL for single record input

In calculating the STDDEV_SAMP/VARIANCE of N rows a divion by
N-1 rows is involved. Hence STDDEV_SAMP/VARIANCE for a single
row involves a division by 0. This change returns a NULL instead
of a 0 when calculating STDDEV_SAMP/VARIANCE for a single row.
STDDEV_POP/VARIANCE_POP for single row will still return a 0 since
this does not involve  a division by 0. This matches the postgres
behavior.

Change-Id: Ide8af752cd8a2e554a2cd5a1ec948967a80de1fe
---
M be/src/exprs/aggregate-functions-ir.cc
M testdata/workloads/functional-query/queries/QueryTest/aggregation.test
2 files changed, 8 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/00/5800/4
-- 
To view, visit http://gerrit.cloudera.org:8080/5800
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ide8af752cd8a2e554a2cd5a1ec948967a80de1fe
Gerrit-PatchSet: 4
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: anujphadke <ap...@cloudera.com>
Gerrit-Reviewer: Matthew Jacobs <mj...@cloudera.com>
Gerrit-Reviewer: anujphadke <ap...@cloudera.com>

[Impala-ASF-CR] IMPALA-4738: STDDEV SAMP should return NULL for single record input

Posted by "Matthew Jacobs (Code Review)" <ge...@cloudera.org>.
Matthew Jacobs has posted comments on this change.

Change subject: IMPALA-4738: STDDEV_SAMP should return NULL for single record input
......................................................................


Patch Set 4: Code-Review+2

-- 
To view, visit http://gerrit.cloudera.org:8080/5800
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ide8af752cd8a2e554a2cd5a1ec948967a80de1fe
Gerrit-PatchSet: 4
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: anujphadke <ap...@cloudera.com>
Gerrit-Reviewer: Matthew Jacobs <mj...@cloudera.com>
Gerrit-Reviewer: anujphadke <ap...@cloudera.com>
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-4738: STDDEV SAMP should return NULL for single record input

Posted by "anujphadke (Code Review)" <ge...@cloudera.org>.
anujphadke has posted comments on this change.

Change subject: IMPALA-4738: STDDEV_SAMP should return NULL for single record input
......................................................................


Patch Set 3:

(2 comments)

http://gerrit.cloudera.org:8080/#/c/5800/2/testdata/workloads/functional-query/queries/QueryTest/aggregation.test
File testdata/workloads/functional-query/queries/QueryTest/aggregation.test:

PS2, Line 26: 
> please add a space
Done


PS2, Line 30: 
> so all of these match postgres now?
variance function needed similar changes like std_dev.
Here is the output from postgres.

Last login: Thu Feb  2 12:32:04 on ttys000
"/Applications/Postgres.app/Contents/Versions/9.6/bin/psql" -p5432 -d "aphadke"
aphadke-MBP-2:~ aphadke$ "/Applications/Postgres.app/Contents/Versions/9.6/bin/psql" -p5432 -d "aphadke"
psql (9.6.1)
Type "help" for help.

aphadke=# select stddev_samp(56);
 stddev_samp 
-------------
            
(1 row)

aphadke=# select stddev(56);
 stddev 
--------
       
(1 row)

aphadke=# select stddev_pop(56);
 stddev_pop 
------------
          0
(1 row)

aphadke=# select var_pop(56);
 var_pop 
---------
       0
(1 row)

aphadke=# select var_samp(56);
 var_samp 
----------
         
(1 row)

aphadke=# select variance(56);
 variance 
----------
         
(1 row)

aphadke=#


-- 
To view, visit http://gerrit.cloudera.org:8080/5800
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ide8af752cd8a2e554a2cd5a1ec948967a80de1fe
Gerrit-PatchSet: 3
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: anujphadke <ap...@cloudera.com>
Gerrit-Reviewer: Matthew Jacobs <mj...@cloudera.com>
Gerrit-Reviewer: anujphadke <ap...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-4738: STDDEV SAMP should return NULL for single record input

Posted by "anujphadke (Code Review)" <ge...@cloudera.org>.
anujphadke has posted comments on this change.

Change subject: IMPALA-4738: STDDEV_SAMP should return NULL for single record input
......................................................................


Patch Set 1:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/5800/1/be/src/exprs/aggregate-functions-ir.cc
File be/src/exprs/aggregate-functions-ir.cc:

PS1, Line 1348: DoubleVal AggregateFunctions::KnuthStddevFinalize(FunctionContext* ctx,
              :     const StringVal& state_sv) {
              :   DCHECK(!state_sv.is_null);
              :   DCHECK_EQ(state_sv.len, sizeof(KnuthVarianceState));
              :   KnuthVarianceState* state = reinterpret_cast<KnuthVarianceState*>(state_sv.ptr);
              :   if (state->count == 0 || state->count == 1) return DoubleVal::null();
              :   re
> this gets used by both stddev and stddev_samp, but it looks like Oracle (no
STDDEV is an alias for STDDEV_SAMP according the impala documentation. Shouldn't they behave the same in this case?


-- 
To view, visit http://gerrit.cloudera.org:8080/5800
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ide8af752cd8a2e554a2cd5a1ec948967a80de1fe
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: anujphadke <ap...@cloudera.com>
Gerrit-Reviewer: Matthew Jacobs <mj...@cloudera.com>
Gerrit-Reviewer: anujphadke <ap...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-4738: STDDEV SAMP should return NULL for single record input

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change.

Change subject: IMPALA-4738: STDDEV_SAMP should return NULL for single record input
......................................................................


Patch Set 4: Verified+1

-- 
To view, visit http://gerrit.cloudera.org:8080/5800
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ide8af752cd8a2e554a2cd5a1ec948967a80de1fe
Gerrit-PatchSet: 4
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: anujphadke <ap...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins
Gerrit-Reviewer: Matthew Jacobs <mj...@cloudera.com>
Gerrit-Reviewer: anujphadke <ap...@cloudera.com>
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-4738: STDDEV SAMP should return NULL for single record input

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change.

Change subject: IMPALA-4738: STDDEV_SAMP should return NULL for single record input
......................................................................


Patch Set 4:

Build started: http://jenkins.impala.io:8080/job/gerrit-verify-dryrun/242/

-- 
To view, visit http://gerrit.cloudera.org:8080/5800
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ide8af752cd8a2e554a2cd5a1ec948967a80de1fe
Gerrit-PatchSet: 4
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: anujphadke <ap...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins
Gerrit-Reviewer: Matthew Jacobs <mj...@cloudera.com>
Gerrit-Reviewer: anujphadke <ap...@cloudera.com>
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-4738: STDDEV SAMP should return NULL for single record input

Posted by "anujphadke (Code Review)" <ge...@cloudera.org>.
Hello Matthew Jacobs,

I'd like you to reexamine a change.  Please visit

    http://gerrit.cloudera.org:8080/5800

to look at the new patch set (#3).

Change subject: IMPALA-4738: STDDEV_SAMP should return NULL for single record input
......................................................................

IMPALA-4738: STDDEV_SAMP should return NULL for single record input

In calculating the STDDEV_SAMP/VARIANCE of N rows a divion by N-1 rows is involved.
Hence STDDEV_SAMP/VARIANCE for a single row  involves a division by 0. This change
returns a NULL instead of a 0 when calculating STDDEV_SAMP/VARIANCE for a single row.
STDDEV_POP/VARIANCE_POP for single row will still return a 0 since this does not involve  a division
by 0.

Change-Id: Ide8af752cd8a2e554a2cd5a1ec948967a80de1fe
---
M be/src/exprs/aggregate-functions-ir.cc
M testdata/workloads/functional-query/queries/QueryTest/aggregation.test
2 files changed, 9 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/00/5800/3
-- 
To view, visit http://gerrit.cloudera.org:8080/5800
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ide8af752cd8a2e554a2cd5a1ec948967a80de1fe
Gerrit-PatchSet: 3
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: anujphadke <ap...@cloudera.com>
Gerrit-Reviewer: Matthew Jacobs <mj...@cloudera.com>
Gerrit-Reviewer: anujphadke <ap...@cloudera.com>