← Back to Pull requests

feat(plugin-iceberg): Support top-level Iceberg V3 unknown type #28671

Merged
mohsaka merged 34 files (1340 lines) on Nov 10, 2026 21:41 UTC
View on GitHub
mohsaka mohsaka commented on Oct 16, 2026 08:50 UTC
Author

Description


Split off from https://github.com/prestodb/presto/pull/28498, due to complexities of nested types. Individual PR's will be opened for MAP, ROW, and ARRAY support.

Adds support for reading and writing top-level Iceberg V3 unknown type columns in the Java connector. An unknown column always holds NULL; it is never stored in data files and always reads back as NULL.

DDL support (CREATE TABLE / ADD COLUMN / CREATE TABLE AS SELECT):

  • A new SUPPORTS_UNKNOWN_COLUMN_TYPE connector capability gates DDL in CreateTableTask, AddColumnTask, and StatementAnalyzer. The Iceberg connector advertises this capability.

  • ALTER TABLE ADD COLUMN ... UNKNOWN is accepted at top level; adding an unknown field nested inside a ROW, ARRAY, or MAP (via ADD COLUMN parent.field) is always rejected.

  • Consolidated four duplicate DDL validation blocks into a single IcebergAbstractMetadata.validateUnknownColumnsForCreateTable helper.
  • Write path:

  • UnknownFields.fileSchema(Schema) strips top-level unknown columns from the schema written to Parquet/ORC data files.

  • IcebergFileWriterFactory uses fileSchema when constructing the file writer, so data files contain only concrete columns.

  • UnknownFields.validateWritable(Schema) rejects writes when the resulting file schema would be empty (see "All-unknown table" section below).

  • LogicalPlanner and QueryPlanner replace unknown output columns with NULL literals so the engine never tries to encode an unknown value.

  • Sort-spill temp files (ORC) replace unknown with BOOLEAN as a placeholder, since Presto's OrcType.toOrcType does not handle unknown — the values are always NULL so the placeholder type has no semantic effect.

  • RewriteDataFilesProcedure skips tables with unknown columns (rewrite would silently drop them; the restriction can be lifted when the procedure is made aware of fileSchema).
  • Read path:

  • IcebergPageSourceProvider injects a NULL block for any unknown column rather than attempting to read it from the data file.

  • TypeConverter maps Iceberg UnknownType to Presto UnknownType.

  • IcebergUtil.deserializeIcebergValue short-circuits for unknown to avoid a spurious "Invalid partition type" error.
  • All-unknown table INSERT is rejected:

    If a table's schema consists entirely of unknown columns, stripping them from the file schema produces a zero-column MessageType. Both parquet-mr and Iceberg Java reject this:

  • parquet-mr (ParquetFileWriter constructor): InvalidSchemaException: Cannot write a schema with an empty group

  • Iceberg Java (ParquetWriter.ensureWriterInitialized): hits the same parquet-mr exception on the first non-empty flush
  • Presto matches this behavior. validateWritable throws NOT_SUPPORTED before any I/O:

    -- CREATE TABLE with all-unknown columns is allowed; the schema is a valid placeholder
    CREATE TABLE t (marker UNKNOWN) WITH ("format-version" = '3');
    
    -- Describing the table shows the column and its type
    DESCRIBE t;
    -- Column  | Type    | Extra | Comment
    -- marker  | unknown |       |
    
    -- INSERT is rejected — every column is UNKNOWN so the Parquet file schema would be empty.
    -- parquet-mr throws InvalidSchemaException for a 0-column MessageType, and Iceberg Java's
    -- ParquetWriter hits the same exception when it initializes the file writer. Presto rejects
    -- the write upfront to match that behavior.
    INSERT INTO t VALUES NULL;
    -- → NOT_SUPPORTED: Writing to a table where every column is of type UNKNOWN is not supported
    
    -- SELECT and DDL still work on the table
    SELECT * FROM t;           -- → (empty)
    SELECT count(*) FROM t;    -- → 0
    ALTER TABLE t ADD COLUMN id INTEGER;  -- schema evolution back to a writable table
    

    A table with at least one non-unknown column writes and reads normally:

    CREATE TABLE t2 (id INTEGER, marker UNKNOWN) WITH ("format-version" = '3');
    
    -- INSERT works: id is written to the data file; marker is stripped (always NULL anyway)
    INSERT INTO t2 VALUES (1, NULL), (2, NULL);
    
    -- SELECT returns the concrete column and NULL for the unknown column
    SELECT * FROM t2;
    -- id | marker
    --  1 | NULL
    --  2 | NULL
    
    SELECT count(*) FROM t2 WHERE marker IS NULL;  -- → 2 (unknown is always NULL)
    SELECT count(*) FROM t2 WHERE marker IS NOT NULL;  -- → 0
    

    Limitations (this PR — top-level only):

  • unknown nested inside ROW, ARRAY, or MAP is not yet supported on the write path and is rejected. Read support for pre-existing nested unknown columns (written by other engines) is added in a follow-up PR.

  • Identity partitioning on unknown columns should be avoided. Presto's DROP COLUMN rejects any column referenced by any partition spec (including historical ones), so a table partitioned on an unknown column can never have that column dropped, making cluster rollback impossible.

  • Hive catalog (HIVE catalog type): other Iceberg engines (Spark, Flink) cannot commit to a table that contains an unknown column, because Iceberg's Hive metastore schema converter does not support the unknown type. Avoid adding unknown columns to tables in shared Hive Metastore deployments.
  • Motivation and Context

    Iceberg Format Version 3 introduces the unknown type (spec §4.7). Tables written by other Iceberg engines (Spark, Flink) may contain unknown columns, and Presto must be able to read them. This PR enables Presto to participate in those workflows and to create V3 tables with unknown columns of its own.

    Impact

    User-facing changes:

  • CREATE TABLE, ALTER TABLE ADD COLUMN, and CTAS now accept UNKNOWN as a column type on Iceberg V3 tables.

  • Reading a table with an unknown column (written by any Iceberg engine) returns NULL for that column instead of failing.

  • INSERT into a table with an unknown column works; the column must be NULL or omitted.

  • INSERT into a table where every column is UNKNOWN is rejected with a clear error (consistent with parquet-mr and Iceberg Java behavior).
  • Rollback note: a table that contains an unknown column cannot be read by Presto versions that predate this feature. Drop any unknown columns before rolling back a cluster. Rolling back while any unknown-column table exists causes information_schema.columns and JDBC getColumns to fail for the entire schema containing that table (and for the whole catalog on unfiltered listings). Use the following query to find all affected tables before rolling back:

    SELECT table_schema, table_name, column_name
    FROM iceberg.information_schema.columns
    WHERE data_type LIKE '%unknown%';
    

    Test Plan

  • TestIcebergV3 — end-to-end tests for the new functionality:

  • - testReadUnknownColumn (PARQUET, ORC) — reads a pre-existing table fixture written with an unknown column.
    - testWriteUnknownColumn (PARQUET, ORC) — CREATE + INSERT + SELECT round-trip with a mixed table.
    - testWriteTableOfOnlyUnknownColumns (PARQUET, ORC) — verifies that INSERT into an all-unknown table is rejected with NOT_SUPPORTED.
    - testDropLastNonUnknownColumnRejectsWrite — drops the last non-unknown column then confirms INSERT is rejected.
    - testAddColumnToAllUnknownTableRestoresWritability — confirms ALTER TABLE ADD COLUMN on an all-unknown table succeeds and subsequent INSERT works.
    - testUnknownColumnWithSort — exercises the sort-spill ORC placeholder path.
    - testAddFieldUnknownRejected — confirms that ADD COLUMN parent.nested_field UNKNOWN is rejected.
    - testUnknownColumnPredicates, testUnknownColumnScalarFunctions — query semantics.
  • TestUnknownColumnRead — reads a real Iceberg table fixture (Parquet files + Avro manifest) generated by an external Iceberg engine.

  • TestIcebergSmokeHive.testUnknownColumnDDLHiveCatalog — smoke test for the Hive catalog DDL path.
  • Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.

  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.

  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.

  • If release notes are required, they follow the release notes guidelines.

  • Adequate tests were added if applicable.

  • CI passed.

  • If adding new dependencies, verified they have an OpenSSF Scorecard score of 5.0 or higher (or obtained explicit TSC approval for lower scores).
  • Release Notes

    == RELEASE NOTES ==
    
    Iceberg Connector Changes
    * Add support for reading and writing Iceberg V3 ``unknown`` type columns in the Java connector
      (top-level columns only). An ``unknown`` column always reads as ``NULL`` and is never stored
      in data files. Writing to a table where every column is ``unknown`` is rejected with a clear
      error, consistent with parquet-mr and Iceberg Java behavior. Tables with ``unknown`` columns
      cannot be read by Presto versions that predate this release; drop any ``unknown`` columns
      before rolling back a cluster.
    

    Summary by Sourcery

    Support top-level Iceberg V3 UNKNOWN columns in the Java connector while keeping them virtual, always NULL, and excluded from physical data files.

    New Features:

  • Add Java Iceberg connector support for top-level Iceberg V3 UNKNOWN columns across DDL, reads, writes, and CTAS operations.

  • Expose UNKNOWN column support through connector capabilities and preserve UNKNOWN columns as always-NULL table fields while omitting them from data files.
  • Bug Fixes:

  • Reject writes to tables composed entirely of UNKNOWN columns before file creation.

  • Prevent unsupported nested UNKNOWN types and UNKNOWN columns on pre-V3 tables from being accepted.

  • Handle UNKNOWN columns in planning, sorting, partition/default processing, metadata queries, and data-file reads without attempting physical encoding.
  • Enhancements:

  • Centralize Iceberg UNKNOWN schema validation and support interoperability with externally generated Iceberg V3 tables.
  • Documentation:

  • Document Iceberg V3 UNKNOWN column behavior, limitations, and rollback considerations.
  • Tests:

  • Add end-to-end coverage for UNKNOWN column DDL, CTAS, reads, writes, predicates, schema evolution, sorting, partitioning, metadata, and all-UNKNOWN table rejection across Parquet and ORC.

  • Add interoperability coverage for externally generated UNKNOWN-column tables and Hive catalog DDL behavior.
  • Diff: 1340 lines (+1297 / -43) across 34 files Reviewer: aditi-pandit Review duration: 36771m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.72) × (1 − Review Confidence (0.75)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.72 · 1340 lines diff across 34 files
    0.72
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.51 · 5 substantive comment(s)
    0.51
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    75%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.400
    Mass File Touch mass_file_touch
    0.080
    Real PR Conversation Timeline
    42 items
    sourcery-ai[bot] sourcery-ai[bot] commented on Oct 16, 2026 08:50 UTC
    Bot

    <!-- Generated by sourcery-ai[bot]: start review_guide -->

    Reviewer's Guide

    API

    Add a connector capability that lets the engine distinguish connectors that support UNKNOWN columns.

  • presto-spi/src/main/java/com/facebook/presto/spi/connector/ConnectorCapabilities.java L25-30
  • Uses of the API

    Use the new capability to gate UNKNOWN columns in CREATE TABLE, ADD COLUMN, and CTAS, and plan NULL values for UNKNOWN outputs.

  • presto-main-base/src/main/java/com/facebook/presto/execution/AddColumnTask.java L52, L126-131

  • presto-main-base/src/main/java/com/facebook/presto/execution/CreateTableTask.java L69, L144-150

  • presto-main-base/src/main/java/com/facebook/presto/sql/analyzer/StatementAnalyzer.java L1621-1625, L1644-1653 (+5 small edits)

  • presto-main-base/src/main/java/com/facebook/presto/sql/planner/LogicalPlanner.java L123, L789-793

  • presto-main-base/src/main/java/com/facebook/presto/sql/planner/QueryPlanner.java L141, L927, L1173-1181
  • Implementation

    Implement Iceberg UNKNOWN schema validation, V3 DDL handling, write constraints, and schema-evolution checks for the shared metadata path.

  • presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java L446-472, L763-780, L1853-1858 (+3 small edits)

  • presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergHiveMetadata.java L376, L419-421

  • presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergNativeMetadata.java L451, L461-463

  • presto-iceberg/src/main/java/com/facebook/presto/iceberg/UnknownUtils.java L1-85
  • Translate UNKNOWN between Iceberg, Presto, and Hive representations, and handle its partition/default metadata semantics.

  • presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergPageSourceProvider.java L133, L482-484, L1233

  • presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java L576-581, L1248-1251 (+3 small edits)

  • presto-iceberg/src/main/java/com/facebook/presto/iceberg/TypeConverter.java L147-152, L440-446 (+3 small edits)
  • Exclude top-level UNKNOWN columns from physical writers and provide a placeholder type for sort-spill files.

  • presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergFileWriterFactory.java L127-134, L148-154, L276-287 (+8 small edits)

  • presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergPageSink.java L75, L188-193, L613-620
  • Teach the native Iceberg and Hive type converters to dispatch UNKNOWN types and preserve their field-name conversion behavior.

  • presto-native-execution/presto_cpp/main/connectors/IcebergPrestoToVeloxConnector.cpp L230

  • presto-native-execution/presto_cpp/main/connectors/PrestoToVeloxConnectorUtils.cpp L637-638, L889
  • Validate UNKNOWN schemas before data-file rewrites so unsupported or zero-column rewrites fail rather than silently losing fields.

  • presto-iceberg/src/main/java/com/facebook/presto/iceberg/procedure/RewriteDataFilesProcedure.java L29, L223-226
  • Configuration

    Advertise UNKNOWN-column support from the Iceberg connector so engine-level DDL gates allow it.

  • presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergConnector.java L50, L122
  • Documentation

    Document Iceberg V3 UNKNOWN-column support and its usage and limitations.

  • presto-docs/src/main/sphinx/connector/iceberg.rst L3320-3321, L3411-3412, L3417-3469
  • Tests

    Exercise Java Iceberg UNKNOWN-column DDL, reads, writes, planning, schema evolution, metadata, and unsupported cases.

  • presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestIcebergV3.java L986-1054, L1073-1236, L1292-1461 (+10 small edits)
  • Verify interoperability with externally generated Iceberg tables and UNKNOWN-column behavior in Hive catalog DDL.

  • presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestUnknownColumnRead.java L1-99

  • presto-iceberg/src/test/java/com/facebook/presto/iceberg/hive/TestIcebergSmokeHive.java L592-626

  • presto-iceberg/src/test/resources/iceberg_v3/unknown_column/metadata/v1.metadata.json L1

  • presto-iceberg/src/test/resources/iceberg_v3/unknown_column/data/00003-3-73d5357f-f3cd-443c-b64c-2b19492129a5-0-00001.parquet

  • presto-iceberg/src/test/resources/iceberg_v3/unknown_column/data/00006-6-73d5357f-f3cd-443c-b64c-2b19492129a5-0-00001.parquet

  • presto-iceberg/src/test/resources/iceberg_v3/unknown_column/data/00009-9-73d5357f-f3cd-443c-b64c-2b19492129a5-0-00001.parquet

  • presto-iceberg/src/test/resources/iceberg_v3/unknown_column/metadata/854b0ad5-6c71-46c1-91fc-8775d2bc9312-m0.avro

  • presto-iceberg/src/test/resources/iceberg_v3/unknown_column/metadata/snap-7013766561753926116-1-854b0ad5-6c71-46c1-91fc-8775d2bc9312.avro
  • Cover UNKNOWN-column data-file rewriting on Java and native workers.

  • presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestRewriteDataFilesProcedure.java L1973-1996

  • presto-native-execution/src/test/java/com/facebook/presto/nativeworker/iceberg/AbstractTestRewriteDataFilesProcedure.java L542-566
  • Verify native-worker UNKNOWN-column reads, writes, query semantics, CTAS, metadata, and failure cases.

  • presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergUnknownType.java L1-265
  • Exercise UNKNOWN-column MERGE planning on native workers.

  • presto-native-tests/src/test/java/com/facebook/presto/nativetests/iceberg/AbstractTestNativeIcebergV3Dml.java L147-170
  • Check that connectors without UNKNOWN-column capability reject UNKNOWN DDL and CTAS.

  • presto-tests/src/test/java/com/facebook/presto/tests/TestBlackHoleSmoke.java L353-374
  • ---

    <details>
    <summary>Tips and commands</summary>

    Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.

  • Continue discussions: Reply directly to Sourcery's review comments.

  • Generate a GitHub issue from a review comment: Ask Sourcery to create an

  • issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull

  • request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in

  • the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull

  • request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the

  • pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull

  • request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

    Customizing Your Experience

    Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request

  • summary, the reviewer's guide, and others.
  • Change the review language.

  • Add, remove or edit custom review instructions.

  • Adjust other review settings.
  • Getting Help

  • [Contact our support team](mailto:support@sourcery.ai) for questions or feedback.

  • Visit our documentation for detailed guides and information.

  • Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.
  • </details>

    <!-- Generated by sourcery-ai[bot]: end review_guide -->

    sourcery-ai[bot] sourcery-ai[bot] commented on Oct 17, 2026 03:12 UTC
    Reviewer

    Hey - I've reviewed your changes and they look great!

    ***

    <details>
    <summary>Sourcery is free for open source - if you like our reviews please consider sharing them ✨</summary>

  • X

  • Mastodon

  • LinkedIn

  • Facebook
  • </details>

    steveburnett steveburnett commented on code on Oct 19, 2026 14:24 UTC
    Code Review
    presto-docs/src/main/sphinx/connector/iceberg.rst:1
    @@ -3237,10 +3239,67 @@ Map of PrestoDB types to the relevant Iceberg types:
         - ``STRUCT``
       * - ``SphericalGeography``
         - ``GEOGRAPHY``
    +  * - ``UNKNOWN``
    +    - ``UNKNOWN``
     
     
     No other types are supported.
     
    +Unknown type (Iceberg V3)
    +^^^^^^^^^^^^^^^^^^^^^^^^^
    +
    +Iceberg Format Version 3 adds the ``unknown`` type, for a column whose type is not known. Such a
    +column only ever holds null values: it is always optional, is not stored in the data files, and
    +always reads back as ``NULL``.
    +
    +A column of this type can be declared in ``CREATE TABLE``, ``ALTER TABLE ADD COLUMN``, and
    +``CREATE TABLE AS SELECT``::
    +
    +    CREATE TABLE iceberg.web.page_views (view_time TIMESTAMP, extra UNKNOWN) WITH ("format-version" = '3');
    +
    +    ALTER TABLE iceberg.web.page_views ADD COLUMN more UNKNOWN;
    +
    +    CREATE TABLE iceberg.web.page_view_copy WITH ("format-version" = '3') AS SELECT view_time, NULL AS extra FROM iceberg.web.page_views;
    +
    +``INSERT`` statements can write ``NULL`` to an ``unknown`` column or leave the column out entirely.
    +Writing any other value is an error, because the value cannot be stored.
    +
    +**Restrictions:**
    +
    +* The table must use Iceberg format version 3 or higher.
    +* An ``unknown`` column cannot be declared ``NOT NULL``.
    +* An ``unknown`` column can be sorted on, but it cannot be bucketed or partitioned by ``identity``.
    +  Iceberg allows identity partitioning on ``unknown`` columns, but Presto's ``DROP COLUMN``
    +  rejects any column that is referenced by a partition spec (including historical ones), so a table
    +  partitioned on an ``unknown`` column can never have that column dropped, making cluster rollback
    +  impossible.  Avoid identity-partitioning ``unknown`` columns.
    +* Only top-level ``UNKNOWN`` columns are supported.  An ``unknown`` field nested inside a
    +  ``ROW``, ``ARRAY``, or ``MAP`` (e.g. ``ROW(url VARCHAR, extra UNKNOWN)``) is not yet

      ``ROW``, ``ARRAY``, or ``MAP`` (for example, ``ROW(url VARCHAR, extra UNKNOWN)``) is not yet
    

    Avoid Latin abbreviations. See the GitLab documentation style guide recommended word list entry for e.g. for discussion and alternatives.

    steveburnett steveburnett commented on code on Oct 19, 2026 14:25 UTC
    Code Review
    presto-docs/src/main/sphinx/connector/iceberg.rst:1
    @@ -3237,10 +3239,67 @@ Map of PrestoDB types to the relevant Iceberg types:
         - ``STRUCT``
       * - ``SphericalGeography``
         - ``GEOGRAPHY``
    +  * - ``UNKNOWN``
    +    - ``UNKNOWN``
     
     
     No other types are supported.
     
    +Unknown type (Iceberg V3)
    +^^^^^^^^^^^^^^^^^^^^^^^^^
    +
    +Iceberg Format Version 3 adds the ``unknown`` type, for a column whose type is not known. Such a
    +column only ever holds null values: it is always optional, is not stored in the data files, and
    +always reads back as ``NULL``.
    +
    +A column of this type can be declared in ``CREATE TABLE``, ``ALTER TABLE ADD COLUMN``, and
    +``CREATE TABLE AS SELECT``::
    +
    +    CREATE TABLE iceberg.web.page_views (view_time TIMESTAMP, extra UNKNOWN) WITH ("format-version" = '3');
    +
    +    ALTER TABLE iceberg.web.page_views ADD COLUMN more UNKNOWN;
    +
    +    CREATE TABLE iceberg.web.page_view_copy WITH ("format-version" = '3') AS SELECT view_time, NULL AS extra FROM iceberg.web.page_views;
    +
    +``INSERT`` statements can write ``NULL`` to an ``unknown`` column or leave the column out entirely.
    +Writing any other value is an error, because the value cannot be stored.
    +
    +**Restrictions:**
    +
    +* The table must use Iceberg format version 3 or higher.
    +* An ``unknown`` column cannot be declared ``NOT NULL``.
    +* An ``unknown`` column can be sorted on, but it cannot be bucketed or partitioned by ``identity``.
    +  Iceberg allows identity partitioning on ``unknown`` columns, but Presto's ``DROP COLUMN``
    +  rejects any column that is referenced by a partition spec (including historical ones), so a table
    +  partitioned on an ``unknown`` column can never have that column dropped, making cluster rollback
    +  impossible.  Avoid identity-partitioning ``unknown`` columns.
    +* Only top-level ``UNKNOWN`` columns are supported.  An ``unknown`` field nested inside a
    +  ``ROW``, ``ARRAY``, or ``MAP`` (e.g. ``ROW(url VARCHAR, extra UNKNOWN)``) is not yet
    +  supported and is rejected at ``CREATE TABLE`` and ``ADD COLUMN`` time.
    +* Creating a view or materialized view over a table that contains an ``unknown`` column fails with
    +  a "Column type is unknown" error.  As a workaround, exclude or cast the unknown column in the
    +  view's query (e.g. ``SELECT id, CAST(NULL AS INTEGER) AS x FROM t``).

      view's query (for instance, ``SELECT id, CAST(NULL AS INTEGER) AS x FROM t``).
    

    Avoid Latin abbreviations. See the GitLab documentation style guide recommended word list entry for e.g. for discussion and alternatives.

    steveburnett steveburnett commented on code on Oct 19, 2026 14:25 UTC
    Code Review
    presto-docs/src/main/sphinx/connector/iceberg.rst:1
    @@ -3237,10 +3239,67 @@ Map of PrestoDB types to the relevant Iceberg types:
         - ``STRUCT``
       * - ``SphericalGeography``
         - ``GEOGRAPHY``
    +  * - ``UNKNOWN``
    +    - ``UNKNOWN``
     
     
     No other types are supported.
     
    +Unknown type (Iceberg V3)
    +^^^^^^^^^^^^^^^^^^^^^^^^^
    +
    +Iceberg Format Version 3 adds the ``unknown`` type, for a column whose type is not known. Such a
    +column only ever holds null values: it is always optional, is not stored in the data files, and
    +always reads back as ``NULL``.
    +
    +A column of this type can be declared in ``CREATE TABLE``, ``ALTER TABLE ADD COLUMN``, and
    +``CREATE TABLE AS SELECT``::
    +
    +    CREATE TABLE iceberg.web.page_views (view_time TIMESTAMP, extra UNKNOWN) WITH ("format-version" = '3');
    +
    +    ALTER TABLE iceberg.web.page_views ADD COLUMN more UNKNOWN;
    +
    +    CREATE TABLE iceberg.web.page_view_copy WITH ("format-version" = '3') AS SELECT view_time, NULL AS extra FROM iceberg.web.page_views;
    +
    +``INSERT`` statements can write ``NULL`` to an ``unknown`` column or leave the column out entirely.
    +Writing any other value is an error, because the value cannot be stored.
    +
    +**Restrictions:**
    +
    +* The table must use Iceberg format version 3 or higher.
    +* An ``unknown`` column cannot be declared ``NOT NULL``.
    +* An ``unknown`` column can be sorted on, but it cannot be bucketed or partitioned by ``identity``.
    +  Iceberg allows identity partitioning on ``unknown`` columns, but Presto's ``DROP COLUMN``
    +  rejects any column that is referenced by a partition spec (including historical ones), so a table
    +  partitioned on an ``unknown`` column can never have that column dropped, making cluster rollback
    +  impossible.  Avoid identity-partitioning ``unknown`` columns.
    +* Only top-level ``UNKNOWN`` columns are supported.  An ``unknown`` field nested inside a
    +  ``ROW``, ``ARRAY``, or ``MAP`` (e.g. ``ROW(url VARCHAR, extra UNKNOWN)``) is not yet
    +  supported and is rejected at ``CREATE TABLE`` and ``ADD COLUMN`` time.
    +* Creating a view or materialized view over a table that contains an ``unknown`` column fails with
    +  a "Column type is unknown" error.  As a workaround, exclude or cast the unknown column in the
    +  view's query (e.g. ``SELECT id, CAST(NULL AS INTEGER) AS x FROM t``).
    +* Promoting an ``unknown`` column to a concrete type (e.g. ``ALTER TABLE ... ALTER COLUMN ... SET DATA TYPE``)

    * Promoting an ``unknown`` column to a concrete type, such as ``ALTER TABLE ... ALTER COLUMN ... SET DATA TYPE``,
    

    Avoid Latin abbreviations. See the GitLab documentation style guide recommended word list entry for e.g. for discussion and alternatives.

    steveburnett steveburnett commented on code on Oct 19, 2026 14:26 UTC
    Code Review
    presto-docs/src/main/sphinx/connector/iceberg.rst:1
    @@ -3237,10 +3239,67 @@ Map of PrestoDB types to the relevant Iceberg types:
         - ``STRUCT``
       * - ``SphericalGeography``
         - ``GEOGRAPHY``
    +  * - ``UNKNOWN``
    +    - ``UNKNOWN``
     
     
     No other types are supported.
     
    +Unknown type (Iceberg V3)
    +^^^^^^^^^^^^^^^^^^^^^^^^^
    +
    +Iceberg Format Version 3 adds the ``unknown`` type, for a column whose type is not known. Such a
    +column only ever holds null values: it is always optional, is not stored in the data files, and
    +always reads back as ``NULL``.
    +
    +A column of this type can be declared in ``CREATE TABLE``, ``ALTER TABLE ADD COLUMN``, and
    +``CREATE TABLE AS SELECT``::
    +
    +    CREATE TABLE iceberg.web.page_views (view_time TIMESTAMP, extra UNKNOWN) WITH ("format-version" = '3');
    +
    +    ALTER TABLE iceberg.web.page_views ADD COLUMN more UNKNOWN;
    +
    +    CREATE TABLE iceberg.web.page_view_copy WITH ("format-version" = '3') AS SELECT view_time, NULL AS extra FROM iceberg.web.page_views;
    +
    +``INSERT`` statements can write ``NULL`` to an ``unknown`` column or leave the column out entirely.
    +Writing any other value is an error, because the value cannot be stored.
    +
    +**Restrictions:**
    +
    +* The table must use Iceberg format version 3 or higher.
    +* An ``unknown`` column cannot be declared ``NOT NULL``.
    +* An ``unknown`` column can be sorted on, but it cannot be bucketed or partitioned by ``identity``.
    +  Iceberg allows identity partitioning on ``unknown`` columns, but Presto's ``DROP COLUMN``
    +  rejects any column that is referenced by a partition spec (including historical ones), so a table
    +  partitioned on an ``unknown`` column can never have that column dropped, making cluster rollback
    +  impossible.  Avoid identity-partitioning ``unknown`` columns.
    +* Only top-level ``UNKNOWN`` columns are supported.  An ``unknown`` field nested inside a
    +  ``ROW``, ``ARRAY``, or ``MAP`` (e.g. ``ROW(url VARCHAR, extra UNKNOWN)``) is not yet
    +  supported and is rejected at ``CREATE TABLE`` and ``ADD COLUMN`` time.
    +* Creating a view or materialized view over a table that contains an ``unknown`` column fails with
    +  a "Column type is unknown" error.  As a workaround, exclude or cast the unknown column in the
    +  view's query (e.g. ``SELECT id, CAST(NULL AS INTEGER) AS x FROM t``).
    +* Promoting an ``unknown`` column to a concrete type (e.g. ``ALTER TABLE ... ALTER COLUMN ... SET DATA TYPE``)
    +  is not yet supported in Presto, though the Iceberg spec allows it.
    +* This feature is currently supported in the Java (JVM) connector only.  The Presto C++ (Velox-based)
    +  worker cannot currently create or write tables with ``unknown`` columns.
    +* **Rollback note:** tables that contain an ``unknown`` column cannot be read by Presto versions

    * **Note:** tables that contain an ``unknown`` column cannot be read by Presto versions
    

    steveburnett steveburnett commented on code on Oct 19, 2026 14:27 UTC
    Code Review
    presto-docs/src/main/sphinx/connector/iceberg.rst:1
    @@ -3237,10 +3239,67 @@ Map of PrestoDB types to the relevant Iceberg types:
         - ``STRUCT``
       * - ``SphericalGeography``
         - ``GEOGRAPHY``
    +  * - ``UNKNOWN``
    +    - ``UNKNOWN``
     
     
     No other types are supported.
     
    +Unknown type (Iceberg V3)
    +^^^^^^^^^^^^^^^^^^^^^^^^^
    +
    +Iceberg Format Version 3 adds the ``unknown`` type, for a column whose type is not known. Such a
    +column only ever holds null values: it is always optional, is not stored in the data files, and
    +always reads back as ``NULL``.
    +
    +A column of this type can be declared in ``CREATE TABLE``, ``ALTER TABLE ADD COLUMN``, and
    +``CREATE TABLE AS SELECT``::
    +
    +    CREATE TABLE iceberg.web.page_views (view_time TIMESTAMP, extra UNKNOWN) WITH ("format-version" = '3');
    +
    +    ALTER TABLE iceberg.web.page_views ADD COLUMN more UNKNOWN;
    +
    +    CREATE TABLE iceberg.web.page_view_copy WITH ("format-version" = '3') AS SELECT view_time, NULL AS extra FROM iceberg.web.page_views;
    +
    +``INSERT`` statements can write ``NULL`` to an ``unknown`` column or leave the column out entirely.
    +Writing any other value is an error, because the value cannot be stored.
    +
    +**Restrictions:**
    +
    +* The table must use Iceberg format version 3 or higher.
    +* An ``unknown`` column cannot be declared ``NOT NULL``.
    +* An ``unknown`` column can be sorted on, but it cannot be bucketed or partitioned by ``identity``.
    +  Iceberg allows identity partitioning on ``unknown`` columns, but Presto's ``DROP COLUMN``
    +  rejects any column that is referenced by a partition spec (including historical ones), so a table
    +  partitioned on an ``unknown`` column can never have that column dropped, making cluster rollback
    +  impossible.  Avoid identity-partitioning ``unknown`` columns.
    +* Only top-level ``UNKNOWN`` columns are supported.  An ``unknown`` field nested inside a
    +  ``ROW``, ``ARRAY``, or ``MAP`` (e.g. ``ROW(url VARCHAR, extra UNKNOWN)``) is not yet
    +  supported and is rejected at ``CREATE TABLE`` and ``ADD COLUMN`` time.
    +* Creating a view or materialized view over a table that contains an ``unknown`` column fails with
    +  a "Column type is unknown" error.  As a workaround, exclude or cast the unknown column in the
    +  view's query (e.g. ``SELECT id, CAST(NULL AS INTEGER) AS x FROM t``).
    +* Promoting an ``unknown`` column to a concrete type (e.g. ``ALTER TABLE ... ALTER COLUMN ... SET DATA TYPE``)
    +  is not yet supported in Presto, though the Iceberg spec allows it.
    +* This feature is currently supported in the Java (JVM) connector only.  The Presto C++ (Velox-based)
    +  worker cannot currently create or write tables with ``unknown`` columns.
    +* **Rollback note:** tables that contain an ``unknown`` column cannot be read by Presto versions
    +  that predate this feature.  Drop any ``unknown`` columns before rolling back a cluster.

      that predate rollback.  Drop any ``unknown`` columns before rolling back a cluster.
    

    steveburnett steveburnett commented on code on Oct 19, 2026 14:29 UTC
    Code Review
    presto-docs/src/main/sphinx/connector/iceberg.rst:1
    @@ -3237,10 +3239,67 @@ Map of PrestoDB types to the relevant Iceberg types:
         - ``STRUCT``
       * - ``SphericalGeography``
         - ``GEOGRAPHY``
    +  * - ``UNKNOWN``
    +    - ``UNKNOWN``
     
     
     No other types are supported.
     
    +Unknown type (Iceberg V3)
    +^^^^^^^^^^^^^^^^^^^^^^^^^
    +
    +Iceberg Format Version 3 adds the ``unknown`` type, for a column whose type is not known. Such a
    +column only ever holds null values: it is always optional, is not stored in the data files, and
    +always reads back as ``NULL``.
    +
    +A column of this type can be declared in ``CREATE TABLE``, ``ALTER TABLE ADD COLUMN``, and
    +``CREATE TABLE AS SELECT``::
    +
    +    CREATE TABLE iceberg.web.page_views (view_time TIMESTAMP, extra UNKNOWN) WITH ("format-version" = '3');
    +
    +    ALTER TABLE iceberg.web.page_views ADD COLUMN more UNKNOWN;
    +
    +    CREATE TABLE iceberg.web.page_view_copy WITH ("format-version" = '3') AS SELECT view_time, NULL AS extra FROM iceberg.web.page_views;
    +
    +``INSERT`` statements can write ``NULL`` to an ``unknown`` column or leave the column out entirely.
    +Writing any other value is an error, because the value cannot be stored.
    +
    +**Restrictions:**
    +
    +* The table must use Iceberg format version 3 or higher.
    +* An ``unknown`` column cannot be declared ``NOT NULL``.
    +* An ``unknown`` column can be sorted on, but it cannot be bucketed or partitioned by ``identity``.
    +  Iceberg allows identity partitioning on ``unknown`` columns, but Presto's ``DROP COLUMN``
    +  rejects any column that is referenced by a partition spec (including historical ones), so a table
    +  partitioned on an ``unknown`` column can never have that column dropped, making cluster rollback
    +  impossible.  Avoid identity-partitioning ``unknown`` columns.
    +* Only top-level ``UNKNOWN`` columns are supported.  An ``unknown`` field nested inside a
    +  ``ROW``, ``ARRAY``, or ``MAP`` (e.g. ``ROW(url VARCHAR, extra UNKNOWN)``) is not yet
    +  supported and is rejected at ``CREATE TABLE`` and ``ADD COLUMN`` time.
    +* Creating a view or materialized view over a table that contains an ``unknown`` column fails with
    +  a "Column type is unknown" error.  As a workaround, exclude or cast the unknown column in the
    +  view's query (e.g. ``SELECT id, CAST(NULL AS INTEGER) AS x FROM t``).
    +* Promoting an ``unknown`` column to a concrete type (e.g. ``ALTER TABLE ... ALTER COLUMN ... SET DATA TYPE``)
    +  is not yet supported in Presto, though the Iceberg spec allows it.
    +* This feature is currently supported in the Java (JVM) connector only.  The Presto C++ (Velox-based)
    +  worker cannot currently create or write tables with ``unknown`` columns.
    +* **Rollback note:** tables that contain an ``unknown`` column cannot be read by Presto versions
    +  that predate this feature.  Drop any ``unknown`` columns before rolling back a cluster.
    +  Rolling back while any ``unknown``-column table exists causes ``information_schema.columns``
    +  and JDBC ``getColumns`` to fail for the entire schema containing that table (and for the whole
    +  catalog on unfiltered listings).  Use the following query to find all affected tables before
    +  rolling back::
    +
    +      SELECT table_schema, table_name, column_name
    +      FROM iceberg.information_schema.columns
    +      WHERE data_type LIKE '%unknown%';
    +
    +* **Hive catalog limitation:** when using the ``HIVE`` catalog type, other Iceberg engines

    As a suggestion, move the action you want the user to do to the beginning of the paragraph and follow the action with the explanation, like this:

    Avoid adding unknown columns to tables in shared Hive metastore deployments. When using the HIVE catalog type, other Iceberg engines such as Spark or Flink cannot commit to a table that contains an unknown column, because Iceberg’s Hive metastore schema converter does not support the unknown type. This includes INSERT, expire_snapshots, rewrite_data_files, and rewrite_manifests. 
    

    steveburnett steveburnett requested changes on Oct 19, 2026 14:30 UTC
    Changes Requested Reviewer

    Thank you for the documentation! Just a few notes.

    mohsaka mohsaka commented on Oct 19, 2026 17:20 UTC
    Author

    @steveburnett Thanks for the review on the documentation. Comments addressed.

    steveburnett steveburnett commented on Oct 19, 2026 17:24 UTC
    Reviewer

    LGTM! (docs)

    Pull updated branch, new local doc build, looks good. Thank you!

    aditi-pandit aditi-pandit commented on code on Oct 20, 2026 00:13 UTC
    Code Review
    presto-docs/src/main/sphinx/connector/iceberg.rst:1
    @@ -3237,10 +3239,67 @@ Map of PrestoDB types to the relevant Iceberg types:
         - ``STRUCT``
       * - ``SphericalGeography``
         - ``GEOGRAPHY``
    +  * - ``UNKNOWN``
    +    - ``UNKNOWN``
     
     
     No other types are supported.
     
    +Unknown type (Iceberg V3)
    +^^^^^^^^^^^^^^^^^^^^^^^^^
    +
    +Iceberg Format Version 3 adds the ``unknown`` type, for a column whose type is not known. Such a
    +column only ever holds null values: it is always optional, is not stored in the data files, and
    +always reads back as ``NULL``.
    +
    +A column of this type can be declared in ``CREATE TABLE``, ``ALTER TABLE ADD COLUMN``, and
    +``CREATE TABLE AS SELECT``::
    +
    +    CREATE TABLE iceberg.web.page_views (view_time TIMESTAMP, extra UNKNOWN) WITH ("format-version" = '3');
    +
    +    ALTER TABLE iceberg.web.page_views ADD COLUMN more UNKNOWN;
    +
    +    CREATE TABLE iceberg.web.page_view_copy WITH ("format-version" = '3') AS SELECT view_time, NULL AS extra FROM iceberg.web.page_views;
    +
    +``INSERT`` statements can write ``NULL`` to an ``unknown`` column or leave the column out entirely.
    +Writing any other value is an error, because the value cannot be stored.
    +
    +**Restrictions:**
    +
    +* The table must use Iceberg format version 3 or higher.
    +* An ``unknown`` column cannot be declared ``NOT NULL``.
    +* An ``unknown`` column can be sorted on, but it cannot be bucketed or partitioned by ``identity``.
    +  Iceberg allows identity partitioning on ``unknown`` columns, but Presto's ``DROP COLUMN``
    +  rejects any column that is referenced by a partition spec (including historical ones), so a table
    +  partitioned on an ``unknown`` column can never have that column dropped, making cluster rollback
    +  impossible.  Avoid identity-partitioning ``unknown`` columns.
    +* Only top-level ``UNKNOWN`` columns are supported.  An ``unknown`` field nested inside a
    +  ``ROW``, ``ARRAY``, or ``MAP`` (for example, ``ROW(url VARCHAR, extra UNKNOWN)``) is not yet
    +  supported and is rejected at ``CREATE TABLE`` and ``ADD COLUMN`` time.
    +* Creating a view or materialized view over a table that contains an ``unknown`` column fails with
    +  a "Column type is unknown" error.  As a workaround, exclude or cast the unknown column in the
    +  view's query (for instance, ``SELECT id, CAST(NULL AS INTEGER) AS x FROM t``).
    +* Promoting an ``unknown`` column to a concrete type, such as ``ALTER TABLE ... ALTER COLUMN ... SET DATA TYPE``,
    +  is not yet supported in Presto, though the Iceberg spec allows it.
    +* This feature is currently supported in the Java (JVM) connector only.  The Presto C++ (Velox-based)

    @mohsaka : What are the technical limitations because of which this isn't implemented in C++ ? Please can you scope them out.

    mohsaka mohsaka commented on code on Oct 20, 2026 03:07 UTC
    Code Review
    presto-docs/src/main/sphinx/connector/iceberg.rst:1
    @@ -3237,10 +3239,67 @@ Map of PrestoDB types to the relevant Iceberg types:
         - ``STRUCT``
       * - ``SphericalGeography``
         - ``GEOGRAPHY``
    +  * - ``UNKNOWN``
    +    - ``UNKNOWN``
     
     
     No other types are supported.
     
    +Unknown type (Iceberg V3)
    +^^^^^^^^^^^^^^^^^^^^^^^^^
    +
    +Iceberg Format Version 3 adds the ``unknown`` type, for a column whose type is not known. Such a
    +column only ever holds null values: it is always optional, is not stored in the data files, and
    +always reads back as ``NULL``.
    +
    +A column of this type can be declared in ``CREATE TABLE``, ``ALTER TABLE ADD COLUMN``, and
    +``CREATE TABLE AS SELECT``::
    +
    +    CREATE TABLE iceberg.web.page_views (view_time TIMESTAMP, extra UNKNOWN) WITH ("format-version" = '3');
    +
    +    ALTER TABLE iceberg.web.page_views ADD COLUMN more UNKNOWN;
    +
    +    CREATE TABLE iceberg.web.page_view_copy WITH ("format-version" = '3') AS SELECT view_time, NULL AS extra FROM iceberg.web.page_views;
    +
    +``INSERT`` statements can write ``NULL`` to an ``unknown`` column or leave the column out entirely.
    +Writing any other value is an error, because the value cannot be stored.
    +
    +**Restrictions:**
    +
    +* The table must use Iceberg format version 3 or higher.
    +* An ``unknown`` column cannot be declared ``NOT NULL``.
    +* An ``unknown`` column can be sorted on, but it cannot be bucketed or partitioned by ``identity``.
    +  Iceberg allows identity partitioning on ``unknown`` columns, but Presto's ``DROP COLUMN``
    +  rejects any column that is referenced by a partition spec (including historical ones), so a table
    +  partitioned on an ``unknown`` column can never have that column dropped, making cluster rollback
    +  impossible.  Avoid identity-partitioning ``unknown`` columns.
    +* Only top-level ``UNKNOWN`` columns are supported.  An ``unknown`` field nested inside a
    +  ``ROW``, ``ARRAY``, or ``MAP`` (for example, ``ROW(url VARCHAR, extra UNKNOWN)``) is not yet
    +  supported and is rejected at ``CREATE TABLE`` and ``ADD COLUMN`` time.
    +* Creating a view or materialized view over a table that contains an ``unknown`` column fails with
    +  a "Column type is unknown" error.  As a workaround, exclude or cast the unknown column in the
    +  view's query (for instance, ``SELECT id, CAST(NULL AS INTEGER) AS x FROM t``).
    +* Promoting an ``unknown`` column to a concrete type, such as ``ALTER TABLE ... ALTER COLUMN ... SET DATA TYPE``,
    +  is not yet supported in Presto, though the Iceberg spec allows it.
    +* This feature is currently supported in the Java (JVM) connector only.  The Presto C++ (Velox-based)

    For this PR specifically, the HiveTypeParser changes from here
    https://github.com/facebookincubator/velox/pull/18775

    As well as a few Prestissimo changes.

    aditi-pandit aditi-pandit commented on code on Oct 20, 2026 22:26 UTC
    Code Review
    presto-docs/src/main/sphinx/connector/iceberg.rst:1
    @@ -3237,10 +3239,67 @@ Map of PrestoDB types to the relevant Iceberg types:
         - ``STRUCT``
       * - ``SphericalGeography``
         - ``GEOGRAPHY``
    +  * - ``UNKNOWN``
    +    - ``UNKNOWN``
     
     
     No other types are supported.
     
    +Unknown type (Iceberg V3)
    +^^^^^^^^^^^^^^^^^^^^^^^^^
    +
    +Iceberg Format Version 3 adds the ``unknown`` type, for a column whose type is not known. Such a
    +column only ever holds null values: it is always optional, is not stored in the data files, and
    +always reads back as ``NULL``.
    +
    +A column of this type can be declared in ``CREATE TABLE``, ``ALTER TABLE ADD COLUMN``, and
    +``CREATE TABLE AS SELECT``::
    +
    +    CREATE TABLE iceberg.web.page_views (view_time TIMESTAMP, extra UNKNOWN) WITH ("format-version" = '3');
    +
    +    ALTER TABLE iceberg.web.page_views ADD COLUMN more UNKNOWN;
    +
    +    CREATE TABLE iceberg.web.page_view_copy WITH ("format-version" = '3') AS SELECT view_time, NULL AS extra FROM iceberg.web.page_views;
    +
    +``INSERT`` statements can write ``NULL`` to an ``unknown`` column or leave the column out entirely.
    +Writing any other value is an error, because the value cannot be stored.
    +
    +**Restrictions:**
    +
    +* The table must use Iceberg format version 3 or higher.
    +* An ``unknown`` column cannot be declared ``NOT NULL``.
    +* An ``unknown`` column can be sorted on, but it cannot be bucketed or partitioned by ``identity``.
    +  Iceberg allows identity partitioning on ``unknown`` columns, but Presto's ``DROP COLUMN``
    +  rejects any column that is referenced by a partition spec (including historical ones), so a table
    +  partitioned on an ``unknown`` column can never have that column dropped, making cluster rollback
    +  impossible.  Avoid identity-partitioning ``unknown`` columns.
    +* Only top-level ``UNKNOWN`` columns are supported.  An ``unknown`` field nested inside a
    +  ``ROW``, ``ARRAY``, or ``MAP`` (for example, ``ROW(url VARCHAR, extra UNKNOWN)``) is not yet
    +  supported and is rejected at ``CREATE TABLE`` and ``ADD COLUMN`` time.
    +* Creating a view or materialized view over a table that contains an ``unknown`` column fails with
    +  a "Column type is unknown" error.  As a workaround, exclude or cast the unknown column in the
    +  view's query (for instance, ``SELECT id, CAST(NULL AS INTEGER) AS x FROM t``).
    +* Promoting an ``unknown`` column to a concrete type, such as ``ALTER TABLE ... ALTER COLUMN ... SET DATA TYPE``,
    +  is not yet supported in Presto, though the Iceberg spec allows it.
    +* This feature is currently supported in the Java (JVM) connector only.  The Presto C++ (Velox-based)

    I see. We should be able to finalize and merge that PR. So there isn't any blocking issue as such. Thanks.

    mohsaka mohsaka commented on Oct 20, 2026 23:15 UTC
    Author

    @aditi-pandit Velox PR opened here: https://github.com/facebookincubator/velox/pull/19685

    nmahadevuni nmahadevuni commented on Oct 21, 2026 06:34 UTC
    Contributor

    Thanks @mohsaka. Had some nits and test suggestions.

    1) Commit message is inaccurate in three places:
       - "IcebergPageSourceProvider injects a NULL block for UNKNOWN columns": it doesn't. Nulls come from the missing-column path, and this file only changes predicate and default-value handling.
       - "RewriteDataFilesProcedure rejects tables with UNKNOWN columns": it only rejects all-unknown tables or nested unknown.
       - "LogicalPlanner/QueryPlanner emit bare NULLs": correct, but nullValueOfType exists only in QueryPlanner. testCtasWithUnknownColumn's comment also points to LogicalPlanner.nullValueOfType, which doesn't exist.
    
    2) Add a release note to say "Iceberg supports Unknown columns write and read".
    
    3) Add an engine-level test that a non-Iceberg connector without the capability still rejects CREATE TABLE (x UNKNOWN) and CTAS SELECT NULL x, e.g. with Hive or memory.
    

    prestodb-ci prestodb-ci commented on Oct 29, 2026 09:44 UTC
    Contributor

    @unidevel imported this issue as lakehouse/presto #6627

    aditi-pandit aditi-pandit commented on code on Oct 30, 2026 00:19 UTC
    Code Review
    presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java:1
    @@ -733,19 +760,32 @@ public void createTable(ConnectorSession session, ConnectorTableMetadata tableMe
         {
             shouldRunInAutoCommitTransaction("CREATE TABLE");
             Optional<ConnectorNewTableLayout> layout = getNewTableLayout(session, tableMetadata);
    -        finishCreateTable(session, beginCreateTable(session, tableMetadata, layout), ImmutableList.of(), ImmutableList.of());
    +        // Bypass finishCreateTable (which rejects all-UNKNOWN CTAS) so that plain DDL can create
    +        // an all-UNKNOWN table; writes to such a table are rejected later at INSERT time.
    +        finishInsert(session, (IcebergOutputTableHandle) beginCreateTable(session, tableMetadata, layout), ImmutableList.of());

    It reads quite odd that finishCreateTable calls finishInsert table. If createTable allows for an all UNKNOWN table, then the validation logic doesn't belong to finishCreateTable.

    aditi-pandit aditi-pandit commented on code on Oct 30, 2026 00:20 UTC
    Code Review
    presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java:1
    @@ -1617,6 +1657,23 @@ public void addColumn(ConnectorSession session, ConnectorTableHandle tableHandle
             verify(handle.getIcebergTableName().getTableType() == DATA, "only the data table can have columns added");
             validateNoBranchSpecified(handle, "ADD COLUMN");
             Table icebergTable = getIcebergTable(session, handle.getSchemaTableName());
    +        // Reject an unknown-type column on a pre-V3 table rather than accepting the schema change

    This logic is repeated. Please abstract a common function for it.

    aditi-pandit aditi-pandit commented on code on Oct 30, 2026 00:23 UTC
    Code Review
    presto-tests/src/test/java/com/facebook/presto/tests/TestBlackHoleSmoke.java:1
    @@ -350,6 +350,28 @@ public void pageProcessingDelay()
             assertThatQueryReturnsValue("DROP TABLE nation", true);
         }
     
    +    @Test

    Why did you add this ? Seems unrelated no ?

    aditi-pandit aditi-pandit commented on code on Oct 30, 2026 00:25 UTC
    Code Review
    presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergPageSourceProvider.java:1
    @@ -1228,7 +1230,10 @@ private static Optional<Object> getInitialDefaultValue(IcebergColumnHandle colum
             if (!column.hasDefaultValue()) {
                 return Optional.empty();
             }
    -        return Optional.of(IcebergUtil.deserializeIcebergValue(
    +        if (column.getType().equals(UNKNOWN)) {

    Why is initial default value of UNKNOWN not NULL ?

    aditi-pandit aditi-pandit commented on code on Oct 30, 2026 00:27 UTC
    Code Review
    presto-iceberg/src/main/java/com/facebook/presto/iceberg/UnknownFields.java:1
    @@ -0,0 +1,85 @@
    +/*
    + * Licensed under the Apache License, Version 2.0 (the "License");
    + * you may not use this file except in compliance with the License.
    + * You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package com.facebook.presto.iceberg;
    +
    +import com.facebook.presto.spi.PrestoException;
    +import org.apache.iceberg.Schema;
    +import org.apache.iceberg.types.Type;
    +import org.apache.iceberg.types.Types;
    +
    +import java.util.List;
    +
    +import static com.facebook.presto.spi.StandardErrorCode.NOT_SUPPORTED;
    +import static com.google.common.collect.ImmutableList.toImmutableList;
    +import static java.lang.String.format;
    +
    +/**
    + * A field of type {@code unknown} is never stored in a data file: it always reads back as null.
    + * Iceberg leaves such a field out of the Parquet and ORC schemas it writes, so Presto has to leave
    + * it out of both the schema it writes and the values it writes.
    + */
    +public final class UnknownFields

    Nit : Maybe rename this to UnknownUtils ?

    mohsaka mohsaka commented on code on Oct 30, 2026 21:01 UTC
    Code Review
    presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java:1
    @@ -733,19 +760,32 @@ public void createTable(ConnectorSession session, ConnectorTableMetadata tableMe
         {
             shouldRunInAutoCommitTransaction("CREATE TABLE");
             Optional<ConnectorNewTableLayout> layout = getNewTableLayout(session, tableMetadata);
    -        finishCreateTable(session, beginCreateTable(session, tableMetadata, layout), ImmutableList.of(), ImmutableList.of());
    +        // Bypass finishCreateTable (which rejects all-UNKNOWN CTAS) so that plain DDL can create
    +        // an all-UNKNOWN table; writes to such a table are rejected later at INSERT time.
    +        finishInsert(session, (IcebergOutputTableHandle) beginCreateTable(session, tableMetadata, layout), ImmutableList.of());

    Refactored out the logic to prevent usage of finishInsert code to bypass.

    mohsaka mohsaka commented on code on Oct 30, 2026 21:14 UTC
    Code Review
    presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java:1
    @@ -1617,6 +1657,23 @@ public void addColumn(ConnectorSession session, ConnectorTableHandle tableHandle
             verify(handle.getIcebergTableName().getTableType() == DATA, "only the data table can have columns added");
             validateNoBranchSpecified(handle, "ADD COLUMN");
             Table icebergTable = getIcebergTable(session, handle.getSchemaTableName());
    +        // Reject an unknown-type column on a pre-V3 table rather than accepting the schema change

    Combined into validateUnknownColumnType

    mohsaka mohsaka commented on code on Oct 30, 2026 21:15 UTC
    Code Review
    presto-tests/src/test/java/com/facebook/presto/tests/TestBlackHoleSmoke.java:1
    @@ -350,6 +350,28 @@ public void pageProcessingDelay()
             assertThatQueryReturnsValue("DROP TABLE nation", true);
         }
     
    +    @Test

    These tests were added because we need to make sure that UNKNOWN columns are rejected by connectors that have not been set up to support the UNKNOWN column type.

    mohsaka mohsaka commented on code on Oct 30, 2026 21:53 UTC
    Code Review
    presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergPageSourceProvider.java:1
    @@ -1228,7 +1230,10 @@ private static Optional<Object> getInitialDefaultValue(IcebergColumnHandle colum
             if (!column.hasDefaultValue()) {
                 return Optional.empty();
             }
    -        return Optional.of(IcebergUtil.deserializeIcebergValue(
    +        if (column.getType().equals(UNKNOWN)) {

    Actually you are right, it should be NULL, which is what deserializeIcebergValue returns for it. Removed the if case.

    mohsaka mohsaka commented on code on Oct 30, 2026 22:01 UTC
    Code Review
    presto-iceberg/src/main/java/com/facebook/presto/iceberg/UnknownFields.java:1
    @@ -0,0 +1,85 @@
    +/*
    + * Licensed under the Apache License, Version 2.0 (the "License");
    + * you may not use this file except in compliance with the License.
    + * You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package com.facebook.presto.iceberg;
    +
    +import com.facebook.presto.spi.PrestoException;
    +import org.apache.iceberg.Schema;
    +import org.apache.iceberg.types.Type;
    +import org.apache.iceberg.types.Types;
    +
    +import java.util.List;
    +
    +import static com.facebook.presto.spi.StandardErrorCode.NOT_SUPPORTED;
    +import static com.google.common.collect.ImmutableList.toImmutableList;
    +import static java.lang.String.format;
    +
    +/**
    + * A field of type {@code unknown} is never stored in a data file: it always reads back as null.
    + * Iceberg leaves such a field out of the Parquet and ORC schemas it writes, so Presto has to leave
    + * it out of both the schema it writes and the values it writes.
    + */
    +public final class UnknownFields

    Renamed. Thanks!

    aditi-pandit aditi-pandit commented on code on Oct 30, 2026 23:29 UTC
    Code Review
    presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergUnknownType.java:1
    @@ -0,0 +1,297 @@
    +/*
    + * Licensed under the Apache License, Version 2.0 (the "License");
    + * you may not use this file except in compliance with the License.
    + * You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package com.facebook.presto.nativeworker;
    +
    +import com.facebook.presto.Session;
    +import com.facebook.presto.testing.ExpectedQueryRunner;
    +import com.facebook.presto.testing.QueryRunner;
    +import com.facebook.presto.tests.AbstractTestQueryFramework;
    +import org.testng.annotations.Test;
    +
    +import static com.facebook.presto.iceberg.IcebergQueryRunner.ICEBERG_CATALOG;
    +import static com.facebook.presto.iceberg.IcebergSessionProperties.PUSHDOWN_FILTER_ENABLED;
    +import static com.facebook.presto.nativeworker.PrestoNativeQueryRunnerUtils.ICEBERG_DEFAULT_STORAGE_FORMAT;
    +
    +public class TestPrestoNativeIcebergUnknownType
    +        extends AbstractTestQueryFramework
    +{
    +    @Override
    +    protected QueryRunner createQueryRunner()
    +            throws Exception
    +    {
    +        return PrestoNativeQueryRunnerUtils.nativeIcebergQueryRunnerBuilder()
    +                .setStorageFormat(ICEBERG_DEFAULT_STORAGE_FORMAT)
    +                .setAddStorageFormatToPath(true)
    +                .build();
    +    }
    +
    +    @Override
    +    protected ExpectedQueryRunner createExpectedQueryRunner()
    +            throws Exception
    +    {
    +        return PrestoNativeQueryRunnerUtils.javaIcebergQueryRunnerBuilder()
    +                .setStorageFormat(ICEBERG_DEFAULT_STORAGE_FORMAT)
    +                .setAddStorageFormatToPath(true)
    +                .build();
    +    }
    +
    +    @Override
    +    protected void createTables()
    +    {
    +        QueryRunner javaRunner = (QueryRunner) getExpectedQueryRunner();
    +
    +        javaRunner.execute("DROP TABLE IF EXISTS test_native_unknown_read");
    +        javaRunner.execute("CREATE TABLE test_native_unknown_read (id INTEGER, name VARCHAR) WITH (\"format-version\" = '3')");
    +        javaRunner.execute("INSERT INTO test_native_unknown_read VALUES (1, 'Alice'), (2, 'Bob')");
    +        javaRunner.execute("ALTER TABLE test_native_unknown_read ADD COLUMN unknown_column UNKNOWN");
    +
    +        javaRunner.execute("DROP TABLE IF EXISTS test_native_unknown_predicates");
    +        javaRunner.execute("CREATE TABLE test_native_unknown_predicates (id INTEGER, unknown_column UNKNOWN) WITH (\"format-version\" = '3')");
    +        javaRunner.execute("INSERT INTO test_native_unknown_predicates VALUES (1, NULL), (2, NULL)");
    +
    +        javaRunner.execute("DROP TABLE IF EXISTS test_native_unknown_scalar");
    +        javaRunner.execute("CREATE TABLE test_native_unknown_scalar (id INTEGER, unknown_column UNKNOWN) WITH (\"format-version\" = '3')");
    +        javaRunner.execute("INSERT INTO test_native_unknown_scalar VALUES (1, NULL)");
    +
    +        javaRunner.execute("DROP TABLE IF EXISTS test_native_unknown_aggregations");
    +        javaRunner.execute("CREATE TABLE test_native_unknown_aggregations (id INTEGER) WITH (\"format-version\" = '3')");
    +        javaRunner.execute("INSERT INTO test_native_unknown_aggregations VALUES 1, 2");
    +        javaRunner.execute("ALTER TABLE test_native_unknown_aggregations ADD COLUMN unknown_column UNKNOWN");
    +
    +        javaRunner.execute("DROP TABLE IF EXISTS test_native_unknown_partitioned");
    +        javaRunner.execute("CREATE TABLE test_native_unknown_partitioned (id INTEGER, unknown_column UNKNOWN) WITH (\"format-version\" = '3', partitioning = ARRAY['unknown_column'])");
    +        javaRunner.execute("INSERT INTO test_native_unknown_partitioned VALUES (1, NULL), (2, NULL)");
    +
    +        javaRunner.execute("DROP TABLE IF EXISTS test_native_unknown_metadata");
    +        javaRunner.execute("CREATE TABLE test_native_unknown_metadata (id INTEGER, name VARCHAR) WITH (\"format-version\" = '3', partitioning = ARRAY['id'])");
    +        javaRunner.execute("INSERT INTO test_native_unknown_metadata VALUES (1, 'Alice'), (2, 'Bob')");
    +        javaRunner.execute("ALTER TABLE test_native_unknown_metadata ADD COLUMN unknown_column UNKNOWN");
    +    }
    +
    +    @Test
    +    public void testReadUnknownColumn()
    +    {
    +        // An unknown column is never stored in a data file; the native worker must synthesise NULLs.
    +        assertQuery("SELECT * FROM test_native_unknown_read", "VALUES (1, 'Alice', NULL), (2, 'Bob', NULL)");
    +        assertQuery("SELECT unknown_column FROM test_native_unknown_read", "VALUES NULL, NULL");
    +        assertQuery("SELECT count(*) FROM test_native_unknown_read", "VALUES 2");
    +        assertQuery("SELECT count(unknown_column) FROM test_native_unknown_read", "VALUES 0");
    +        assertQuery("SELECT id FROM test_native_unknown_read WHERE name = 'Alice'", "VALUES 1");
    +    }
    +
    +    @Test
    +    public void testReadUnknownColumnWithFilterPushdown()
    +    {
    +        // Filter pushdown is native-only; planning must succeed even when the schema contains an unknown column.
    +        Session pushdown = Session.builder(getSession())
    +                .setCatalogSessionProperty(ICEBERG_CATALOG, PUSHDOWN_FILTER_ENABLED, "true")
    +                .build();
    +        assertQuerySucceeds(pushdown, "EXPLAIN SELECT * FROM test_native_unknown_read WHERE id = 1");
    +        assertQuery(pushdown, "SELECT id FROM test_native_unknown_read WHERE id = 1", "VALUES 1");
    +    }
    +
    +    @Test
    +    public void testWriteUnknownColumn()
    +    {
    +        assertQuerySucceeds("DROP TABLE IF EXISTS test_native_unknown_write");
    +        try {
    +            assertQuerySucceeds("CREATE TABLE test_native_unknown_write (id INTEGER, unknown_column UNKNOWN) WITH (\"format-version\" = '3')");
    +            assertQuerySucceeds("INSERT INTO test_native_unknown_write VALUES (1, NULL)");
    +            assertQuerySucceeds("INSERT INTO test_native_unknown_write (id) VALUES 2");
    +            assertQuerySucceeds("INSERT INTO test_native_unknown_write SELECT 3, NULL");
    +            assertQuery("SELECT * FROM test_native_unknown_write", "VALUES (1, NULL), (2, NULL), (3, NULL)");
    +            assertQuery("SELECT count(unknown_column) FROM test_native_unknown_write", "VALUES 0");
    +        }
    +        finally {
    +            assertQuerySucceeds("DROP TABLE IF EXISTS test_native_unknown_write");
    +        }
    +    }
    +
    +    @Test
    +    public void testAddUnknownColumn()
    +    {
    +        assertQuerySucceeds("DROP TABLE IF EXISTS test_native_unknown_add_column");
    +        try {

    why is this code in a try block ?

    aditi-pandit aditi-pandit commented on code on Oct 30, 2026 23:29 UTC
    Code Review
    presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergUnknownType.java:1
    @@ -0,0 +1,297 @@
    +/*
    + * Licensed under the Apache License, Version 2.0 (the "License");
    + * you may not use this file except in compliance with the License.
    + * You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package com.facebook.presto.nativeworker;
    +
    +import com.facebook.presto.Session;
    +import com.facebook.presto.testing.ExpectedQueryRunner;
    +import com.facebook.presto.testing.QueryRunner;
    +import com.facebook.presto.tests.AbstractTestQueryFramework;
    +import org.testng.annotations.Test;
    +
    +import static com.facebook.presto.iceberg.IcebergQueryRunner.ICEBERG_CATALOG;
    +import static com.facebook.presto.iceberg.IcebergSessionProperties.PUSHDOWN_FILTER_ENABLED;
    +import static com.facebook.presto.nativeworker.PrestoNativeQueryRunnerUtils.ICEBERG_DEFAULT_STORAGE_FORMAT;
    +
    +public class TestPrestoNativeIcebergUnknownType
    +        extends AbstractTestQueryFramework
    +{
    +    @Override
    +    protected QueryRunner createQueryRunner()
    +            throws Exception
    +    {
    +        return PrestoNativeQueryRunnerUtils.nativeIcebergQueryRunnerBuilder()
    +                .setStorageFormat(ICEBERG_DEFAULT_STORAGE_FORMAT)
    +                .setAddStorageFormatToPath(true)
    +                .build();
    +    }
    +
    +    @Override
    +    protected ExpectedQueryRunner createExpectedQueryRunner()
    +            throws Exception
    +    {
    +        return PrestoNativeQueryRunnerUtils.javaIcebergQueryRunnerBuilder()
    +                .setStorageFormat(ICEBERG_DEFAULT_STORAGE_FORMAT)
    +                .setAddStorageFormatToPath(true)
    +                .build();
    +    }
    +
    +    @Override
    +    protected void createTables()
    +    {
    +        QueryRunner javaRunner = (QueryRunner) getExpectedQueryRunner();
    +
    +        javaRunner.execute("DROP TABLE IF EXISTS test_native_unknown_read");
    +        javaRunner.execute("CREATE TABLE test_native_unknown_read (id INTEGER, name VARCHAR) WITH (\"format-version\" = '3')");
    +        javaRunner.execute("INSERT INTO test_native_unknown_read VALUES (1, 'Alice'), (2, 'Bob')");
    +        javaRunner.execute("ALTER TABLE test_native_unknown_read ADD COLUMN unknown_column UNKNOWN");
    +
    +        javaRunner.execute("DROP TABLE IF EXISTS test_native_unknown_predicates");
    +        javaRunner.execute("CREATE TABLE test_native_unknown_predicates (id INTEGER, unknown_column UNKNOWN) WITH (\"format-version\" = '3')");
    +        javaRunner.execute("INSERT INTO test_native_unknown_predicates VALUES (1, NULL), (2, NULL)");
    +
    +        javaRunner.execute("DROP TABLE IF EXISTS test_native_unknown_scalar");
    +        javaRunner.execute("CREATE TABLE test_native_unknown_scalar (id INTEGER, unknown_column UNKNOWN) WITH (\"format-version\" = '3')");
    +        javaRunner.execute("INSERT INTO test_native_unknown_scalar VALUES (1, NULL)");
    +
    +        javaRunner.execute("DROP TABLE IF EXISTS test_native_unknown_aggregations");
    +        javaRunner.execute("CREATE TABLE test_native_unknown_aggregations (id INTEGER) WITH (\"format-version\" = '3')");
    +        javaRunner.execute("INSERT INTO test_native_unknown_aggregations VALUES 1, 2");
    +        javaRunner.execute("ALTER TABLE test_native_unknown_aggregations ADD COLUMN unknown_column UNKNOWN");
    +
    +        javaRunner.execute("DROP TABLE IF EXISTS test_native_unknown_partitioned");
    +        javaRunner.execute("CREATE TABLE test_native_unknown_partitioned (id INTEGER, unknown_column UNKNOWN) WITH (\"format-version\" = '3', partitioning = ARRAY['unknown_column'])");
    +        javaRunner.execute("INSERT INTO test_native_unknown_partitioned VALUES (1, NULL), (2, NULL)");
    +
    +        javaRunner.execute("DROP TABLE IF EXISTS test_native_unknown_metadata");
    +        javaRunner.execute("CREATE TABLE test_native_unknown_metadata (id INTEGER, name VARCHAR) WITH (\"format-version\" = '3', partitioning = ARRAY['id'])");
    +        javaRunner.execute("INSERT INTO test_native_unknown_metadata VALUES (1, 'Alice'), (2, 'Bob')");
    +        javaRunner.execute("ALTER TABLE test_native_unknown_metadata ADD COLUMN unknown_column UNKNOWN");
    +    }
    +
    +    @Test
    +    public void testReadUnknownColumn()
    +    {
    +        // An unknown column is never stored in a data file; the native worker must synthesise NULLs.
    +        assertQuery("SELECT * FROM test_native_unknown_read", "VALUES (1, 'Alice', NULL), (2, 'Bob', NULL)");
    +        assertQuery("SELECT unknown_column FROM test_native_unknown_read", "VALUES NULL, NULL");
    +        assertQuery("SELECT count(*) FROM test_native_unknown_read", "VALUES 2");
    +        assertQuery("SELECT count(unknown_column) FROM test_native_unknown_read", "VALUES 0");
    +        assertQuery("SELECT id FROM test_native_unknown_read WHERE name = 'Alice'", "VALUES 1");
    +    }
    +
    +    @Test
    +    public void testReadUnknownColumnWithFilterPushdown()
    +    {
    +        // Filter pushdown is native-only; planning must succeed even when the schema contains an unknown column.
    +        Session pushdown = Session.builder(getSession())
    +                .setCatalogSessionProperty(ICEBERG_CATALOG, PUSHDOWN_FILTER_ENABLED, "true")
    +                .build();
    +        assertQuerySucceeds(pushdown, "EXPLAIN SELECT * FROM test_native_unknown_read WHERE id = 1");
    +        assertQuery(pushdown, "SELECT id FROM test_native_unknown_read WHERE id = 1", "VALUES 1");
    +    }
    +
    +    @Test
    +    public void testWriteUnknownColumn()
    +    {
    +        assertQuerySucceeds("DROP TABLE IF EXISTS test_native_unknown_write");
    +        try {

    Why is this code in a try block ?

    aditi-pandit aditi-pandit commented on Oct 30, 2026 23:32 UTC
    Reviewer

    @mohsaka : Thanks for this code. It looks good.

    Had a question in general. Several of the tests have a try block around a set of assertQuery... or assertQuerySucceeds calls. Why is it needed ?

    mohsaka mohsaka commented on code on Oct 31, 2026 01:47 UTC
    Code Review
    presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergUnknownType.java:1
    @@ -0,0 +1,297 @@
    +/*
    + * Licensed under the Apache License, Version 2.0 (the "License");
    + * you may not use this file except in compliance with the License.
    + * You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package com.facebook.presto.nativeworker;
    +
    +import com.facebook.presto.Session;
    +import com.facebook.presto.testing.ExpectedQueryRunner;
    +import com.facebook.presto.testing.QueryRunner;
    +import com.facebook.presto.tests.AbstractTestQueryFramework;
    +import org.testng.annotations.Test;
    +
    +import static com.facebook.presto.iceberg.IcebergQueryRunner.ICEBERG_CATALOG;
    +import static com.facebook.presto.iceberg.IcebergSessionProperties.PUSHDOWN_FILTER_ENABLED;
    +import static com.facebook.presto.nativeworker.PrestoNativeQueryRunnerUtils.ICEBERG_DEFAULT_STORAGE_FORMAT;
    +
    +public class TestPrestoNativeIcebergUnknownType
    +        extends AbstractTestQueryFramework
    +{
    +    @Override
    +    protected QueryRunner createQueryRunner()
    +            throws Exception
    +    {
    +        return PrestoNativeQueryRunnerUtils.nativeIcebergQueryRunnerBuilder()
    +                .setStorageFormat(ICEBERG_DEFAULT_STORAGE_FORMAT)
    +                .setAddStorageFormatToPath(true)
    +                .build();
    +    }
    +
    +    @Override
    +    protected ExpectedQueryRunner createExpectedQueryRunner()
    +            throws Exception
    +    {
    +        return PrestoNativeQueryRunnerUtils.javaIcebergQueryRunnerBuilder()
    +                .setStorageFormat(ICEBERG_DEFAULT_STORAGE_FORMAT)
    +                .setAddStorageFormatToPath(true)
    +                .build();
    +    }
    +
    +    @Override
    +    protected void createTables()
    +    {
    +        QueryRunner javaRunner = (QueryRunner) getExpectedQueryRunner();
    +
    +        javaRunner.execute("DROP TABLE IF EXISTS test_native_unknown_read");
    +        javaRunner.execute("CREATE TABLE test_native_unknown_read (id INTEGER, name VARCHAR) WITH (\"format-version\" = '3')");
    +        javaRunner.execute("INSERT INTO test_native_unknown_read VALUES (1, 'Alice'), (2, 'Bob')");
    +        javaRunner.execute("ALTER TABLE test_native_unknown_read ADD COLUMN unknown_column UNKNOWN");
    +
    +        javaRunner.execute("DROP TABLE IF EXISTS test_native_unknown_predicates");
    +        javaRunner.execute("CREATE TABLE test_native_unknown_predicates (id INTEGER, unknown_column UNKNOWN) WITH (\"format-version\" = '3')");
    +        javaRunner.execute("INSERT INTO test_native_unknown_predicates VALUES (1, NULL), (2, NULL)");
    +
    +        javaRunner.execute("DROP TABLE IF EXISTS test_native_unknown_scalar");
    +        javaRunner.execute("CREATE TABLE test_native_unknown_scalar (id INTEGER, unknown_column UNKNOWN) WITH (\"format-version\" = '3')");
    +        javaRunner.execute("INSERT INTO test_native_unknown_scalar VALUES (1, NULL)");
    +
    +        javaRunner.execute("DROP TABLE IF EXISTS test_native_unknown_aggregations");
    +        javaRunner.execute("CREATE TABLE test_native_unknown_aggregations (id INTEGER) WITH (\"format-version\" = '3')");
    +        javaRunner.execute("INSERT INTO test_native_unknown_aggregations VALUES 1, 2");
    +        javaRunner.execute("ALTER TABLE test_native_unknown_aggregations ADD COLUMN unknown_column UNKNOWN");
    +
    +        javaRunner.execute("DROP TABLE IF EXISTS test_native_unknown_partitioned");
    +        javaRunner.execute("CREATE TABLE test_native_unknown_partitioned (id INTEGER, unknown_column UNKNOWN) WITH (\"format-version\" = '3', partitioning = ARRAY['unknown_column'])");
    +        javaRunner.execute("INSERT INTO test_native_unknown_partitioned VALUES (1, NULL), (2, NULL)");
    +
    +        javaRunner.execute("DROP TABLE IF EXISTS test_native_unknown_metadata");
    +        javaRunner.execute("CREATE TABLE test_native_unknown_metadata (id INTEGER, name VARCHAR) WITH (\"format-version\" = '3', partitioning = ARRAY['id'])");
    +        javaRunner.execute("INSERT INTO test_native_unknown_metadata VALUES (1, 'Alice'), (2, 'Bob')");
    +        javaRunner.execute("ALTER TABLE test_native_unknown_metadata ADD COLUMN unknown_column UNKNOWN");
    +    }
    +
    +    @Test
    +    public void testReadUnknownColumn()
    +    {
    +        // An unknown column is never stored in a data file; the native worker must synthesise NULLs.
    +        assertQuery("SELECT * FROM test_native_unknown_read", "VALUES (1, 'Alice', NULL), (2, 'Bob', NULL)");
    +        assertQuery("SELECT unknown_column FROM test_native_unknown_read", "VALUES NULL, NULL");
    +        assertQuery("SELECT count(*) FROM test_native_unknown_read", "VALUES 2");
    +        assertQuery("SELECT count(unknown_column) FROM test_native_unknown_read", "VALUES 0");
    +        assertQuery("SELECT id FROM test_native_unknown_read WHERE name = 'Alice'", "VALUES 1");
    +    }
    +
    +    @Test
    +    public void testReadUnknownColumnWithFilterPushdown()
    +    {
    +        // Filter pushdown is native-only; planning must succeed even when the schema contains an unknown column.
    +        Session pushdown = Session.builder(getSession())
    +                .setCatalogSessionProperty(ICEBERG_CATALOG, PUSHDOWN_FILTER_ENABLED, "true")
    +                .build();
    +        assertQuerySucceeds(pushdown, "EXPLAIN SELECT * FROM test_native_unknown_read WHERE id = 1");
    +        assertQuery(pushdown, "SELECT id FROM test_native_unknown_read WHERE id = 1", "VALUES 1");
    +    }
    +
    +    @Test
    +    public void testWriteUnknownColumn()
    +    {
    +        assertQuerySucceeds("DROP TABLE IF EXISTS test_native_unknown_write");
    +        try {
    +            assertQuerySucceeds("CREATE TABLE test_native_unknown_write (id INTEGER, unknown_column UNKNOWN) WITH (\"format-version\" = '3')");
    +            assertQuerySucceeds("INSERT INTO test_native_unknown_write VALUES (1, NULL)");
    +            assertQuerySucceeds("INSERT INTO test_native_unknown_write (id) VALUES 2");
    +            assertQuerySucceeds("INSERT INTO test_native_unknown_write SELECT 3, NULL");
    +            assertQuery("SELECT * FROM test_native_unknown_write", "VALUES (1, NULL), (2, NULL), (3, NULL)");
    +            assertQuery("SELECT count(unknown_column) FROM test_native_unknown_write", "VALUES 0");
    +        }
    +        finally {
    +            assertQuerySucceeds("DROP TABLE IF EXISTS test_native_unknown_write");
    +        }
    +    }
    +
    +    @Test
    +    public void testAddUnknownColumn()
    +    {
    +        assertQuerySucceeds("DROP TABLE IF EXISTS test_native_unknown_add_column");
    +        try {

    Both this one and the other one are in try finally blocks to make sure that the table is at least attempted to be dropped after the execution of the test case. Either when it fails or succeeds.

    mohsaka mohsaka commented on code on Oct 31, 2026 01:48 UTC
    Code Review
    presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergUnknownType.java:1
    @@ -0,0 +1,297 @@
    +/*
    + * Licensed under the Apache License, Version 2.0 (the "License");
    + * you may not use this file except in compliance with the License.
    + * You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package com.facebook.presto.nativeworker;
    +
    +import com.facebook.presto.Session;
    +import com.facebook.presto.testing.ExpectedQueryRunner;
    +import com.facebook.presto.testing.QueryRunner;
    +import com.facebook.presto.tests.AbstractTestQueryFramework;
    +import org.testng.annotations.Test;
    +
    +import static com.facebook.presto.iceberg.IcebergQueryRunner.ICEBERG_CATALOG;
    +import static com.facebook.presto.iceberg.IcebergSessionProperties.PUSHDOWN_FILTER_ENABLED;
    +import static com.facebook.presto.nativeworker.PrestoNativeQueryRunnerUtils.ICEBERG_DEFAULT_STORAGE_FORMAT;
    +
    +public class TestPrestoNativeIcebergUnknownType
    +        extends AbstractTestQueryFramework
    +{
    +    @Override
    +    protected QueryRunner createQueryRunner()
    +            throws Exception
    +    {
    +        return PrestoNativeQueryRunnerUtils.nativeIcebergQueryRunnerBuilder()
    +                .setStorageFormat(ICEBERG_DEFAULT_STORAGE_FORMAT)
    +                .setAddStorageFormatToPath(true)
    +                .build();
    +    }
    +
    +    @Override
    +    protected ExpectedQueryRunner createExpectedQueryRunner()
    +            throws Exception
    +    {
    +        return PrestoNativeQueryRunnerUtils.javaIcebergQueryRunnerBuilder()
    +                .setStorageFormat(ICEBERG_DEFAULT_STORAGE_FORMAT)
    +                .setAddStorageFormatToPath(true)
    +                .build();
    +    }
    +
    +    @Override
    +    protected void createTables()
    +    {
    +        QueryRunner javaRunner = (QueryRunner) getExpectedQueryRunner();
    +
    +        javaRunner.execute("DROP TABLE IF EXISTS test_native_unknown_read");
    +        javaRunner.execute("CREATE TABLE test_native_unknown_read (id INTEGER, name VARCHAR) WITH (\"format-version\" = '3')");
    +        javaRunner.execute("INSERT INTO test_native_unknown_read VALUES (1, 'Alice'), (2, 'Bob')");
    +        javaRunner.execute("ALTER TABLE test_native_unknown_read ADD COLUMN unknown_column UNKNOWN");
    +
    +        javaRunner.execute("DROP TABLE IF EXISTS test_native_unknown_predicates");
    +        javaRunner.execute("CREATE TABLE test_native_unknown_predicates (id INTEGER, unknown_column UNKNOWN) WITH (\"format-version\" = '3')");
    +        javaRunner.execute("INSERT INTO test_native_unknown_predicates VALUES (1, NULL), (2, NULL)");
    +
    +        javaRunner.execute("DROP TABLE IF EXISTS test_native_unknown_scalar");
    +        javaRunner.execute("CREATE TABLE test_native_unknown_scalar (id INTEGER, unknown_column UNKNOWN) WITH (\"format-version\" = '3')");
    +        javaRunner.execute("INSERT INTO test_native_unknown_scalar VALUES (1, NULL)");
    +
    +        javaRunner.execute("DROP TABLE IF EXISTS test_native_unknown_aggregations");
    +        javaRunner.execute("CREATE TABLE test_native_unknown_aggregations (id INTEGER) WITH (\"format-version\" = '3')");
    +        javaRunner.execute("INSERT INTO test_native_unknown_aggregations VALUES 1, 2");
    +        javaRunner.execute("ALTER TABLE test_native_unknown_aggregations ADD COLUMN unknown_column UNKNOWN");
    +
    +        javaRunner.execute("DROP TABLE IF EXISTS test_native_unknown_partitioned");
    +        javaRunner.execute("CREATE TABLE test_native_unknown_partitioned (id INTEGER, unknown_column UNKNOWN) WITH (\"format-version\" = '3', partitioning = ARRAY['unknown_column'])");
    +        javaRunner.execute("INSERT INTO test_native_unknown_partitioned VALUES (1, NULL), (2, NULL)");
    +
    +        javaRunner.execute("DROP TABLE IF EXISTS test_native_unknown_metadata");
    +        javaRunner.execute("CREATE TABLE test_native_unknown_metadata (id INTEGER, name VARCHAR) WITH (\"format-version\" = '3', partitioning = ARRAY['id'])");
    +        javaRunner.execute("INSERT INTO test_native_unknown_metadata VALUES (1, 'Alice'), (2, 'Bob')");
    +        javaRunner.execute("ALTER TABLE test_native_unknown_metadata ADD COLUMN unknown_column UNKNOWN");
    +    }
    +
    +    @Test
    +    public void testReadUnknownColumn()
    +    {
    +        // An unknown column is never stored in a data file; the native worker must synthesise NULLs.
    +        assertQuery("SELECT * FROM test_native_unknown_read", "VALUES (1, 'Alice', NULL), (2, 'Bob', NULL)");
    +        assertQuery("SELECT unknown_column FROM test_native_unknown_read", "VALUES NULL, NULL");
    +        assertQuery("SELECT count(*) FROM test_native_unknown_read", "VALUES 2");
    +        assertQuery("SELECT count(unknown_column) FROM test_native_unknown_read", "VALUES 0");
    +        assertQuery("SELECT id FROM test_native_unknown_read WHERE name = 'Alice'", "VALUES 1");
    +    }
    +
    +    @Test
    +    public void testReadUnknownColumnWithFilterPushdown()
    +    {
    +        // Filter pushdown is native-only; planning must succeed even when the schema contains an unknown column.
    +        Session pushdown = Session.builder(getSession())
    +                .setCatalogSessionProperty(ICEBERG_CATALOG, PUSHDOWN_FILTER_ENABLED, "true")
    +                .build();
    +        assertQuerySucceeds(pushdown, "EXPLAIN SELECT * FROM test_native_unknown_read WHERE id = 1");
    +        assertQuery(pushdown, "SELECT id FROM test_native_unknown_read WHERE id = 1", "VALUES 1");
    +    }
    +
    +    @Test
    +    public void testWriteUnknownColumn()
    +    {
    +        assertQuerySucceeds("DROP TABLE IF EXISTS test_native_unknown_write");
    +        try {

    Both this one and the other one are in try finally blocks to make sure that the table is at least attempted to be dropped after the execution of the test case. Either when it fails or succeeds.

    aditi-pandit aditi-pandit commented on Nov 02, 2026 20:21 UTC
    Contributor

    @mohsaka : Thanks for this code. It looks good.

    > Had a question in general. Several of the tests have a try block around a set of assertQuery... or assertQuerySucceeds calls. Why is it needed ?

    @mohsaka : We've usually written tests with DROP IF EXISTS... CREATE TABLE... other SQL... DROP TABLE statements in sequence. So its possible that a table is not dropped if a certain statement fails. Though that was considered okay to aid debugging. I'm concerned that the try... catch block will catch failures that should be diagnosed.

    Lets remove the blocks and be consistent with other tests.

    mohsaka mohsaka commented on Nov 04, 2026 00:59 UTC
    Author

    > @mohsaka : Thanks for this code. It looks good.

    > Had a question in general. Several of the tests have a try block around a set of assertQuery... or assertQuerySucceeds calls. Why is it needed ?

    > @mohsaka : We've usually written tests with DROP IF EXISTS... CREATE TABLE... other SQL... DROP TABLE statements in sequence. So its possible that a table is not dropped if a certain statement fails. Though that was considered okay to aid debugging. I'm concerned that the try... catch block will catch failures that should be diagnosed.

    > Lets remove the blocks and be consistent with other tests.

    @aditi-pandit No problem! Removed all the try-finally, and placed the drops in line with the other statements.

    aditi-pandit aditi-pandit commented on code on Nov 04, 2026 17:46 UTC
    Code Review
    presto-docs/src/main/sphinx/connector/iceberg.rst:1
    @@ -3406,10 +3408,67 @@ Map of PrestoDB types to the relevant Iceberg types:
         - ``STRUCT``
       * - ``SphericalGeography``
         - ``GEOGRAPHY``
    +  * - ``UNKNOWN``
    +    - ``UNKNOWN``
     
     
     No other types are supported.
     
    +Unknown type (Iceberg V3)
    +^^^^^^^^^^^^^^^^^^^^^^^^^
    +
    +Iceberg Format Version 3 adds the ``unknown`` type, for a column whose type is not known. Such a
    +column only ever holds null values: it is always optional, is not stored in the data files, and
    +always reads back as ``NULL``.
    +
    +A column of this type can be declared in ``CREATE TABLE``, ``ALTER TABLE ADD COLUMN``, and
    +``CREATE TABLE AS SELECT``::
    +
    +    CREATE TABLE iceberg.web.page_views (view_time TIMESTAMP, extra UNKNOWN) WITH ("format-version" = '3');
    +
    +    ALTER TABLE iceberg.web.page_views ADD COLUMN more UNKNOWN;
    +
    +    CREATE TABLE iceberg.web.page_view_copy WITH ("format-version" = '3') AS SELECT view_time, NULL AS extra FROM iceberg.web.page_views;
    +
    +``INSERT`` statements can write ``NULL`` to an ``unknown`` column or leave the column out entirely.
    +Writing any other value is an error, because the value cannot be stored.
    +
    +**Restrictions:**
    +
    +* The table must use Iceberg format version 3 or higher.
    +* An ``unknown`` column cannot be declared ``NOT NULL``.
    +* An ``unknown`` column can be sorted on, but it cannot be bucketed or partitioned by ``identity``.
    +  Iceberg allows identity partitioning on ``unknown`` columns, but Presto's ``DROP COLUMN``
    +  rejects any column that is referenced by a partition spec (including historical ones), so a table
    +  partitioned on an ``unknown`` column can never have that column dropped, making cluster rollback
    +  impossible.  Avoid identity-partitioning ``unknown`` columns.
    +* Only top-level ``UNKNOWN`` columns are supported.  An ``unknown`` field nested inside a
    +  ``ROW``, ``ARRAY``, or ``MAP`` (for example, ``ROW(url VARCHAR, extra UNKNOWN)``) is not yet
    +  supported and is rejected at ``CREATE TABLE`` and ``ADD COLUMN`` time.
    +* Creating a view or materialized view over a table that contains an ``unknown`` column fails with
    +  a "Column type is unknown" error.  As a workaround, exclude or cast the unknown column in the
    +  view's query (for instance, ``SELECT id, CAST(NULL AS INTEGER) AS x FROM t``).
    +* Promoting an ``unknown`` column to a concrete type, such as ``ALTER TABLE ... ALTER COLUMN ... SET DATA TYPE``,
    +  is not yet supported in Presto, though the Iceberg spec allows it.

    Seems like this is supported for native engine now. Please can you fix the comment.

    mohsaka mohsaka commented on code on Nov 06, 2026 02:05 UTC
    Code Review
    presto-docs/src/main/sphinx/connector/iceberg.rst:1
    @@ -3406,10 +3408,67 @@ Map of PrestoDB types to the relevant Iceberg types:
         - ``STRUCT``
       * - ``SphericalGeography``
         - ``GEOGRAPHY``
    +  * - ``UNKNOWN``
    +    - ``UNKNOWN``
     
     
     No other types are supported.
     
    +Unknown type (Iceberg V3)
    +^^^^^^^^^^^^^^^^^^^^^^^^^
    +
    +Iceberg Format Version 3 adds the ``unknown`` type, for a column whose type is not known. Such a
    +column only ever holds null values: it is always optional, is not stored in the data files, and
    +always reads back as ``NULL``.
    +
    +A column of this type can be declared in ``CREATE TABLE``, ``ALTER TABLE ADD COLUMN``, and
    +``CREATE TABLE AS SELECT``::
    +
    +    CREATE TABLE iceberg.web.page_views (view_time TIMESTAMP, extra UNKNOWN) WITH ("format-version" = '3');
    +
    +    ALTER TABLE iceberg.web.page_views ADD COLUMN more UNKNOWN;
    +
    +    CREATE TABLE iceberg.web.page_view_copy WITH ("format-version" = '3') AS SELECT view_time, NULL AS extra FROM iceberg.web.page_views;
    +
    +``INSERT`` statements can write ``NULL`` to an ``unknown`` column or leave the column out entirely.
    +Writing any other value is an error, because the value cannot be stored.
    +
    +**Restrictions:**
    +
    +* The table must use Iceberg format version 3 or higher.
    +* An ``unknown`` column cannot be declared ``NOT NULL``.
    +* An ``unknown`` column can be sorted on, but it cannot be bucketed or partitioned by ``identity``.
    +  Iceberg allows identity partitioning on ``unknown`` columns, but Presto's ``DROP COLUMN``
    +  rejects any column that is referenced by a partition spec (including historical ones), so a table
    +  partitioned on an ``unknown`` column can never have that column dropped, making cluster rollback
    +  impossible.  Avoid identity-partitioning ``unknown`` columns.
    +* Only top-level ``UNKNOWN`` columns are supported.  An ``unknown`` field nested inside a
    +  ``ROW``, ``ARRAY``, or ``MAP`` (for example, ``ROW(url VARCHAR, extra UNKNOWN)``) is not yet
    +  supported and is rejected at ``CREATE TABLE`` and ``ADD COLUMN`` time.
    +* Creating a view or materialized view over a table that contains an ``unknown`` column fails with
    +  a "Column type is unknown" error.  As a workaround, exclude or cast the unknown column in the
    +  view's query (for instance, ``SELECT id, CAST(NULL AS INTEGER) AS x FROM t``).
    +* Promoting an ``unknown`` column to a concrete type, such as ``ALTER TABLE ... ALTER COLUMN ... SET DATA TYPE``,
    +  is not yet supported in Presto, though the Iceberg spec allows it.

    Removed "

  • This feature is currently supported in the Java (JVM) connector only. The Presto C++ (Velox-based)

  • worker cannot currently create or write tables with `unknown` columns."

    steveburnett steveburnett commented on code on Nov 06, 2026 15:48 UTC
    Code Review
    presto-docs/src/main/sphinx/connector/iceberg.rst:1
    @@ -3406,10 +3408,67 @@ Map of PrestoDB types to the relevant Iceberg types:
         - ``STRUCT``
       * - ``SphericalGeography``
         - ``GEOGRAPHY``
    +  * - ``UNKNOWN``
    +    - ``UNKNOWN``
     
     
     No other types are supported.
     
    +Unknown type (Iceberg V3)
    +^^^^^^^^^^^^^^^^^^^^^^^^^
    +
    +Iceberg Format Version 3 adds the ``unknown`` type, for a column whose type is not known. Such a
    +column only ever holds null values: it is always optional, is not stored in the data files, and
    +always reads back as ``NULL``.
    +
    +A column of this type can be declared in ``CREATE TABLE``, ``ALTER TABLE ADD COLUMN``, and
    +``CREATE TABLE AS SELECT``::
    +
    +    CREATE TABLE iceberg.web.page_views (view_time TIMESTAMP, extra UNKNOWN) WITH ("format-version" = '3');
    +
    +    ALTER TABLE iceberg.web.page_views ADD COLUMN more UNKNOWN;
    +
    +    CREATE TABLE iceberg.web.page_view_copy WITH ("format-version" = '3') AS SELECT view_time, NULL AS extra FROM iceberg.web.page_views;
    +
    +``INSERT`` statements can write ``NULL`` to an ``unknown`` column or leave the column out entirely.
    +Writing any other value is an error, because the value cannot be stored.
    +
    +**Restrictions:**
    +
    +* The table must use Iceberg format version 3 or higher.
    +* An ``unknown`` column cannot be declared ``NOT NULL``.
    +* An ``unknown`` column can be sorted on, but it cannot be bucketed or partitioned by ``identity``.
    +  Iceberg allows identity partitioning on ``unknown`` columns, but Presto's ``DROP COLUMN``
    +  rejects any column that is referenced by a partition spec (including historical ones), so a table
    +  partitioned on an ``unknown`` column can never have that column dropped, making cluster rollback
    +  impossible.  Avoid identity-partitioning ``unknown`` columns.
    +* Only top-level ``UNKNOWN`` columns are supported.  An ``unknown`` field nested inside a
    +  ``ROW``, ``ARRAY``, or ``MAP`` (for example, ``ROW(url VARCHAR, extra UNKNOWN)``) is not yet
    +  supported and is rejected at ``CREATE TABLE`` and ``ADD COLUMN`` time.
    +* Creating a view or materialized view over a table that contains an ``unknown`` column fails with
    +  a "Column type is unknown" error.  As a workaround, exclude or cast the unknown column in the
    +  view's query (for instance, ``SELECT id, CAST(NULL AS INTEGER) AS x FROM t``).
    +* Promoting an ``unknown`` column to a concrete type, such as ``ALTER TABLE ... ALTER COLUMN ... SET DATA TYPE``,
    +  is not yet supported in Presto, though the Iceberg spec allows it.

    I can verify that the updated PR has this comment removed in a local doc build.

    steveburnett steveburnett commented on Nov 06, 2026 15:48 UTC
    Reviewer

    LGTM! (docs)
    Pull updated branch, new local doc build, looks good. Thank you!

    aditi-pandit aditi-pandit commented on Nov 06, 2026 21:08 UTC
    Reviewer

    Thanks @mohsaka. You can address them in a subsequent PR.

    I have 2 tests comments
    i. No test for QueryPlanner.nullValueOfType. The MERGE change is only reachable on native, because Java rejects MERGE on V3, and no test does MERGE or UPDATE on a table with an unknown column.
    ii. No test for rewrite_data_files on a table with a top-level unknown column. The behaviour and the description disagree (see above), so a test would settle which is right.

    aditi-pandit aditi-pandit approved these changes on Nov 10, 2026 21:39 UTC
    Approved Reviewer

    Thanks @mohsaka

    prestodb-ci prestodb-ci commented on Nov 10, 2026 21:42 UTC
    Contributor

    Failed to update imported issue:

    Patch "https://github.ibm.com/api/v3/repos/lakehouse/presto/issues/6627": dial tcp 9.209.58.192:443: i/o timeout

    Reviewers
    Assignees
    mohsaka mohsaka
    Labels
    risk: low confidence: 75.2% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 71.5% (HIGH) · Higher = larger blast radius
    71.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 75.2% · Lower = rushed or shallow review
    75.2%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.7% · Safe to merge
    17.7%