Repository navigation
feat(msq): execute system tables with Dart - #213
Open
FrankChen021 wants to merge 30 commits into
Open
FrankChen021 wants to merge 30 commits into
FrankChen021 wants to merge 30 commits into
Conversation
FrankChen021
commented
Sep 28, 2026
…tables-standalone # Conflicts: # docs/querying/dart.md # services/src/main/java/org/apache/druid/cli/CliPeon.java
A limited sequence nested inside a concatenated sequence leaves the row cursor on a null row once the limit is reached, so an unfiltered LIMIT query over a co-located system table source failed with a NullPointerException. Apply the limit once to the concatenated rows instead.
Drop tests that pass without the feature or only assert constants, merge redundant cases, assert returned rows in the slice reader tests, tag the benchmark as perf, and add coverage for the system table datasource, node-local query routing, limit handling and row authorization.
The handler runs the Scan engine directly, bypassing the Scan tool chest that normally widens the limit and skips the offset rows, so a node-local Scan with an offset returned the leading rows. Apply the offset the same way the tool chest does.
The hints are derived from the root query, whose filter, virtual columns and required columns describe the output of the datasource tree. Over an UNNEST or other wrapped datasource they pruned columns the unnest expression reads and pushed filters on the unnest output to the nodes, silently returning wrong results.
…uery-parse handler A failure while the Router's local container handled a node-local request, such as a client disconnect, was caught by the query-parse handlers, logged as an unparseable query and answered as one. Dispatch after parsing completes, and remove the node-local cancellation dispatch, which is no longer used. Also remove QueryablePeonModule, which Peon and Indexer no longer install.
…ata server queries Node-local system table scans are not registered with the QueryScheduler, so the explicit cancel request was a no-op that only logged a warning on the node; aborting the in-flight request is what stops it. Also skip the cancel when the response already failed or the query has no id, which previously sent a spurious request or threw from the closer.
…rror rows Only socket-level failures became per-node error rows, so a node that answered with an error, notably an older node during a rolling upgrade that does not know the system table datasource, failed the whole query. Treat service-unavailable errors and non-authorization HTTP errors as node failures too.
A server with no segments to query, such as one that only serves node-local system table queries, failed with a NullPointerException when sent another query.
…lice input handling A Broker relayed controller messages from every Broker although only its own embedded worker takes part in its queries. Also close all remote requests of a slice even if one close fails, request one column from remote nodes for row-count-only stages instead of all columns, and treat a missing limit in the serialized input as unlimited.
…les-standalone # Conflicts: # multi-stage-query/src/main/java/org/apache/druid/msq/dart/controller/DartControllerContext.java # multi-stage-query/src/main/java/org/apache/druid/msq/dart/guice/DartWorkerModule.java # multi-stage-query/src/test/java/org/apache/druid/msq/dart/controller/DartControllerContextTest.java
…le descriptor The engine hard-coded STATE READ for every system table while the descriptor's row authorizer was the real policy, and DartQueryMaker re-checked it at run time by passing an empty row list to the authorizer, which only worked because the authorizer checks eagerly. Add getResourceActions() to the descriptor and have the engine return it, so the caller is authorized once, when the SQL statement is authorized and before any work is dispatched.
…atic analysis Checkstyle rejected an unused java.util.Collections import left behind in ServerPropertiesTableDescriptor, and CodeQL flagged two parameterized-test descriptions as unused; use them as assertion messages.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
System tables currently use Calcite's local Bindable path, which prevents Dart from applying its distributed query stages and native operators. This change introduces the system-table datasource and MSQ input needed to execute
sys.server_propertiesthrough Dart as an initial implementation.Execution path and query planning
Show execution details
SystemTableDataSourceand a planner bridge for native-capable system-table definitions.sys.server_propertiesas the only Dart-capable table in this change.ORDER BYretain the standard global-sort path.sys.server_propertiesqueryable when no Historical is available.Benchmark
ServerPropertiesEngineBenchmarkprovides a reproducible standalone benchmark of this Dart path. For the cross-engine comparison below, the same harness was run from a combined checkout containing both this change and the native system-table implementation from apache/druid#20183. The native leg usedengine=nativewithuseNativeQueryForSystemTables=true; the Dart leg usedengine=msq-dart. Both ran in the same embedded cluster over the same 100,001 generated properties, with 3 warmup iterations followed by 10 measured iterations and alternating engine order.COUNT(*)andCOUNT(DISTINCT property)over 100,001 matching rowsSELECT * FROM sys.server_propertiesreturning 100,047 rowsThe master Bindable system-table path is not the native baseline: it cannot plan the
COUNT(DISTINCT property)workload. The full scan includes 46 ordinary embedded-server properties in addition to the generated benchmark properties. These figures are local embedded-cluster latency measurements rather than production throughput results.Release note
Dart can now execute SQL queries over
sys.server_properties, including distributed filtering, aggregation, ordering, and window processing. Other system tables continue to use the existing Bindable execution path.Key changed/added classes in this PR
SystemTableDataSourceSystemTableDataSourcePlannerDartSystemTableInputSpecSlicerDartSystemTableInputSliceReaderDartEmbeddedWorkerModuleThis PR has: