ulysses-you opened a new pull request, #18689:
URL: https://github.com/apache/iceberg/pull/18689

   Spark 4.2 supports `ALTER TABLE ... ADD COLUMN ... DEFAULT` and `ALTER 
COLUMN ... SET/DROP DEFAULT`, but the Iceberg Spark catalog rejected both. 
CREATE TABLE defaults were added in #18250; this PR completes DDL support for 
table defaults. ADD COLUMN maps Spark's ColumnDefaultValue to Iceberg 
`initial-default` and `write-default`, requiring them to match, which Spark 
guarantees for literal defaults; it requires format version 3 because it 
backfills existing rows. SET/DROP DEFAULT only updates `write-default` and 
works on any version. CREATE TABLE now shares the same conversion. Only literal 
defaults are accepted; SQL-only or non-literal expressions, and mismatched 
API-built defaults, are rejected.
   
   Test plan:
   - v3: ADD COLUMN DEFAULT backfills existing rows and applies to new writes.
   - v3: SET DEFAULT affects only new writes; DROP DEFAULT writes null; rows 
written with a previous default keep their values.
   - v3: INT and DATE defaults, including coercion and constant folding, keep 
initial and write defaults identical.
   - v2: ADD COLUMN DEFAULT is rejected; SET DEFAULT is allowed since only the 
write default changes.
   - API-built ColumnDefaultValue with mismatched defaults is rejected.
   
   ---
   **AI Disclosure**
   - Model: deepseek-flash[1m]
   - Platform/Tool: Claude Code
   - Human Oversight: [unknown - human to fill in]
   - Prompt Summary: Implement ALTER TABLE column default support in the 
Iceberg Spark 4.2 module and add tests.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to