[Impala-ASF-CR] IMPALA-4470: Avoid creating a NumericLiteral from NaN/infinity/-0.

2016-11-16 Thread Internal Jenkins (Code Review)
Internal Jenkins has submitted this change and it was merged.

Change subject: IMPALA-4470: Avoid creating a NumericLiteral from 
NaN/infinity/-0.
..


IMPALA-4470: Avoid creating a NumericLiteral from NaN/infinity/-0.

Our NumericLiteral is backed by a BigDecimal which cannot
represent the special float values NaN, infinity or negative zero.
As a result, when evaluating constant expressions from the FE we
hit an exception when trying to create a NumericLiteral from
a NaN or infinity value. Before, negative zero would silently
get converted to zero which is dangerous.

The fix is to treat the expr evaluation as a failure and not
replace the constant Expr with a LiteralExpr.

Change-Id: I8243b2ee9fa9c470d078b385583f2f48b606a230
Reviewed-on: http://gerrit.cloudera.org:8080/5050
Reviewed-by: Alex Behm 
Tested-by: Internal Jenkins
---
M fe/src/main/java/org/apache/impala/analysis/LiteralExpr.java
M fe/src/main/java/org/apache/impala/analysis/NumericLiteral.java
M testdata/workloads/functional-planner/queries/PlannerTest/hdfs.test
3 files changed, 32 insertions(+), 3 deletions(-)

Approvals:
  Internal Jenkins: Verified
  Alex Behm: Looks good to me, approved



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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8243b2ee9fa9c470d078b385583f2f48b606a230
Gerrit-PatchSet: 6
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Alex Behm 
Gerrit-Reviewer: Alex Behm 
Gerrit-Reviewer: Dimitris Tsirogiannis 
Gerrit-Reviewer: Internal Jenkins
Gerrit-Reviewer: Marcel Kornacker 


[Impala-ASF-CR] IMPALA-4470: Avoid creating a NumericLiteral from NaN/infinity/-0.

2016-11-16 Thread Internal Jenkins (Code Review)
Internal Jenkins has posted comments on this change.

Change subject: IMPALA-4470: Avoid creating a NumericLiteral from 
NaN/infinity/-0.
..


Patch Set 5: Verified+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8243b2ee9fa9c470d078b385583f2f48b606a230
Gerrit-PatchSet: 5
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Alex Behm 
Gerrit-Reviewer: Alex Behm 
Gerrit-Reviewer: Dimitris Tsirogiannis 
Gerrit-Reviewer: Internal Jenkins
Gerrit-Reviewer: Marcel Kornacker 
Gerrit-HasComments: No


[Impala-ASF-CR] IMPALA-4470: Avoid creating a NumericLiteral from NaN/infinity/-0.

2016-11-16 Thread Internal Jenkins (Code Review)
Internal Jenkins has posted comments on this change.

Change subject: IMPALA-4470: Avoid creating a NumericLiteral from 
NaN/infinity/-0.
..


Patch Set 5:

Build failed: 
http://sandbox.jenkins.cloudera.com/job/impala-external-gerrit-verify-merge-ASF/484/

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8243b2ee9fa9c470d078b385583f2f48b606a230
Gerrit-PatchSet: 5
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Alex Behm 
Gerrit-Reviewer: Alex Behm 
Gerrit-Reviewer: Dimitris Tsirogiannis 
Gerrit-Reviewer: Internal Jenkins
Gerrit-Reviewer: Marcel Kornacker 
Gerrit-HasComments: No


[Impala-ASF-CR] IMPALA-4470: Avoid creating a NumericLiteral from NaN/infinity/-0.

2016-11-16 Thread Internal Jenkins (Code Review)
Internal Jenkins has posted comments on this change.

Change subject: IMPALA-4470: Avoid creating a NumericLiteral from 
NaN/infinity/-0.
..


Patch Set 5: Verified-1

Build failed: 
http://sandbox.jenkins.cloudera.com/job/impala-external-gerrit-verify-merge-ASF/482/

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8243b2ee9fa9c470d078b385583f2f48b606a230
Gerrit-PatchSet: 5
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Alex Behm 
Gerrit-Reviewer: Alex Behm 
Gerrit-Reviewer: Dimitris Tsirogiannis 
Gerrit-Reviewer: Internal Jenkins
Gerrit-Reviewer: Marcel Kornacker 
Gerrit-HasComments: No


