#26461·risingwave

iceberg source: extract_iceberg_columns does not reject user columns colliding with RisingWave's reserved column names

Author: yuhao-suCreated Jul 28, 2026Updated Sep 27, 2026
Labelsno-issue-activity

Problem

extract_iceberg_columns appends RisingWave's own hidden columns to the catalog without checking whether the Iceberg table already has a column of the same name:

rust
// src/frontend/src/handler/create_source/external_schema/iceberg.rs
let mut columns = /* iceberg fields -> ColumnCatalog */;
columns.extend(ColumnCatalog::iceberg_hidden_cols());   // no uniqueness check

The three appended names are _iceberg_sequence_number, _iceberg_file_path and _iceberg_file_pos. They are RisingWave conventions — Iceberg knows nothing about them, so a table with a column of that name is perfectly legal and iceberg-rust accepts it. Iceberg's own uniqueness guarantee (Schema::builder().build() rejects duplicate full names) stops being useful the moment we concatenate our own names onto the list.

Result: SourceCatalog::columns can contain two entries with the same name, and nothing downstream is prepared for that.

What breaks

Both consumers resolve columns by name, and they want different entries for the same string:

iceberg_intermediate_scan_rule.rs builds one HashMap<&str, &ColumnCatalog> shared by two purposes, and projection_columns is dedup()ed beforehand, so a colliding name is looked up exactly once for both:

consumer wants
build_column_catalogs(projection_columns, ..) the user's column
equality / position delete joins the hidden column

Today the map is built with collect() (last-wins), so both get the hidden column: the delete joins work and the user's column silently takes the hidden column's type (Varchar / Int64). Flipping to first-wins does not fix it — it would hand the user's column to the delete-join machinery instead, breaking the scan. One map cannot serve both semantics; the ambiguity has to be prevented before the names are merged.

A concrete downstream consequence: LogicalIcebergIntermediateScan::iceberg_side_fields resolves the iceberg-side type used to decide predicate pushability. Getting the hidden column's Varchar instead of the user column's real type can turn a non-pushable column (struct/list/map) into a "pushable" one, and the pushed-down IS [NOT] NULL then fails the whole scan with Accessor for Field ... not found.

Related: _row_id is silently hidden

The same function has:

rust
// hide the _row_id column for iceberg engine table
is_hidden: field.name() == ROW_ID_COLUMN_NAME,

This is deliberate for engine tables, but it also means any user column literally named _row_id disappears from SELECT * with no diagnostic. Worth noting that this makes "Iceberg tables never contain RisingWave-internal column names" already false — RisingWave itself writes _row_id into tables it creates for PK-less engine tables.

Proposed fix

Reject the collision in extract_iceberg_columns, which is the only place that knows the reserved names exist. Three contains checks; error out of CREATE SOURCE with a message naming the offending column and the reserved name.

Breaking-change surface: none for tables without a collision. For a table with one, new CREATE SOURCE fails with a clear error instead of silently mistyping or hiding a column — existing catalogs are not re-validated. Those users are getting wrong results today, so this converts silent wrongness into a visible error.

Notes

Found while reviewing #25165 (iceberg variant source). Not caused by it — the collision and both consumers predate that PR. Low priority: it needs a deliberately-named column to trigger, but it is prevented by an invariant nobody enforces rather than by construction.

Source: risingwavelabs/risingwave