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

ESQL: NPE when converting NULL in IN clause #119950

Open
bpintea opened this issue Jan 10, 2025 · 2 comments
Open

ESQL: NPE when converting NULL in IN clause #119950

bpintea opened this issue Jan 10, 2025 · 2 comments
Labels
:Analytics/ES|QL AKA ESQL >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)

Comments

@bpintea
Copy link
Contributor

bpintea commented Jan 10, 2025

Description

A corner case.

This works:

ROW x = NULL | EVAL x::INT

Also this:

FROM employees | WHERE emp_no IN (10001, NULL)

But this:

FROM employees | WHERE emp_no IN (10001, NULL::INT)

fails with a query_shard_exception NPE:

Caused by: java.lang.NullPointerException: Cannot invoke \"Object.toString()\" because \"value\" is null
	at [email protected]/org.elasticsearch.index.mapper.NumberFieldMapper$NumberType.objectToDouble(NumberFieldMapper.java:1493)
	at [email protected]/org.elasticsearch.index.mapper.NumberFieldMapper$NumberType$6.parse(NumberFieldMapper.java:1035)
	at [email protected]/org.elasticsearch.index.mapper.NumberFieldMapper$NumberType$6.termsQuery(NumberFieldMapper.java:1090)
	at [email protected]/org.elasticsearch.index.mapper.NumberFieldMapper$NumberFieldType.termsQuery(NumberFieldMapper.java:1733)
	at [email protected]/org.elasticsearch.index.query.TermsQueryBuilder.doToQuery(TermsQueryBuilder.java:347)
	at [email protected]/org.elasticsearch.index.query.AbstractQueryBuilder.toQuery(AbstractQueryBuilder.java:119)
	at org.elasticsearch.xpack.esql.querydsl.query.SingleValueQuery$Builder.doToQuery(SingleValueQuery.java:187)
	at [email protected]/org.elasticsearch.index.query.AbstractQueryBuilder.toQuery(AbstractQueryBuilder.java:119)
	at [email protected]/org.elasticsearch.index.query.SearchExecutionContext.toQuery(SearchExecutionContext.java:559)
	... 123 more
@bpintea bpintea changed the title ESQL: NPE when converting NULL to DATETIMEsin IN clause ESQL: NPE when converting NULL to DATETIME in IN clause Jan 10, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Jan 10, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

@bpintea bpintea changed the title ESQL: NPE when converting NULL to DATETIME in IN clause ESQL: NPE when converting NULL in IN clause Jan 10, 2025
@DHRUV6029
Copy link

@ncdc @dysinger @AndrewO can i work on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)
Projects
None yet
Development

No branches or pull requests

3 participants