wombatu-kun commented on code in PR #16612:
URL: https://github.com/apache/iceberg/pull/16612#discussion_r3369436420
##########
api/src/main/java/org/apache/iceberg/types/Types.java:
##########
@@ -883,7 +884,14 @@ private NestedField(
}
private static Literal<?> castDefault(Literal<?> defaultValue, Type type) {
- if (type.isNestedType() && defaultValue != null) {
+ if (type.isStructType() && defaultValue != null) {
Review Comment:
castDefault now accepts struct defaults, but the only literal satisfying
`isEmptyStructDefault` is `StructDefaultLiteral`, which is private to
`SchemaParser`. The public builder path
`NestedField.Builder.withInitialDefault(Literal)` (Types.java:827) has no
factory to construct an empty-struct default, and the `Object` overload routes
through `Expressions.lit`, which rejects struct values - so struct defaults are
reachable only via JSON parsing. Consider exposing a public factory so schemas
can be built programmatically with struct defaults.
--
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]