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] Analyzer should report error for mismatch between select and group by items #910

Open
GumpacG opened this issue Oct 12, 2022 · 3 comments
Assignees
Labels
bug Something isn't working SQL

Comments

@GumpacG
Copy link
Collaborator

GumpacG commented Oct 12, 2022

What is the bug?
Analyzer does not report a SemanticCheckException when there is a mismatch between select and group by items.

How can one reproduce the bug?
Steps to reproduce the behavior:

  1. Query SELECT str0 FROM calcs GROUP BY str1;

What is the expected behavior?
A SemanticCheckException should be thrown with the message "Expression [str0] that contains non-aggregated column is not present in group by clause" as shown in the test should_report_error_for_mismatch_between_select_and_group_by_items in https://github.com/opensearch-project/sql/blob/2.x/sql/src/test/java/org/opensearch/sql/sql/parser/AstAggregationBuilderTest.java.

What is your host/environment?

  • OS: macOS
  • Version: OpenSearch 2.x

Do you have any additional context?
The test should be enabled once this has been fixed/implemented.

@GumpacG GumpacG added bug Something isn't working untriaged labels Oct 12, 2022
@Yury-Fridlyand
Copy link
Collaborator

mysql> SELECT str0 FROM calcs GROUP BY str1;
ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'TDVT.calcs.str0' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

MaxKsyunz pushed a commit that referenced this issue Oct 28, 2022
- Enabled ignored and disabled tests.
- Created #922, #917, #912, #910 and attached them to disabled tests for traceability.
- Removed irrelevant tests.
@dai-chen dai-chen added the v2.5.0 'Issues and PRs related to version v2.5.0' label Dec 12, 2022
@dai-chen dai-chen self-assigned this Dec 14, 2022
@dai-chen
Copy link
Collaborator

Duplicate as #258 ?

@Yury-Fridlyand
Copy link
Collaborator

Duplicate as #258 ?

Oh, may be. I'm not sure, need to test/debug both.

@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 SQL
Projects
None yet
Development

No branches or pull requests

3 participants