Jackie-Jiang opened a new pull request, #18773:
URL: https://github.com/apache/pinot/pull/18773
## Summary
Building a plan node can be expensive (e.g. FST/IFST regexp processing), but
`CombinePlanNode.getCombineOperator()` did not check for query termination
while constructing the operators. A cancelled or timed-out query would keep
building every plan node before bailing out, wasting CPU and holding segment
references.
This PR adds termination checks to the operator-construction phase and
tightens the related exception handling:
- **Per-plan-node termination check.** Both the sequential and parallel
construction paths now call
`QueryThreadContext.checkTerminationAndSampleUsage("CombinePlanNode")` between
plan nodes, so a cancelled or timed-out query stops promptly and the
construction work is sampled into the query's resource accountant.
- **Run inline when `numTasks == 1`.** Instead of always offloading to the
executor for large plan-node counts, the operators are built sequentially on
the current thread when only a single task would be scheduled (small plan-node
count, or a single execution thread). The per-plan-node check now honors the
deadline inline, so the separate-thread hop (previously needed only so the
timeout could be honored) is no longer required. This also folds the old
`numPlanNodes <= TARGET_NUM_PLANS_PER_THREAD` sequential branch into the same
condition.
- **Preserve `QueryException` from parallel workers.** The parallel error
handler now rethrows any `QueryException` cause (which subsumes the previous
`BadQueryRequestException` special-case and covers the termination/timeout
exceptions) instead of wrapping it in a generic `RuntimeException`, so the
original error code reaches the caller. This matches how `BaseCombineOperator`
already classifies worker exceptions.
The termination check is wired through the same `QueryThreadContext` path
that `ServerQueryExecutorV1Impl` already uses during server query planning, and
the new exceptions are handled by the existing top-level catch in
`ServerQueryExecutorV1Impl` (mapped to `QUERY_CANCELLATION` / the preserved
error code).
--
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]