Skip to content

refactor(fuse): abstract runtime filter into PartitionRuntimeFilter, IndexRuntimeFilter, and RowRuntimeFilter traits#19728

Open
zhang2014 wants to merge 7 commits intodatabendlabs:mainfrom
zhang2014:refactor/runtime_filter_read_state
Open

refactor(fuse): abstract runtime filter into PartitionRuntimeFilter, IndexRuntimeFilter, and RowRuntimeFilter traits#19728
zhang2014 wants to merge 7 commits intodatabendlabs:mainfrom
zhang2014:refactor/runtime_filter_read_state

Conversation

@zhang2014
Copy link
Copy Markdown
Member

@zhang2014 zhang2014 commented Apr 16, 2026

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

refactor(fuse): abstract runtime filter into PartitionRuntimeFilter, IndexRuntimeFilter, and RowRuntimeFilter traits

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Breaking Change (fix or feature that could cause existing functionality not to work as expected)
  • Documentation Update
  • Refactoring
  • Performance Improvement
  • Other (please describe):

This change is Reviewable

…IndexRuntimeFilter, and RowRuntimeFilter traits
@github-actions github-actions Bot added the pr-refactor this PR changes the code base without new features or bugfix label Apr 16, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac50ce6726

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +174 to +178
// This filter requires async IO for bloom index loading.
// The sync prune path cannot be used alone — use prune_async instead.
// Return false (don't prune) as a safe fallback.
let _ = part;
Ok(false)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Wire inlist bloom pruning into index filter

ReadDataTransform::read_parts now relies on IndexRuntimeFilter::prune, but InlistBloomIndexFilter::prune unconditionally returns Ok(false) and the real pruning logic lives in the unused prune_async helper. That means runtime IN-list bloom-index pruning is effectively disabled after this refactor, so partitions that were previously skipped by bloom index checks are always read.

Useful? React with 👍 / 👎.

})
.collect();
// Use new trait-based API for row-level filtering
let row_runtime_filters = ctx.get_row_runtime_filters(scan_id);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep bloom row filters available for new hash join

ReadState now pulls runtime bloom filters only from ctx.get_row_runtime_filters(scan_id), but this commit only populates that side-channel in the legacy hash-join runtime-filter path; the new_hash_join globalization path still only calls set_runtime_filter. For plans using new hash join, row_runtime_filters stays empty and row-level bloom runtime filtering is skipped entirely.

Useful? React with 👍 / 👎.

Comment on lines +125 to +127
let index = filter.load_index(&part, &operator).await?;
let index_ref = index.as_ref().map(|b| b.as_ref() as &dyn std::any::Any);
if filter.prune(&part, index_ref)? {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid loading spatial index before stats pruning

The new index-filter loop loads index data before calling prune, so SpatialIndexFilter::load_index runs even when the fast bounding-box stats check would immediately reject a partition. Previously the spatial pruner checked stats first and only read index files when needed; this change adds avoidable index IO per partition and can significantly regress spatial runtime-filter performance on large scans.

Useful? React with 👍 / 👎.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 16, 2026

🤖 CI Job Analysis (Retry 1)

Workflow: 24814057526

📊 Summary

  • Total Jobs: 87
  • Failed Jobs: 4
  • Retryable: 0
  • Code Issues: 4

NO RETRY NEEDED

All failures appear to be code/test issues requiring manual fixes.

🔍 Job Details

  • linux / sqllogic / standalone (standalone, 2c, hybrid): Not retryable (Code/Test)
  • linux / sqllogic / standalone (standalone, 2c, http): Not retryable (Code/Test)
  • linux / sqllogic / cluster (cluster, 2c, http): Not retryable (Code/Test)
  • linux / sqllogic / cluster (cluster, 2c, hybrid): Not retryable (Code/Test)

🤖 About

Automated analysis using job annotations to distinguish infrastructure issues (auto-retried) from code/test issues (manual fixes needed).

zhang2014 and others added 5 commits April 19, 2026 12:57
- Add PartitionRuntimeFilters/IndexRuntimeFilters/RowRuntimeFilters type aliases
- Change RowRuntimeFilter::apply to take Column directly instead of &DataBlock
- Add column_name() to RowRuntimeFilter trait for schema-independent resolution
- BloomRowFilter::create returns Arc<dyn RowRuntimeFilter> directly
- ReadState resolves column indices via column_name() at init time

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…nsform

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@zhang2014 zhang2014 force-pushed the refactor/runtime_filter_read_state branch from 89a48f7 to ecc59d9 Compare April 23, 2026 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-refactor this PR changes the code base without new features or bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant