Repository navigation
feat(view): add metadata JSON serialization - #1196
Open
kamcheungting-db wants to merge 3 commits into
Open
kamcheungting-db wants to merge 3 commits into
kamcheungting-db wants to merge 3 commits into
Conversation
kamcheungting-db
marked this pull request as ready for review
November 30, 2026 06:45
kamcheungting-db
force-pushed
the
feat/view-metadata-json
branch
from
November 30, 2026 21:45
220f6d6 to
1f41d92
Compare
kamcheungting-db
force-pushed
the
feat/view-metadata-json
branch
from
December 1, 2026 04:38
1f41d92 to
49d5e3f
Compare
kamcheungting-db
force-pushed
the
feat/view-metadata-json
branch
from
December 1, 2026 19:25
020941f to
0a8bcea
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
View metadata can now be parsed from and serialized to Iceberg view format v1 JSON.
Builds on #1069, merged on 2026-12-01. Rebased onto
origin/mainat11be7bd0; both follow-up patches are unchanged (git range-diff). Review the JSON and validation follow-up changes.Changes
typediscriminator.Validate()retains the strict creation checks, and accessors report missing references withkNotFound.ViewPropertiesentries for history size (10), dialect removal (false), metadata compression (gzip), metadata path, and comment, usingConfigBasewhile preserving string-map storage and unknown keys.sql.INT64_MINthroughUINT64_MAXin the string parser instead of silently rounding them. Require array-valued struct fields in the shared schema parser, including nested structs.Example view metadata
This complete view format v1 document is the valid Rust fixture covered by the tests.
current-version-idselects version1, whoseschema-idrefers to schema1. The SQL representation resolveseventsusing the default catalogprodand namespacedefault.{ "view-uuid": "fa6506c3-7681-40c8-86dc-e36561f83385", "format-version": 1, "location": "s3://bucket/warehouse/default.db/event_agg", "current-version-id": 1, "properties": { "comment": "Daily event counts" }, "versions": [ { "version-id": 1, "timestamp-ms": 1573518431292, "schema-id": 1, "default-catalog": "prod", "default-namespace": [ "default" ], "summary": { "engine-name": "Spark", "engineVersion": "3.3.2" }, "representations": [ { "type": "sql", "sql": "SELECT\n COUNT(1), CAST(event_ts AS DATE)\nFROM events\nGROUP BY 2", "dialect": "spark" } ] } ], "schemas": [ { "schema-id": 1, "type": "struct", "fields": [ { "id": 1, "name": "event_count", "required": false, "type": "int", "doc": "Count of events" }, { "id": 2, "name": "event_date", "required": false, "type": "date" } ] } ], "version-log": [ { "timestamp-ms": 1573518431292, "version-id": 1 } ] }Validation
CI restarted on 2026-12-01 for rebased head
49d5e3f3; all 15 checks are in progress. The local tests below were rerun successfully after rebasing onto11be7bd0.ASAN_OPTIONS=detect_leaks=1:alloc_dealloc_mismatch=0; the default setting also reports the runtime mismatch in existing schema tests.git range-diffconfirms both follow-up patches are unchanged.Open review findings
A combined review of the foundation, this PR, and the local update/requirement implementation on 2026-12-01 reproduced the following issues. They remain unfixed at rebased head
49d5e3f3; passing existing tests does not cover these cases.ViewMetadata::Validate()currently skipsSchemaField::Validate(). A NaN write-default is serialized asnulland lost on reload; an integer field with string default"oops"serializes successfully but cannot reload. Add field-level validation on the creation/write path without reintroducing strict reference/dialect checks on reads.UnknownViewRepresentation{.type = "ſql"}, while this PR's serializer reserves that tag as SQL and rejects it. Use one discriminator policy across metadata validation, update validation, and serde, with a cross-layer regression test.The new update/requirement implementation remains local on
feat/view-updates, based on the previous PR head1f41d92c; it has been preserved separately from this rebase. Its separate review finding is a null-type dereference when comparing a rejected schema update with its clone; that fix belongs to the upcoming update/requirement PR.The metadata builder, catalog APIs, and REST integration follow afterward.