Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL: aliased FLOOR and CEIL functions fail with NPE #49556

Closed
astefan opened this issue Nov 25, 2019 · 2 comments · Fixed by #49644
Closed

SQL: aliased FLOOR and CEIL functions fail with NPE #49556

astefan opened this issue Nov 25, 2019 · 2 comments · Fixed by #49644
Assignees
Labels

Comments

@astefan
Copy link
Contributor

astefan commented Nov 25, 2019

SELECT FLOOR(CAST(NULL AS DOUBLE)) AS x FROM test_emp

results in

java.lang.NullPointerException: null
        at org.elasticsearch.xpack.sql.expression.function.scalar.math.Floor.fold(Floor.java:36) ~[?:?]
        at org.elasticsearch.xpack.sql.expression.NamedExpression.asPipe(NamedExpression.java:56) ~[?:?]
        at org.elasticsearch.xpack.sql.expression.function.scalar.ScalarFunction.toAttribute(ScalarFunction.java:39) ~[?:?]
        at org.elasticsearch.xpack.sql.expression.function.scalar.ScalarFunction.toAttribute(ScalarFunction.java:23) ~[?:?]
        at org.elasticsearch.xpack.sql.expression.Expressions.attribute(Expressions.java:150) ~[?:?]
        at org.elasticsearch.xpack.sql.expression.Alias.createAttribute(Alias.java:109) ~[?:?]
        at org.elasticsearch.xpack.sql.expression.Alias.toAttribute(Alias.java:95) ~[?:?]
        at org.elasticsearch.xpack.sql.optimizer.Optimizer$ReplaceFoldableAttributes.lambda$rule$0(Optimizer.java:1143) ~[?:?]
        at org.elasticsearch.xpack.sql.tree.Node.lambda$forEachDown$1(Node.java:74) ~[?:?]
        at org.elasticsearch.xpack.sql.tree.Node.forEachDown(Node.java:66) ~[?:?]
        at org.elasticsearch.xpack.sql.tree.Node.forEachDown(Node.java:72) ~[?:?]
        at org.elasticsearch.xpack.sql.optimizer.Optimizer$ReplaceFoldableAttributes.rule(Optimizer.java:1139) ~[?:?]
        at org.elasticsearch.xpack.sql.optimizer.Optimizer$ReplaceFoldableAttributes.apply(Optimizer.java:1130) ~[?:?]
        at org.elasticsearch.xpack.sql.optimizer.Optimizer$ReplaceFoldableAttributes.apply(Optimizer.java:1126) ~[?:?]
        at org.elasticsearch.xpack.sql.rule.RuleExecutor$Transformation.<init>(RuleExecutor.java:82) ~[?:?]
        at org.elasticsearch.xpack.sql.rule.RuleExecutor.executeWithInfo(RuleExecutor.java:158) ~[?:?]
        at org.elasticsearch.xpack.sql.rule.RuleExecutor.execute(RuleExecutor.java:130) ~[?:?]
        at org.elasticsearch.xpack.sql.optimizer.Optimizer.optimize(Optimizer.java:122) ~[?:?]
        at org.elasticsearch.xpack.sql.session.SqlSession.lambda$optimizedPlan$3(SqlSession.java:156) ~[?:?]
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (:Search/SQL)

@astefan
Copy link
Contributor Author

astefan commented Dec 3, 2019

master (8.0.0): 034f4cf
7.x (7.6.0): astefan@34311dd
7.5 (7.5.1): 311867e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants