Support executing a query expression on a series of targets in parallel
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the feature request:
Splitting this out from [my comment](https://github.com/bazelbuild/bazel/issues/21731#issuecomment-2198204471) on #21731.
Buck has a feature in its [query command](https://buck.build/command/query.html) (described under "Executing multiple queries at once") wherein a query can be performed on multiple targets in parallel, and the outputs are bucketed for each target. For example, the query `buck query "testsof(deps( %s ))" target1 target2 target3` with the flag `--output-format json` will return a JSON object keyed by each target with values corresponding to the result of the query for each target separately.
### Which category does this issue belong to?
CLI
### What underlying problem are you trying to solve with this feature?
The only alternative to this approach I'm aware of that's currently supported in Bazel is to collect the union of the targets' query results as protobuf, parse that, and perform the processing separately. While more efficient than querying for each target separately, it has been an adjustment to get to grips with in our codebase. Supporting this narrow kind of parallel processing in Bazel itself would be a big help in improving performance of our query-based tooling.
### Which operating system are you running Bazel on?
_No response_
### What is the output of `bazel info release`?
_No response_
### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.
_No response_
### What's the output of `git remote get-url origin; git rev-parse HEAD` ?
_No response_
### Have you found anything relevant by searching the web?
_No response_
### Any other information, logs, or outputs that you want to share?
_No response_
Contributor guide
Research direction
Start by reading Bazel's existing query command and the discussion linked from issue #21731, then compare its behavior with Buck's documented multiple-query execution. Done means supporting a series of target expressions in parallel and returning results bucketed by target, including the requested JSON output format.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100