-
Notifications
You must be signed in to change notification settings - Fork 146
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
[BUG] IS NOT NULL with alias throws SemanticCheckException #292
Comments
Thanks for reporting issue. Currently we doesn't support use alias in where clause. One workaround should be
|
@ankurgupta4891 In opendistro-for-elasticsearch/sql#1145, you mentioned, "I tried to give simple version of our use case but we need to get alias support with IS NOT NULL" Could you share your use case? Are u using tools to auto generate query? |
confirmed offline. Query is auto generated. Next StepWe need to evaluate the tech solution. The challenge is that SQL statements is analyzed in predefined order of, FROM -> WHERE -> SELECT, alias defined in SELECT which is not visible to WHERE clause. |
Hey team,
Could you help and check as well? |
@jingyali-apr Thanks for reporting the issue! Could you share your index mapping and some test data for investigation? And it would be helpful if you can find error stacktrace in ES log. |
Hey @dai-chen, please check below samples. Successful case without
Failed case with
Successful case without using alias
Partial test data:
Thanks |
@jingyali-apr Could you try to use the original field name in
|
Yeah, I tried this and it worked. See my |
@jingyali-apr Thanks for confirming! I may have found where things go wrong:
When we try to replace alias in |
https://stackoverflow.com/a/942592
Copied from MySQL documentation |
Note that was the [Wayback/Archive] MySQL :: MySQL 5.1 Reference Manual :: B.5.5.4 Problems with Column Aliases documentation until December 2009. After that it got rephrased (including "doesn't allow" to "disallow", "alias" to "aliases", "code" to "clause) and still is in the current form at [Wayback/Archive] MySQL :: MySQL 8.0 Reference Manual :: B.3.4.4 Problems with Column Aliases:
|
Describe the bug
Using
IS NOT NULL
with alias throws SemanticCheckException.To Reproduce
Sample query:
Expected behavior
Should be same as query:
The text was updated successfully, but these errors were encountered: