Skip to content

Subscription: support table-model column-filter for topics#17936

Open
VGalaxies wants to merge 3 commits into
masterfrom
feature/subscription-column-filter
Open

Subscription: support table-model column-filter for topics#17936
VGalaxies wants to merge 3 commits into
masterfrom
feature/subscription-column-filter

Conversation

@VGalaxies

Copy link
Copy Markdown
Contributor

Purpose

Add a column-filter topic attribute for table-model subscriptions so a topic can
restrict which columns consumers receive, based on column metadata, applied uniformly
across historical, real-time pipe, and IoTConsensus WAL paths.

What

  • New optional topic attribute column-filter (table-model only); unset == true.
    Restricted boolean predicate over column-metadata fields aligned with
    information_schema.columns: database, table_name, column_name, datatype,
    category. Supports =/!=, IN, LIKE, REGEXP, IS [NOT] NULL, AND/OR/NOT.
  • Independent ColumnFilter.g4 grammar (decoupled from the query grammar) producing the
    reused relational AST nodes; a whitelist validator rejects unsupported syntax/fields.
  • Resolved to a per-(database, table) column set at CREATE/ALTER (and on re-bind) against the
    current schema, cached per topic on the DataNode and used for O(1) runtime pruning.
    TAG columns are retained; ATTRIBUTE columns are not transmittable.
  • Applied in all paths: IoTConsensus WAL converter, pipe tablet batch, and TsFile reseal
    (prune at tablet granularity; raw TsFile passthrough kept only when the filter is trivial).
  • timeSelected propagated as an optional, backward-compatible per-table flag on the poll
    response (defaults to exposing time for old consumers).
  • ALTER TOPIC hot-refreshes the cached matcher (no converter rebuild; in-flight not reprocessed).
  • Removed the legacy consensus-only column regex attribute.

Tests

  • Unit: parser/validator/evaluator, binder, tablet pruner, topic config, poll response, record handler.
  • Integration (table model): live/snapshot, record & TsFile, multi-consumer-group, historical+
    realtime consistency, ALTER rebind, empty-result progress, snapshot semantics, custom time
    column, altered data type, tree-view source-column binding, attribute drop, 1C3D cluster
    ALTER-after-owner-transfer, DataNode restart re-snapshot, invalid-expression rejection, permission.

Notes

  • The column-filter bound set is a non-persisted snapshot: stable between binds, re-derived
    from the current schema on CREATE/ALTER/restart/owner-transfer; not frozen for the topic lifetime.
  • Tree-model topics are unaffected.

codex and others added 3 commits June 12, 2026 14:36
Independent ColumnFilter.g4 grammar; parser/validator/evaluator/binder/matcher/TabletColumnPruner; node-commons
ColumnMetadata; column pruning in consensus WAL + pipe tablet + TsFile reseal paths; legacy 'column' regex removed; timeSelected flag wired end-to-end (per-table); CREATE/ALTER TOPIC validation + DataNode
refreshColumnFilter cache hot-refresh; UT + IT coverage. Implements V2.0 subscription column-filter design. NOT YET VERIFIED: end-to-end datanode/confignode compile and full IT run.
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.66831% with 287 lines in your changes missing coverage. Please review.
✅ Project coverage is 41.19%. Comparing base (abb9ef9) to head (05dd8a0).

Files with missing lines Patch % Lines
...vent/response/SubscriptionEventTabletResponse.java 0.00% 28 Missing ⚠️
.../plan/execution/config/TableConfigTaskVisitor.java 4.00% 24 Missing ⚠️
...db/subscription/agent/SubscriptionBrokerAgent.java 17.24% 24 Missing ⚠️
.../event/batch/SubscriptionPipeTabletEventBatch.java 0.00% 24 Missing ⚠️
...on/consumer/base/AbstractSubscriptionConsumer.java 0.00% 16 Missing ⚠️
...on/broker/consensus/ConsensusPrefetchingQueue.java 0.00% 15 Missing ⚠️
.../subscription/columnfilter/ColumnFilterParser.java 88.88% 12 Missing ⚠️
...ubscription/payload/SubscriptionRecordHandler.java 83.07% 11 Missing ⚠️
...ad/evolvable/batch/PipeTabletEventTsFileBatch.java 56.00% 11 Missing ⚠️
...otdb/db/schemaengine/table/DataNodeTableCache.java 0.00% 11 Missing ⚠️
... and 20 more
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #17936      +/-   ##
============================================
+ Coverage     41.07%   41.19%   +0.12%     
  Complexity      318      318              
============================================
  Files          5257     5265       +8     
  Lines        365010   365873     +863     
  Branches      47180    47337     +157     
============================================
+ Hits         149918   150718     +800     
- Misses       215092   215155      +63     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants