Skip to content

fix: Allow segment pruners to indicate what segment details they need to effectively prune + fixup MSQ table slicer to honor such requests - #20892

Merged
capistrant merged 4 commits into
apache:masterfrom
capistrant:msqtableslicer-honorprunerdesires
Nov 25, 2026
Merged

capistrant merged 4 commits into
apache:masterfrom
capistrant:msqtableslicer-honorprunerdesires

Conversation

@capistrant

@capistrant capistrant commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Description

FilterSegmentPruner can prune segments based on cluster groups for segments that are built using them since #20149. This should allow msq-task engine queries to prune segments when cluster groups are being filtered on. However, that is not the case because #20006 cut back on the segment details that the RetrieveUsedSegmentsAction grabs.

In the effort to actually support full pruning capabilities for FilterSegmentPruner (and create a path forward for future pruners), this PR proposes the SegmentPruner interface gains a new method getRequiredSegmentDetails which returns segment details it needs to make pruning decisions. The MSQ module takes advantage of this new method in the table input slicer by submitting the RetrieveUsedSegmentsAction request with the details needed by the pruner, if any exist. This allows msq-task queries to prune on cluster groups when there are there.

Release note

Close a functionality gap in segment pruning by msq-task queries by providing them the information about the input segments that they need to prune on cluster groups if the query is filtering on columns that are cluster group column in the underlying data. Enhancing the impact of #20149


Key changed/added classes in this PR
  • SegmentPruner
  • FilterSegmentPruner
  • IndexerTableInputSpecSlicer

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

@github-actions github-actions Bot added Area - Batch Ingestion Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262 labels Nov 12, 2026

@FrankChen021 FrankChen021 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No actionable issues found. The required segment details are correctly propagated through the MSQ slicer and action clients, with coverage for cluster-group pruning and detail requests.

Reviewed 9 of 9 changed files.

Validation: git diff --check passed. No tests or builds were run.


This is an automated review by Codex GPT-5.6-Luna(max)

@FrankChen021 FrankChen021 added the Approval Recommended Used when AI completes a review and reports no findings label Nov 13, 2026

@amaechler amaechler left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐻

* Callers may pass segments that lack some of these details, so {@link #include(DataSegment)} must return true
* when a detail it needs is absent.
*/
default EnumSet<SegmentDetail> getRequiredSegmentDetails()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder if it is good that we have a default here.. it might be safer to force everything to explicitly implement this method to make sure all pruners choose the things that they need.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is actually what I preferred in local dev. I was talked into adding a default by automated review before opening the PR. It convinced me that there could be mystical extensions out there that implement this api and would prefer a default over incompatibility. I kinda wonder if I should have pushed back on that and go forward with removing the default now. I think I will do that

@FrankChen021 FrankChen021 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No actionable issues found. The required segment details are correctly propagated through the MSQ slicer and action clients, while FilterSegmentPruner and CompositeSegmentPruner preserve the required-detail contract. The updated interface is implemented by all repository pruners.

Reviewed 9 of 9 changed files.

Validation: git diff --check passed. No tests or builds were run.


This is an automated review by Codex GPT-5.6-Luna(max)

@FrankChen021 FrankChen021 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No actionable issues found in this review. The current head correctly propagates declared segment details through task-engine table slicing, unions requirements across composite pruners, preserves the no-pruner path, and updates the test action client to mirror detail trimming.

Reviewed 9 of 9 changed files. The incremental diff was reviewed first, followed by the complete current-head diff and relevant surrounding code.


This is an automated review by Codex GPT-5.6-Luna(max)

@capistrant
capistrant merged commit b0d690f into apache:master Nov 25, 2026
28 checks passed
@github-actions github-actions Bot added this to the 40.0.0 milestone Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approval Recommended Used when AI completes a review and reports no findings Area - Batch Ingestion Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262 Design Review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants