Skip to content

feat: Investigate caching opportunities in iceberg_scan.rs #3602

Closed

Description

@comphead

This might be a future optimization if I'm understanding control flow correctly, but for default value/schema change columns we're allocating new ArrayRef every time. It seems like there are caching opportunities here. Maybe file an issue to optimize default value/identity columns/schema change columns in the expression adapter.

Originally posted by @mbutrovich in #3536 (comment)

Activity

  1. mbutrovich commented on Mar 3, 2026

    @mbutrovich
    Contributor

    Investigated this with instrumentation in adapt_batch_with_expressions. After logging all projection expressions across the full CometIcebergNativeSuite (including schema evolution, partitioned tables, MOR, and complex types), every expression is either a column reference (name@N) or a cast wrapping a column reference (Cast [child: name@N] / COMET_CAST_COLUMN(name@N AS ...)). No literal expressions appeared.

    The two scenarios where we expected literals:

    1. Partition columns — iceberg-rust's RecordBatchTransformer injects identity partition values into the batch as data columns before it reaches us.
    2. Schema evolution (missing columns) — iceberg-rust's RecordBatchTransformer adds missing columns filled with nulls. In the "schema evolution - add column" test, old files written with (id, name) arrive with file_schema=["id", "name", "age"] already populated — the adapter just sees age@2.

    Since iceberg-rust handles both cases internally, our adapter never produces literal expressions, and there's nothing to cache. Closing as not applicable.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions