Skip to content

Add more sql tests for groupby queries#11454

Merged
jihoonson merged 6 commits intoapache:masterfrom
jihoonson:groupby-tests
Jul 21, 2021
Merged

Add more sql tests for groupby queries#11454
jihoonson merged 6 commits intoapache:masterfrom
jihoonson:groupby-tests

Conversation

@jihoonson
Copy link
Copy Markdown
Contributor

Description

#11379 makes group by queries faster by making a better query plan. This PR adds more unit tests to cover some basic cases where the optimization in #11379 can affect.


This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

Copy link
Copy Markdown
Contributor

@suneet-s suneet-s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the tests - LGTM

Just a comment about deciding where the tests should live. Reading this PR I can't tell why some tests should live in 1 class vs another

import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(JUnitParamsRunner.class)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any parameterized tests in this class

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch 👍

import org.junit.runner.RunWith;

@RunWith(JUnitParamsRunner.class)
public class CalciteSimpleQueryTest extends BaseCalciteQueryTest
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a doc somewhere that talks about the difference between CalciteQueryTest and CalciteSimpleQueryTest.

As a naive developer - which tests should live in which class and how would I know where to put my new tests

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some simple javadocs. The reason I added this new class is CalciteQueryTest is getting bigger and bigger and now it hits almost 20000 lines. This makes it hard to tell what SQL patterns are covered by our tests. I haven't moved existing tests in this PR because moving them will make hard to see what are new tests and what are not. I will create a follow-up PR to move them and split CalciteQueryTest further.

Copy link
Copy Markdown
Contributor

@suneet-s suneet-s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jihoonson ! LGTM after CI

@suneet-s
Copy link
Copy Markdown
Contributor

checkstyle failure looks legit

[ERROR] /home/travis/build/apache/druid/sql/src/test/java/org/apache/druid/sql/calcite/BaseCalciteQueryTest.java:101:8: Unused import - java.io.File. [UnusedImports]

@jihoonson jihoonson merged commit 84c957f into apache:master Jul 21, 2021
@jihoonson
Copy link
Copy Markdown
Contributor Author

@suneet-s thanks for the review!

@clintropolis clintropolis added this to the 0.22.0 milestone Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants