feat: support Iceberg v3 unknown type#662
Conversation
|
Please rebase on the latest main as well. |
Add an Iceberg unknown primitive type and JSON, Arrow, Avro, Parquet, projection, and data path support for null-only unknown fields. Enforce optionality invariants so required projections cannot be materialized from unknown/null-only fields. Co-authored-by: Codex <codex@openai.com>
Enforce unknown as a v3-only optional type in schema validation and update paths, allow schema-update promotion from unknown to primitive types, reject unknown-to-nested projection, and reject unsupported Parquet writes for unknown list or map leaves. Co-authored-by: Codex <codex@openai.com>
26ccf9b to
8087ed1
Compare
Assert that promotion helpers reject nested type targets for unknown and regular primitive source types. Co-authored-by: Codex <codex@openai.com>
eb195ac to
d2a34b5
Compare
|
Could you please rebase to resolve conflicts? PR for v3 nano precision timestamp types has been merged. |
|
|
||
| TEST(SchemaJsonTest, NestedUnknownFieldsRoundTrip) { | ||
| constexpr std::string_view json = | ||
| R"({"fields":[{"id":1,"name":"profile","required":false,"type":{"fields":[{"id":2,"name":"mystery","required":false,"type":"unknown"}],"type":"struct"}},{"id":3,"name":"mysteries","required":false,"type":{"element":"unknown","element-id":4,"element-required":false,"type":"list"}},{"id":5,"name":"properties","required":false,"type":{"key":"string","key-id":6,"type":"map","value":"unknown","value-id":7,"value-required":false}}],"schema-id":1,"type":"struct"})"; |
There was a problem hiding this comment.
nit: It would be more readable if we made this multi-line.
| constexpr std::string_view json = | ||
| R"({"fields":[{"id":1,"name":"mysteries","required":false,"type":{"key":"unknown","key-id":2,"type":"map","value":"string","value-id":3,"value-required":false}}],"schema-id":1,"type":"struct"})"; | ||
|
|
||
| auto schema_result = SchemaFromJson(nlohmann::json::parse(json)); |
There was a problem hiding this comment.
From the spec: Map keys are required and map values can be either optional or required. So I'm wondering should we report something like Map 'key' can not be unknown type rather than the current error msg?
| ICEBERG_ASSIGN_OR_RAISE(auto value_id, GetJsonValue<int32_t>(json, kValueId)); | ||
| ICEBERG_ASSIGN_OR_RAISE(auto value_required, GetJsonValue<bool>(json, kValueRequired)); | ||
|
|
||
| ICEBERG_RETURN_UNEXPECTED( |
There was a problem hiding this comment.
Maybe we can restrict key_type can't be unknown here, then we don't need to call ValidateUnknownFieldOptional for key_type.
|
@manuzhang Do you have time to revive this? |
|
@wgtmac Yes, I'm on a trip this week and will update a bit later. |
Closes #665
Summary
Validation
Co-authored-by: @codex