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

[BUG] Multiplication in queries are treated as an alias #265

Open
ghost opened this issue Nov 4, 2021 · 2 comments
Open

[BUG] Multiplication in queries are treated as an alias #265

ghost opened this issue Nov 4, 2021 · 2 comments
Labels
bug Something isn't working legacy Issues related to legacy query engine to be deprecated SQL tdvt Tableau test framework

Comments

@ghost
Copy link

ghost commented Nov 4, 2021

Describe the bug
Multiplication in queries are treated as an alias if there is no space between * and the value.

Or for query issues:

  1. 'SELECT 1*1'
  2. See result of 1 with alias *1

Expected behavior
The result should be 1 similar to result of the query 'SELECT 1/1'

Screenshots
image
image
image

Additional context
'SELECT 1 * 1' works however when TDVT testing, generated queries do not include a space between * and the second value.

@ghost ghost added Beta bug Something isn't working untriaged labels Nov 4, 2021
@chloe-zh chloe-zh added SQL and removed Beta labels Nov 13, 2021
@chloe-zh
Copy link
Contributor

Thanks for reporting this issue, this seems due to unhandled corner cases for the parsers. We will give it a fix once we have resources.

@joshuali925 joshuali925 added the tdvt Tableau test framework label Nov 24, 2021
@anirudha anirudha removed the untriaged label Apr 7, 2022
@MaxKsyunz MaxKsyunz changed the title Multiplication in queries are treated as an alias[BUG] [BUG] Multiplication in queries are treated as an alias Sep 27, 2022
@MaxKsyunz MaxKsyunz added the legacy Issues related to legacy query engine to be deprecated label Sep 27, 2022
@acarbonetto
Copy link
Collaborator

@dai-chen @penghuo
@GabeFernandez310 has pushed changes to the parser to accommodate index names that included non-SQL characters: Bit-Quill#128

The current strategy uses state to save whether we're in a FROM clause or not (all other clauses use the default state... more on this below). The state is exited when the index name token is parsed. So, only in this state can we accept non-sql characters in the identifier. A cleaner solution would be to save states for each clause, but that's a major change.

The parser only fails in unique cases where the test has sub-queries. We need to find out how to accommodate sub-queries, and it seems like the best strategy would be to save state in modes as a stack (push state when entering the sub-query, exit state when we exit the sub-query).

See test output for review: https://github.com/Bit-Quill/opensearch-project-sql/actions/runs/3268789572

@dai-chen dai-chen self-assigned this Dec 14, 2022
@dai-chen dai-chen added the v2.5.0 'Issues and PRs related to version v2.5.0' label Dec 14, 2022
@dai-chen dai-chen removed their assignment Dec 14, 2022
@dai-chen dai-chen removed the v2.5.0 'Issues and PRs related to version v2.5.0' label Jan 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working legacy Issues related to legacy query engine to be deprecated SQL tdvt Tableau test framework
Projects
No open projects
Status: No status
Development

No branches or pull requests

6 participants