Real-time analytics database. Java, Maven, multi-module project.
processing/: Core query processing, aggregation, data structuresserver/: Common server functionality, HTTP servicessql/: SQL planning (Calcite), SQL-to-native translationindexing-service/: Task framework, ingestion coordinationmulti-stage-query/: MSQ engineextensions-core/: Core extensions (S3, Kafka, Kinesis, Parquet, DataSketches, etc.)web-console/: React/TypeScript management UIquidem-ut/: SQL query testing framework
- Read
dev/style-conventions.mdfor conventions. - Forbidden APIs:
codestyle/druid-forbidden-apis.txt. - Always use
finalfor fields and variables that are not reassigned. - End every file with a newline.
- Don't format changes unnecessarily.
When adding or migrating tests, reuse these existing test-scope helpers:
-
TemporaryFolderExtension(org.apache.druid.testing) for tests that need a Druid-managedFiletemporary directory:@RegisterExtension public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
Use
getRoot(),newFolder(...), ornewFile(...). PreferTemporaryFolderExtensionwhen Druid-specific temporary-directory behavior or helper methods are needed; use JUnit 5@TempDirwhen a plain temporary root is sufficient. -
LoggerCaptureExtension(org.apache.druid.testing.junit) for capturing Log4j events. Register it with the target class and usegetLogEvents(),clearLogEvents(), orawaitLogEvents()as needed.
- Before opening a PR, self-review the complete diff against the target branch. Verify that every change is intentional and in scope, check for correctness and regressions, and run the relevant tests or checks.
- PR titles targeting
mastermust use the Conventional Commits format:<type>: <description>or<type>(<scope>): <description>. - For a breaking change, add
!immediately before the colon:<type>!: <description>or<type>(<scope>)!: <description>. A breaking change is backward-incompatible and may require users to update existing code, configuration, or integrations. - Accepted types are
backport,build,ci,dev,docs,feat,fix,minor,perf,refactor,release,revert,style, andtest. - Example:
build: remove redundant license download step. - Follow
.github/pull_request_template.mdwhen preparing the PR description.
Use these flags for faster tests: -Pskip-static-checks -Dweb.console.skip=true
Single test method:
mvn test -pl sql -am -Dtest="org.apache.druid.sql.calcite.CalciteQueryTest#testFoo" -Dsurefire.failIfNoSpecifiedTests=false -Pskip-static-checks -Dweb.console.skip=true
All tests in a package:
mvn test -pl sql -am -Dtest="org.apache.druid.sql.**" -Dsurefire.failIfNoSpecifiedTests=false -Pskip-static-checks -Dweb.console.skip=true
Quidem (.iq) tests:
To run sql/src/test/quidem/org.apache.druid.quidem.SqlQuidemTest/numMerge.iq:
mvn test -pl sql -am -Dtest="org.apache.druid.quidem.SqlQuidemTest" -Dquidem.filter=numMerge -Dsurefire.failIfNoSpecifiedTests=false -Pskip-static-checks -Dweb.console.skip=true
To run quidem-ut/src/test/quidem/org.apache.druid.quidem.QTest/qaWin/basics_group_by.all.iq:
mvn test -pl quidem-ut -am -Dtest="org.apache.druid.quidem.QTest" -Dquidem.filter=qaWin/basics_group_by.all -Dsurefire.failIfNoSpecifiedTests=false -Pskip-static-checks -Dweb.console.skip=true
Always use -Dquidem.filter to avoid running the full suite. To run multiple tests, use commas like
-Dquidem.filter=file1,file2,file3 or use wildcards like -Dquidem.filter=join*. Include subdirectory names if
present, such as -Dquidem.filter=qaWin/**.
Refer to web-console/README.md for general instructions on developing the web console.
Run npm run test-unit from the web-console/ directory to verify your work. Before doing this for the first time
in a fresh checkout, you will also need to run npm install.
Run npm run autofix from the web-console/ directory to fix formatting issues.
- When updating Markdown tables in
docs/, preserve the existing table formatting. - Use backquotes for any code references. e.g.,
serverPriorityToReplicas,ioConfig. - Run
npm run spellcheckfrom thewebsite/directory to verify doc updates and update the.spellingfile if needed.