Repository navigation
feat(view): add view metadata types and validation - #1069
Merged
Merged
Conversation
shangxinli
reviewed
Oct 30, 2026
7 tasks
kamcheungting-db
force-pushed
the
feat/view-metadata-types
branch
from
November 11, 2026 07:18
52f0e84 to
ff317b3
Compare
Contributor
Author
|
Could you help me review this first PR of view? |
wgtmac
reviewed
Nov 25, 2026
wgtmac
reviewed
Nov 26, 2026
Deliver the view format v1 metadata model beside its table equivalent: - ViewVersion carries version-id, schema-id, timestamp-ms, summary, representations, optional default catalog, and required default namespace. - Representations are SQL (sql, dialect) or opaque unknown types preserved for round trips, modeled as a variant with GetSql and RepresentationType helpers. - ViewMetadata carries view-uuid, format-version, location, schemas, current-version-id, versions, version-log, and properties, with CurrentVersion/VersionById/CurrentSchema/SchemaById accessors returning NotFound for missing entries. - Validate() checks view-v1 invariants without applying table-format schema restrictions: supported format version, non-empty UUID/location, listed schemas/versions with unique IDs, current-version and schema references, non-empty default namespaces, non-empty SQL representations with at most one per dialect under ASCII case folding, and non-empty unknown representation types. - Add StringUtils::EqualsIgnoreCaseAscii for the ASCII-only dialect folding; existing Unicode-aware EqualsIgnoreCase is unchanged. - view_metadata_test validates synthetic metadata: every invariant violated one at a time with asserted error kinds, accepted shapes including unknown representations, accessor NotFound behavior, and equality.
…ation - Move view metadata and version sources and headers into a view subdirectory with its own type_fwd.h. - Reject temporary variants in GetSql and RepresentationType. - Default-initialize scalar members of view metadata, versions, and history entries. - Accept an empty default namespace, as Java writes it. - Reject duplicate field IDs in view schemas. - Reserve the SQL representation type for SQL representations, including Java's case-insensitive variants. - Validate view UUIDs with the UUID parser. - Normalize SQL dialects with Unicode case folding before checking for duplicates. Co-authored-by: Isaac <[email protected]>
kamcheungting-db
force-pushed
the
feat/view-metadata-types
branch
from
November 29, 2026 21:35
018861c to
b2bdbda
Compare
Reject missing field types, duplicate field paths, and required unknown fields. Accept ſql as an unknown representation and report invalid view metadata with kValidationFailed.
wgtmac
approved these changes
Nov 30, 2026
wgtmac
left a comment
Member
There was a problem hiding this comment.
Thanks for the quick update! Two questions for follow-up:
- Should
ViewMetadata::Validate()use the same rules for reading existing metadata and for writing new metadata? It currently rejects some inputs that Java can read. Before wiring it into JSON deserialization, could we decide which checks belong on the read path? - Once the view builder starts consuming properties like
version.history.num-entries, could we extract aViewPropertiestype to keep the property keys and defaults together, followingTableProperties?
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.
Merged on 2026-12-01. JSON serialization and the read/write validation split follow in #1196.
What this PR does
Adds the Iceberg view format v1 metadata model under
iceberg/view/: metadata, versions, history entries, SQL and unknown representation types, validation, and lookup helpers. Registers the sources, installed headers, tests, and C++20 compatibility includes.ViewMetadatastores schemas and versions, the current version ID, history, UUID, location, format version, and properties. Versions carry SQL representations, a summary, and a resolution context. Types compare by value, and scalar members are default-initialized.Validation and accessors
ViewMetadata::Validate()leaves metadata unchanged and returnskValidationFailedfor the first violated invariant:Uuid::FromString, and location must be non-empty.unknownfields are rejected. View schemas may use types introduced in later table format versions.StringUtils::ToLower, includingÉngine/éngine.sql,SQL, orSqL.CurrentVersion(),VersionById(),CurrentSchema(), andSchemaById()return the matching entry orkNotFound. The borrowing helpersGetSql()andRepresentationType()reject temporary variants, including implicit conversions from named alternatives.Tests
view_metadata_testcontains 37 GoogleTest cases, plus compile-time assertions for borrowing-helper lifetimes. Coverage includes malformed and uppercase UUIDs, scalar defaults, top-level and nested duplicate field IDs, schema/version/history references, rollback history, empty default namespaces, ASCII and Unicode dialect duplicates, reserved SQL tags, lookup failures, equality, and representation helpers.All 15 CI checks passed before merge, including ASAN/UBSAN, cpp-linter, pre-commit, and Linux/macOS/Windows builds.
Follow-ups
Metadata JSON serialization, unknown representation payload preservation, the read/write validation split, and typed
ViewPropertiesare implemented in #1196. View update/requirement types are implemented locally onfeat/view-updatesand have not been published. The metadata builder, view/catalog APIs, and REST integration follow afterward.A combined stack review on 2026-12-01 reproduced two issues shared with the follow-up work: schema validation skips field-default checks, and the metadata validator and JSON serializer disagree on the
ſqldiscriminator. These findings remain open; #1196 tracks the follow-up details.