xiangfu0 opened a new pull request, #18648:
URL: https://github.com/apache/pinot/pull/18648

   ## What changed
   
   This PR propagates the distinct early-termination partial-result flags 
through multi-stage query responses.
   
   - Maps single-stage leaf `EARLY_TERMINATION_REASON` metadata into MSQ leaf 
stats.
   - Adds the three distinct early-termination flags to 
`BrokerResponseNativeV2` and includes them in `partialResult`.
   - Enforces the same distinct early-termination query options in native MSQ 
distinct aggregation.
   - Merges aggregate distinct early-termination stats into the V2 broker 
response.
   - Adds focused coverage for both SSE leaf bridge propagation and native MSQ 
distinct early termination.
   
   ## Why
   
   PR #17247 added distinct early-termination query options for single-stage 
execution, but MSQ responses did not surface the corresponding partial-response 
flags. The leaf operator ignored `EARLY_TERMINATION_REASON`, and native MSQ 
distinct had no equivalent stats path into `BrokerResponseNativeV2`.
   
   ## User manual
   
   For multi-stage queries using `SELECT DISTINCT`, the following query options 
now mark the query response as partial when they terminate distinct processing 
early:
   
   | Query option | Response flag |
   | --- | --- |
   | `maxRowsInDistinct` | `maxRowsInDistinctReached` |
   | `maxRowsWithoutChangeInDistinct` | `maxRowsWithoutChangeInDistinctReached` 
|
   | `maxExecutionTimeMsInDistinct` | `maxExecutionTimeInDistinctReached` |
   
   When any of these flags is set, `partialResult` is also `true`.
   
   Sample MSQ queries:
   
   ```sql
   SET "useMultistageEngine" = true;
   SET "maxRowsInDistinct" = 1000;
   SELECT DISTINCT userId FROM events;
   ```
   
   ```sql
   SET "useMultistageEngine" = true;
   SET "maxRowsWithoutChangeInDistinct" = 50000;
   SELECT DISTINCT country, deviceType FROM events;
   ```
   
   ```sql
   SET "useMultistageEngine" = true;
   SET "maxExecutionTimeMsInDistinct" = 100;
   SELECT DISTINCT sessionId FROM events;
   ```
   
   ## Validation
   
   ```bash
   GITHUB_ACTIONS=true ./mvnw -pl pinot-query-runtime -am 
-Dtest=LeafOperatorTest,AggregateOperatorTest 
-Dsurefire.failIfNoSpecifiedTests=false test
   ```
   
   Result: `Tests run: 30, Failures: 0, Errors: 0, Skipped: 0`.
   
   Also ran `git diff --check` successfully.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to