[Impala-ASF-CR] IMPALA-4470: Avoid creating a NumericLiteral from NaN/infinity/-0.

2016-11-16 Thread Alex Behm (Code Review)
Hello Marcel Kornacker, Internal Jenkins, Dimitris Tsirogiannis,

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

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

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

Change subject: IMPALA-4470: Avoid creating a NumericLiteral from 
NaN/infinity/-0.
..

IMPALA-4470: Avoid creating a NumericLiteral from NaN/infinity/-0.

Our NumericLiteral is backed by a BigDecimal which cannot
represent the special float values NaN, infinity or negative zero.
As a result, when evaluating constant expressions from the FE we
hit an exception when trying to create a NumericLiteral from
a NaN or infinity value. Before, negative zero would silently
get converted to zero which is dangerous.

The fix is to treat the expr evaluation as a failure and not
replace the constant Expr with a LiteralExpr.

Change-Id: I8243b2ee9fa9c470d078b385583f2f48b606a230
---
M fe/src/main/java/org/apache/impala/analysis/LiteralExpr.java
M fe/src/main/java/org/apache/impala/analysis/NumericLiteral.java
M testdata/workloads/functional-planner/queries/PlannerTest/hdfs.test
3 files changed, 32 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/50/5050/5
-- 
To view, visit http://gerrit.cloudera.org:8080/5050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8243b2ee9fa9c470d078b385583f2f48b606a230
Gerrit-PatchSet: 5
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Alex Behm 
Gerrit-Reviewer: Alex Behm 
Gerrit-Reviewer: Dimitris Tsirogiannis 
Gerrit-Reviewer: Internal Jenkins
Gerrit-Reviewer: Marcel Kornacker 


[Impala-ASF-CR] IMPALA-4470: Avoid creating a NumericLiteral from NaN/infinity/-0.

2016-11-16 Thread Alex Behm (Code Review)
Alex Behm has posted comments on this change.

Change subject: IMPALA-4470: Avoid creating a NumericLiteral from 
NaN/infinity/-0.
..


Patch Set 5: Code-Review+2

fixed typo, rebase

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8243b2ee9fa9c470d078b385583f2f48b606a230
Gerrit-PatchSet: 5
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Alex Behm 
Gerrit-Reviewer: Alex Behm 
Gerrit-Reviewer: Dimitris Tsirogiannis 
Gerrit-Reviewer: Internal Jenkins
Gerrit-Reviewer: Marcel Kornacker 
Gerrit-HasComments: No


[Impala-ASF-CR] IMPALA-4470: Avoid creating a NumericLiteral from NaN/infinity/-0.

2016-11-15 Thread Internal Jenkins (Code Review)
Internal Jenkins has posted comments on this change.

Change subject: IMPALA-4470: Avoid creating a NumericLiteral from 
NaN/infinity/-0.
..


Patch Set 4: Verified-1

Build failed: 
http://sandbox.jenkins.cloudera.com/job/impala-external-gerrit-verify-merge-ASF/481/

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8243b2ee9fa9c470d078b385583f2f48b606a230
Gerrit-PatchSet: 4
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Alex Behm 
Gerrit-Reviewer: Alex Behm 
Gerrit-Reviewer: Dimitris Tsirogiannis 
Gerrit-Reviewer: Internal Jenkins
Gerrit-Reviewer: Marcel Kornacker 
Gerrit-HasComments: No


[Impala-ASF-CR] IMPALA-4470: Avoid creating a NumericLiteral from NaN/infinity/-0.

2016-11-15 Thread Alex Behm (Code Review)
Alex Behm has posted comments on this change.

Change subject: IMPALA-4470: Avoid creating a NumericLiteral from 
NaN/infinity/-0.
..


Patch Set 4: Code-Review+2

rebase

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8243b2ee9fa9c470d078b385583f2f48b606a230
Gerrit-PatchSet: 4
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Alex Behm 
Gerrit-Reviewer: Alex Behm 
Gerrit-Reviewer: Dimitris Tsirogiannis 
Gerrit-Reviewer: Marcel Kornacker 
Gerrit-HasComments: No


[Impala-ASF-CR] IMPALA-4470: Avoid creating a NumericLiteral from NaN/infinity/-0.

2016-11-15 Thread Dimitris Tsirogiannis (Code Review)
Dimitris Tsirogiannis has posted comments on this change.

Change subject: IMPALA-4470: Avoid creating a NumericLiteral from 
NaN/infinity/-0.
..


