tree: 77028cf4dcc74707232999eac0ff1252edcc103c [search]
  1. src/
  2. pom.xml
  3. README.md
iotdb-client/subscription/README.md

Subscription column filters

Table topics support a column-filter expression over column metadata: database, table_name, column_name, datatype, and category. String literals use double quotes, and comparisons are case insensitive. The default expression is true, which includes every column.

Streaming schema semantics

Column filters follow schema changes while the subscription runs. When a table has a matching column, its TAG columns are retained automatically, including TAGs added after topic creation or subscription. For example:

CREATE TOPIC selected_measurements WITH (
  'database' = 'factory',
  'table' = 'sensors',
  'column-filter' = 'column_name IN ("temperature", "pressure")'
);

This selects temperature and pressure together with all TAGs. Adding a location TAG later includes it in subsequent data without altering the topic or restarting the consumer. FIELDs outside the predicate are excluded. A predicate such as category = "FIELD" also picks up new FIELDs, while column_name LIKE "sensor%" picks up new matching column names. New tables matching the topic‘s database and table patterns are included automatically. Datatype predicates use the latest committed table schema. Tree view predicates use view column names and return the corresponding source FIELDs. ATTRIBUTE columns are excluded from filtered payloads even when they match; matching them still retains the table’s TAGs. Tables with no matching column produce no rows. TIME selection remains per table and uses its declared time column name.

The predicate is applied when data is prepared for delivery, for both historical and incremental data and for record and TsFile payloads. Data already prepared for delivery keeps its existing projection. There is no fixed schema snapshot option for column filtering. The topic's mode = snapshot still controls the historical data cutoff; it does not freeze the column schema.

Evaluation cost

Each topic parses its expression once. Before pruning a Tablet, the DataNode reads the committed schema from its local table cache. It reuses the compiled column selection while that schema instance is unchanged and recompiles only the affected table after a schema update. This adds one local cache lookup per Tablet, without remote schema requests or expression evaluation per row. If a table's schema is not available locally, its data is skipped until the schema becomes available.