pola-rs/polars · error

not implemented

Error message

not implemented

What it means

In polars-python's IR node visitor, the column_mapping getter of a Scan node only handles None; an Iceberg column mapping (Some(ColumnMapping::Iceberg)) panics with unimplemented!(). Iceberg hidden column-mapping (name-id encoded field names) has no Python-side representation yet.

Source

Thrown at crates/polars-python/src/lazyframe/visitor/nodes.rs:195

            },
            Some(DeletionFilesList::Delta(provider)) => {
                ("delta-deletion-vector", provider.callback().0.clone_ref(py))
                    .into_pyobject(py)?
                    .into_any()
                    .unbind()
            },
        })
    }

    /// One of:
    /// * None
    /// * ("iceberg-column-mapping", <unimplemented>)
    #[getter]
    fn column_mapping(&self, py: Python<'_>) -> PyResult<Py<PyAny>> {
        Ok(match &self.inner.column_mapping {
            None => py.None().into_any(),

            Some(ColumnMapping::Iceberg { .. }) => unimplemented!(),
        })
    }
}

#[pyclass(frozen)]
/// Scan a table from file
pub struct Scan {
    #[pyo3(get)]
    paths: Py<PyAny>,
    #[pyo3(get)]
    file_info: Py<PyAny>,
    #[pyo3(get)]
    hive_parts: Option<PyDataFrame>,
    #[pyo3(get)]
    predicate: Option<PyExprIR>,
    #[pyo3(get)]
    file_options: PyFileOptions,
    #[pyo3(get)]

View on GitHub (pinned to df599052da)

Solutions

  1. Guard access: check whether the scan exposes column mapping and skip the attribute for Iceberg-mapped scans
  2. Read the Iceberg table without column mapping enabled (snapshot/schema choice) if you control scan options
  3. Upgrade polars - Iceberg mapping support in the visitor is on the roadmap; track the changelog

Example fix

# before
mapping = scan_node.column_mapping  # panics for Iceberg column mapping

# after
mapping = getattr(scan_node, "column_mapping", None)
if mapping is None:
    ...  # safe path; skip Iceberg-mapped scans
Defensive patterns

Strategy: type-guard

Validate before calling

has_iceberg_mapping = getattr(scan_node, "column_mapping", None) is not None

Type guard

def scan_node_inspectable(scan_node) -> bool:
    # Iceberg column mapping is not exposed to Python yet
    return not hasattr(scan_node, "column_mapping") or scan_node.column_mapping is None

Try / catch

try:
    mapping = scan_node.column_mapping
except Exception:
    mapping = None  # Iceberg-mapped scans: skip attribute until supported

Prevention

When it happens

Trigger: Using the Python lazyframe IR visitor API to inspect plan nodes for a scan of an Iceberg table where column mapping is active (the table has had columns renamed/dropped, triggering Iceberg's field-id name mapping), then accessing node.column_mapping.

Common situations: Plan-inspection tooling, query rewriters, or optimizers built on the IR visitor that walk an Iceberg scan; Iceberg tables evolve (rename/drop) so mapping appears unexpectedly later.

Related errors


AI-assisted analysis of pola-rs/polars@df599052da (2026-08-16). Data as JSON: /api/errors/e44adc7ee3272870. Report an issue: GitHub.