Patch Set 3:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/5050/2/fe/src/main/java/org/apache/impala/analysis/NumericLiteral.java
File fe/src/main/java/org/apache/impala/analysis/NumericLiteral.java:

PS2, Line 123: 1.0 / v < 0
> Yes, but the first part of the condition is v == 0, so I think this will on
Sorry maybe it wasn't clear. I was thinking if you could do something like 1.0 
/ v == Double.NEGATIVE_INFINITY.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8243b2ee9fa9c470d078b385583f2f48b606a230
Gerrit-PatchSet: 3
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Alex Behm 
Gerrit-Reviewer: Alex Behm 
Gerrit-Reviewer: Dimitris Tsirogiannis 
Gerrit-Reviewer: Marcel Kornacker 
Gerrit-HasComments: Yes


[Impala-ASF-CR] IMPALA-4470: Avoid creating a NumericLiteral from NaN/infinity/-0.

2016-11-15 Thread Alex Behm (Code Review)
Alex Behm has posted comments on this change.

Change subject: IMPALA-4470: Avoid creating a NumericLiteral from 
NaN/infinity/-0.
..


Patch Set 2:

(4 comments)

http://gerrit.cloudera.org:8080/#/c/5050/2/fe/src/main/java/org/apache/impala/analysis/NumericLiteral.java
File fe/src/main/java/org/apache/impala/analysis/NumericLiteral.java:

PS2, Line 39: BigDecmial
> typo: BigDecimal
Done


PS2, Line 39: A NumericLiteral is backed by a BigDecmial which cannot represent 
special float values
:  * like NaN, infinity, or negative zero.
> I think you can move this to the comment section for value_.
Done


PS2, Line 123: 1.0 / v < 0
> Isn't that NEGATIVE_INFINITY? Seems like a stronger check.
Yes, but the first part of the condition is v == 0, so I think this will only 
match negative zero.


http://gerrit.cloudera.org:8080/#/c/5050/2/testdata/workloads/functional-planner/queries/PlannerTest/hdfs.test
File testdata/workloads/functional-planner/queries/PlannerTest/hdfs.test:

PS2, Line 1012: 1 / 0 --> Infinity
> Add something with -0?
Exercising that code path today is actually surprisingly difficult. We need to 
get into a path where we evaluate a constant float/double expr from the FE. I 
could add a separate test, but that one would likely become obsolete very soon 
when adding constant folding.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8243b2ee9fa9c470d078b385583f2f48b606a230
Gerrit-PatchSet: 2
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Alex Behm 
Gerrit-Reviewer: Alex Behm 
Gerrit-Reviewer: Dimitris Tsirogiannis 
Gerrit-Reviewer: Marcel Kornacker 
Gerrit-HasComments: Yes


[Impala-ASF-CR] IMPALA-4470: Avoid creating a NumericLiteral from NaN/infinity/-0.

2016-11-15 Thread Dimitris Tsirogiannis (Code Review)
Dimitris Tsirogiannis has posted comments on this change.

Change subject: IMPALA-4470: Avoid creating a NumericLiteral from 
NaN/infinity/-0.
..


Patch Set 2:

(4 comments)

http://gerrit.cloudera.org:8080/#/c/5050/2/fe/src/main/java/org/apache/impala/analysis/NumericLiteral.java
File fe/src/main/java/org/apache/impala/analysis/NumericLiteral.java:

PS2, Line 39: BigDecmial
typo: BigDecimal


PS2, Line 39: A NumericLiteral is backed by a BigDecmial which cannot represent 
special float values
:  * like NaN, infinity, or negative zero.
I think you can move this to the comment section for value_.


PS2, Line 123: 1.0 / v < 0
Isn't that NEGATIVE_INFINITY? Seems like a stronger check.


http://gerrit.cloudera.org:8080/#/c/5050/2/testdata/workloads/functional-planner/queries/PlannerTest/hdfs.test
File testdata/workloads/functional-planner/queries/PlannerTest/hdfs.test:

PS2, Line 1012: 1 / 0 --> Infinity
Add something with -0?


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8243b2ee9fa9c470d078b385583f2f48b606a230
Gerrit-PatchSet: 2
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Alex Behm 
Gerrit-Reviewer: Alex Behm 
Gerrit-Reviewer: Dimitris Tsirogiannis 
Gerrit-Reviewer: Marcel Kornacker 
Gerrit-HasComments: Yes