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 keeping an eval literal, but nothing from the index itself #98404

Closed
astefan opened this issue Aug 11, 2023 · 8 comments · Fixed by #98759
Closed

ESQL: NPE when keeping an eval literal, but nothing from the index itself #98404

astefan opened this issue Aug 11, 2023 · 8 comments · Fixed by #98759
Assignees
Labels
:Analytics/ES|QL AKA ESQL >bug Team:QL (Deprecated) Meta label for query languages team

Comments

@astefan
Copy link
Contributor

astefan commented Aug 11, 2023

Description

from employees | eval x = 1 | keep x results in

Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because the return value of "org.elasticsearch.xpack.esql.planner.Layout.getChannel(org.elasticsearch.xpack.ql.expression.NameId)" is null
        at org.elasticsearch.xpack.esql.planner.LocalExecutionPlanner.alignPageToAttributes(LocalExecutionPlanner.java:281)
        at org.elasticsearch.xpack.esql.planner.LocalExecutionPlanner.planExchangeSink(LocalExecutionPlanner.java:305)
        at org.elasticsearch.xpack.esql.planner.LocalExecutionPlanner.plan(LocalExecutionPlanner.java:199)
        at org.elasticsearch.xpack.esql.planner.LocalExecutionPlanner.plan(LocalExecutionPlanner.java:146)
        at org.elasticsearch.xpack.esql.plugin.ComputeService.runCompute(ComputeService.java:246)
        at org.elasticsearch.xpack.esql.plugin.ComputeService$DataNodeRequestHandler.lambda$messageReceived$5(ComputeService.java:415)
        at org.elasticsearch.server@8.10.0-SNAPSHOT/org.elasticsearch.action.ActionListener$2.onResponse(ActionListener.java:177)
        at org.elasticsearch.server@8.10.0-SNAPSHOT/org.elasticsearch.action.ActionListener.completeWith(ActionListener.java:305)
        at org.elasticsearch.xpack.esql.plugin.ComputeService.lambda$acquireSearchContexts$13(ComputeService.java:280)
        at org.elasticsearch.server@8.10.0-SNAPSHOT/org.elasticsearch.index.shard.IndexShard.ensureShardSearchActive(IndexShard.java:3911)
        at org.elasticsearch.xpack.esql.plugin.ComputeService.acquireSearchContexts(ComputeService.java:278)
        at org.elasticsearch.xpack.esql.plugin.ComputeService$DataNodeRequestHandler.messageReceived(ComputeService.java:413)
        at org.elasticsearch.xpack.esql.plugin.ComputeService$DataNodeRequestHandler.messageReceived(ComputeService.java:405)
        at org.elasticsearch.server@8.10.0-SNAPSHOT/org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:74)
        at org.elasticsearch.server@8.10.0-SNAPSHOT/org.elasticsearch.transport.TransportService$6.doRun(TransportService.java:1023)
        at org.elasticsearch.server@8.10.0-SNAPSHOT/org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:983)
        at org.elasticsearch.server@8.10.0-SNAPSHOT/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
        at org.elasticsearch.server@8.10.0-SNAPSHOT/org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33)
        at org.elasticsearch.server@8.10.0-SNAPSHOT/org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:983)
        at org.elasticsearch.server@8.10.0-SNAPSHOT/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1623)
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-ql (Team:QL)

@elasticsearchmachine elasticsearchmachine added the Team:QL (Deprecated) Meta label for query languages team label Aug 11, 2023
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/elasticsearch-esql (:Query Languages/ES|QL)

@aku019
Copy link

aku019 commented Aug 13, 2023

Is it open? Can I take it up? I am a beginner so will it be too overwhelming for me?

@astefan
Copy link
Contributor Author

astefan commented Aug 14, 2023

Hi @aku019. Thank you for your interest. This one might be a bit too complicated for a beginner.

@aku019
Copy link

aku019 commented Aug 14, 2023

hi @astefan , thanks for your reply.. are you aware of any issue which I can take up otherwise?

@costin
Copy link
Member

costin commented Aug 18, 2023

Could not reproduce the bug on main (at 44e6134 or 001fcfb)

@luigidellaquila
Copy link
Contributor

The problem is still there actually, just not reproducible with CsvTests due to different execution path.

Same failure happens with

from idx | limit 10 | eval x = 1 | stats count(x)

@costin costin self-assigned this Aug 22, 2023
@costin
Copy link
Member

costin commented Aug 22, 2023

The issue is the above is a local plan however it is not identified as such and ends up being executed. Because none of the values are used from the local plan, no project is put in place which triggers another failure in the number of attributes expected.
There are two immediate fixes (from the top of my head) that I'll look into:

costin added a commit to costin/elasticsearch that referenced this issue Aug 23, 2023
Improve ProjectAwayColumns rule to take into account queries that don't
 return the actual values of the underlying data rather just care about
 the number of entries returned.

Fix elastic#98404
costin added a commit to costin/elasticsearch that referenced this issue Aug 23, 2023
Improve ProjectAwayColumns rule to take into account queries that don't
 return the actual values of the underlying data rather just care about
 the number of entries returned.

Fix elastic#98404
costin added a commit to costin/elasticsearch that referenced this issue Aug 23, 2023
Improve ProjectAwayColumns rule to take into account queries that don't
 return the actual values of the underlying data rather just care about
 the number of entries returned.

Fix elastic#98404
costin added a commit to costin/elasticsearch that referenced this issue Aug 23, 2023
Improve ProjectAwayColumns rule to take into account queries that don't
 return the actual values of the underlying data rather just care about
 the number of entries returned.

Fix elastic#98404
costin added a commit to costin/elasticsearch that referenced this issue Aug 23, 2023
Improve ProjectAwayColumns rule to take into account queries that don't
 return the actual values of the underlying data rather just care about
 the number of entries returned.

Fix elastic#98404
costin added a commit to costin/elasticsearch that referenced this issue Aug 23, 2023
Improve ProjectAwayColumns rule to take into account queries that don't
 return the actual values of the underlying data rather just care about
 the number of entries returned.

Fix elastic#98404
costin added a commit to costin/elasticsearch that referenced this issue Aug 23, 2023
Improve ProjectAwayColumns rule to take into account queries that don't
 return the actual values of the underlying data rather just care about
 the number of entries returned.

Fix elastic#98404
costin added a commit that referenced this issue Aug 23, 2023
Improve ProjectAwayColumns rule to take into account queries that don't
 return the actual values of the underlying data rather just care about
 the number of entries returned.

Fix #98404
dreamquster pushed a commit to dreamquster/elasticsearch that referenced this issue Aug 26, 2023
)

Improve ProjectAwayColumns rule to take into account queries that don't
 return the actual values of the underlying data rather just care about
 the number of entries returned.

Fix elastic#98404
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:QL (Deprecated) Meta label for query languages team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants