opensearch-project / opensearch-project/sql

[BUG] Analyzer should report error for mismatch between select and group by items

Open
#910 3 comments 0 reactions 1 assignee View on GitHub

@dai-chen is already working on this.

Since Dec 14, 2022.

bug SQL
Dominant language
Java
Stars
176
Forks
229
Avg merge
2d 21h
Merged PRs (30d)
43

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.