You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "malhotrashivam (via GitHub)" <gi...@apache.org> on 2025/03/10 22:15:49 UTC

[I] Unable to set `write-default` for a column [iceberg]

malhotrashivam opened a new issue, #12495:
URL: https://github.com/apache/iceberg/issues/12495

   ### Apache Iceberg version
   
   1.8.1 (latest release)
   
   ### Query engine
   
   None
   
   ### Please describe the bug 🐞
   
   - I am attempting to create a table via the  Iceberg Java API with the `write-default` values set on some columns. After creating the table and reading the schema back, I expected the schema to include the default value definitions but they are missing.
   
   ```
   // To create a new teable
   final TableIdentifier tableIdentifier = TableIdentifier.parse("MyNamespace.MyTable");
   final Schema schema = new Schema(List.of(
           Types.NestedField.required(1, "intCol", Types.IntegerType.get()),
           Types.NestedField.required(2, "doubleCol", Types.DoubleType.get()),
           Types.NestedField.required(3, "longCol", Types.LongType.get()),
           Types.NestedField.required("newIntCol")
                   .withId(4)
                   .ofType(Types.IntegerType.get())
                   .withWriteDefault(Integer.valueOf("10"))
                   .build()
   ));
   
   catalog.createTable(tableIdentifier, schema);
   
   
   // To read back the schema
   catalog.loadTable.loadTable(tableIdentifier).schema();
   // Schema doesn't have write default set for `newIntCol`
   ```
   Same issue also exist for `initial-default` too.
   
   
   ### Willingness to contribute
   
   - [ ] I can contribute a fix for this bug independently
   - [ ] I would be willing to contribute a fix for this bug with guidance from the Iceberg community
   - [x] I cannot contribute a fix for this bug at this time


-- 
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: issues-unsubscribe@iceberg.apache.org.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Unable to set `write-default` for a column [iceberg]

Posted by "pvary (via GitHub)" <gi...@apache.org>.
pvary closed issue #12495: Unable to set `write-default` for a column
URL: https://github.com/apache/iceberg/issues/12495


-- 
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: issues-unsubscribe@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Unable to set `write-default` for a column [iceberg]

Posted by "pvary (via GitHub)" <gi...@apache.org>.
pvary commented on issue #12495:
URL: https://github.com/apache/iceberg/issues/12495#issuecomment-2724687667

   Fixed by #12520 


-- 
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: issues-unsubscribe@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Unable to set `write-default` for a column [iceberg]

Posted by "pvary (via GitHub)" <gi...@apache.org>.
pvary commented on issue #12495:
URL: https://github.com/apache/iceberg/issues/12495#issuecomment-2721823292

   Based on the unit tests the update should work. See: 
   https://github.com/apache/iceberg/blob/d03a5e1dbcf622ab4883dabeb813f5d8f7728fb5/core/src/test/java/org/apache/iceberg/TestSchemaUpdate.java#L586
   
   There is an issue with creation which will be fixed by #12520


-- 
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: issues-unsubscribe@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Unable to set `write-default` for a column [iceberg]

Posted by "malhotrashivam (via GitHub)" <gi...@apache.org>.
malhotrashivam commented on issue #12495:
URL: https://github.com/apache/iceberg/issues/12495#issuecomment-2711969219

   Another issue with `write-default` is that there doesn't exist any APIs for updating the schema of an existing table to set the default value for any column, whereas the spec mentions that write-default can be changed through schema-evolution ([ref](https://iceberg.apache.org/spec/#edge-interpolation-algorithm:~:text=The%20write%2Ddefault%20is%20initially%20set%20to%20the%20same%20value%20as%20initial%2Ddefault%20and%20can%20be%20changed%20through%20schema%20evolution.)) 


-- 
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: issues-unsubscribe@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org