binarybrain-009 opened a new pull request, #18684:
URL: https://github.com/apache/iceberg/pull/18684
The spec stores a non-null struct default as an empty object, `{}`, whose
value is built from the defaults of the struct's fields. Java failed to parse
it (`Cannot create expression literal from ...GenericRecord`) and the REST spec
only allowed primitive defaults. As proposed on #16596, this adds
`Literal.emptyStruct()`, accepts it as a struct field's default, and reads and
writes `{}` in `SchemaParser` and the REST spec. `initialDefault()` and
`writeDefault()` return the struct of the fields' defaults, and column pruning
now keeps field defaults so `SELECT point.x` still reads them. Generic readers
convert it to a `Record`, ORC rejects it, and Flink's conversion is left for a
follow-up. Refreshes the stale #16612.
Test plan: parsing the issue's schema fails without this change. Tests cover
the `{}` round trip, rejecting a non-empty object, nested struct defaults,
defaults kept by `TypeUtil.select`, the generic struct conversion and a no-op
`updateColumnDefault`. The api, core, orc, data and Spark 4.1 suites pass.
Fixes #16596
---
**AI Disclosure**
- Model: Claude Opus 5.5
- Platform/Tool: Claude Code
- Human Oversight: fully reviewed
- Prompt Summary: Support empty struct (`{}`) default values in Java and the
REST spec for #16596, following the direction proposed on the issue; the code
changes and tests are generated
--
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]