druid/quidem-ut
Andy Tsai f3d7f1aa96
Adding 3 sets of SQL tests in quidem (#17548)
Description

Migrate the initial 3 sets of SQL tests to quidem.  These 3 sets cover numeric, string, and datetime scalar functions.
These tests use the existing kttm dataset.  They aim to exercise SQL queries in a more comprehensive way:

Each scalar function is exercised in 3 different query shapes:
  simple query
  subquery
  group by query
Each query covers all operators in its predicates.
All queries are select count(*) queries.  They are designed to all return the same result for easy maintenance and debugging.

These are the initial sets of tests.  More tests to cover the rest of the scalar and aggregation functions will come later.
2024-12-11 12:57:37 -08:00
..
src Adding 3 sets of SQL tests in quidem (#17548) 2024-12-11 12:57:37 -08:00
README.md Add kttm-nested dataset and some usage sessions of it (#16867) 2024-09-26 15:24:23 +05:30
pom.xml Add kttm-nested dataset and some usage sessions of it (#16867) 2024-09-26 15:24:23 +05:30

README.md

Quidem UT

Enables to write sql level tests easily. Can be used to write tests against existing test backends (ComponentSupplier) - by doing so the testcases can be moved closer to the exercised codes.

These tests might come from real usages of Druid by some external tool - by utilizing the capture mode of this module iq tests could be captured and validated later that they retain their results. By adding tests for those here could act as an early warning that something might have changed.

Usage

Install java&maven (if needed)

If you don't have java&maven - one way to set that up is by using sdkman like this:

# install sdkman
curl -s "https://get.sdkman.io" | bash
# at the end of installation either open a new terminal; or follow the instructions at the end

# install java&maven
sdk install java 11.0.23-zulu
sdk install maven

# run mvn to see if it works
mvn --version

# download druid sources
git clone https://github.com/apache/druid

Running these tests

  • CI execution happens by a standard JUnit test QTest in this module
  • the dev/quidem script can be used to run these tests (after the project is built)

Launching a test generating broker

  • make sure to build the project first; one way to do that is:
    mvn install -pl quidem-ut/ -am -DskipTests -Pskip-static-checks
    
  • launch the broker instance with:
    mvn exec:exec -pl quidem-ut -Dquidem.record.autostart=true
    
    • the broker will be running at http://localhost:12345
    • the used test configuration backend can configured by supplying quidem.uri
      mvn exec:exec -pl quidem-ut -Dquidem.uri=druidtest:///?componentSupplier=ThetaSketchComponentSupplier
      
    • new record files can be started by calling http://localhost:12345/quidem/start
      • if quidem.record.autostart is omitted recording will not start
  • after finished with the usage of the broker ; a new record-123.iq file will be in the project's worktree - it will contain all the executed statements
    • running dev/quidem -Dquidem.overwrite updates the resultsets of all iq files around there
    • rename the testfile to have a more descriptive name