Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

IS NOT NULL with alias throws SemanticCheckException #1145

Open
ankurgupta4891 opened this issue Nov 18, 2021 · 3 comments
Open

IS NOT NULL with alias throws SemanticCheckException #1145

ankurgupta4891 opened this issue Nov 18, 2021 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@ankurgupta4891
Copy link

ankurgupta4891 commented Nov 18, 2021

Using IS NOT NULL with alias throws SemanticCheckException.

Example query:

SELECT dest_city_name AS dc
FROM all_flights
WHERE dc IS NOT NULL

Error:

Caused by: org.opensearch.jdbc.protocol.http.HttpException: HTTP Code: 400. Message: Bad Request. Raw response received: {
  "error": {
    "reason": "Invalid SQL query",
    "details": "can't resolve Symbol(namespace=FIELD_NAME, name=dc) in type env",
    "type": "SemanticCheckException"
  },
  "status": 400
}
@anirudha anirudha added the bug Something isn't working label Nov 18, 2021
@penghuo
Copy link
Contributor

penghuo commented Nov 18, 2021

Could you try this?

SELECT dest_city_name AS dc
FROM all_flights
WHERE dest_city_name IS NOT NULL

dc is output symbol, only symbol defined in all_flights visible to SQL engine when analyze WHERE statement, so exception throw.

@anirudha
Copy link
Contributor

@ankurgupta4891 pls create issues in this repo : https://github.com/opensearch-project/sql

@ankurgupta4891
Copy link
Author

@anirudha I created this issue under opensearch-project/sql repo -> opensearch-project/sql#292

@penghuo Yes it works when I use actual symbol name. I tried to give simple version of our use case but we need to get alias support with IS NOT NULL check. Is it not possible to process output symbol to get actual symbol?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants