You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "NoahKusaba (via GitHub)" <gi...@apache.org> on 2026/09/30 13:35:41 UTC

[I] INSERT into a partitioned table rejects NOT NULL source columns for optional table columns [datafusion-iceberg]

NoahKusaba opened a new issue, #27:
URL: https://github.com/apache/datafusion-iceberg/issues/27

   ### Describe the bug
   
   An `INSERT` into a **partitioned** table fails at planning time when a source column is `NOT NULL` and the table's column is optional:
   
   ```
   Error: Plan("Input schema does not match Iceberg table schema.
   Expected schema: Field { "id": nullable Int32 }, Field { "category": nullable Utf8 }
   Input schema: Field { "id": Int32 }, Field { "category": Utf8 }")
   ```
   
   Every value of a non-nullable column is valid in an optional one, so the write is safe. `project_with_partition` compares the input and table schemas with `==`, which also requires equal nullability. It only runs for partitioned tables, so the same `INSERT` into an unpartitioned table succeeds.
   
   ### To Reproduce
   
   1. Create a table with optional columns `id: int` and `category: string`, partitioned by identity on `category`.
   2. Register a `MemTable` source whose `id` and `category` columns are non-nullable.
   3. `INSERT INTO t SELECT * FROM source` fails with the error above.
   
   A `VALUES` list with no NULLs fails the same way, since DataFusion infers its columns as non-nullable.
   
   ### Expected behavior
   
   The `INSERT` succeeds. Only a nullable input column into a required table column should be rejected.
   
   Related: #22 covers the opposite direction. Part of #23.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org