-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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: COUNT() makes a function resolution in WHERE clause to fail #41951
Comments
Pinging @elastic/es-search |
@imotov this is fixed with my proposed solution.
but the issue #41413, is not solved, there is still something I am missing! |
@codebird is there a PR with your proposed solution? |
nope didn't do a PR, because it doesn't solve #41413, I just wanted some input on the approach. https://github.com/elastic/elasticsearch/compare/master...codebird:issue%2341413?expand=1 Here's the code if you want to check it. |
@codebird thanks! I think it would greatly simplify the feedback process if you could sign CLA and open a PR for this fix (assuming that you want it to be eventually merged into elasticsearch). |
Oh I have already signed the CLA. I'll make a pull request and reference this issue and 41413 as they are closely related |
Translate to an agg query even if only literals are selected, so that the correct number of rows is returned (number of buckets). Fix issue with key only in GROUP BY (not in select) and WHERE clause: Resolve aggregates and groupings based on the child plan which holds the info info for all the fields of the underlying table. Fixes: #41951 Fixes: #41413 (cherry picked from commit 45b8580)
Translate to an agg query even if only literals are selected, so that the correct number of rows is returned (number of buckets). Fix issue with key only in GROUP BY (not in select) and WHERE clause: Resolve aggregates and groupings based on the child plan which holds the info info for all the fields of the underlying table. Fixes: #41951 Fixes: #41413 (cherry picked from commit 45b8580)
A single
COUNT(*)
in the select portion prevents the field attribute resolution in WHERE clauseThe query above fails wtth the following error:
However if we add something besides
COUNT(*)
to the select clause, it works:Removing the function for the WHERE clause also works:
This issue might be related to #41413 but the use case seems to be quite different since it requires calling a function in WHERE and doesn't use a literal.
The text was updated successfully, but these errors were encountered: