Repository navigation
feat(view): add view metadata types and validation - #1069
Open
kamcheungting-db wants to merge 1 commit into
Open
kamcheungting-db wants to merge 1 commit into
kamcheungting-db wants to merge 1 commit into
Conversation
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.
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.
Adds the Iceberg view format v1 metadata model as the first step of view support. This provides types, validation, and lookup helpers for representing view definitions and their history.
Metadata types
ViewVersionrecords a definition's version ID, schema ID, creation timestamp, summary, representations, optional default catalog, and default namespace.ViewRepresentationis a variant ofSqlViewRepresentation, which pairs SQL text with its engine dialect, andUnknownViewRepresentation, which stores an unrecognized representation's type identifier.GetSql()andRepresentationType()expose the active representation.ViewMetadataholds the view UUID, format version, location, schemas, current version ID, versions, version log, and properties.ViewHistoryEntryrecords a timestamp and the version made current.Validation and lookups
ViewMetadata::Validate()returnsErrorKind::kInvalidfor the first violated invariant and leaves the metadata unchanged. It checks that:View schemas are validated independently of table-format schema restrictions, allowing projections to retain the types and nullability of referenced columns.
CurrentVersion(),VersionById(),CurrentSchema(), andSchemaById()return the matching non-null entry orErrorKind::kNotFoundwhen the requested version or schema is absent.The change also adds
StringUtils::EqualsIgnoreCaseAsciifor dialect matching and registers the new sources, tests, and public headers with the build and C++20 compatibility check.JSON serialization, full preservation of unknown representation payloads, metadata updates, and requirements are follow-up work.
Validation performed
view_metadata_test: all 24 tests pass. Coverage includes valid metadata, multiple versions and dialects, unknown representation types, individual validation failures with asserted error kinds, missing-entry lookups, equality, and representation helpers.cpp20_compatibility_test: passes with the new public headers registered.pre-commit run --files <changed files>: all applicable hooks pass, including trailing whitespace, end-of-file fixes, clang-format, cmake-format, and public-header generation.parquet_testfailed because its stale binary references a fixture absent from this branch;encryption_testandscheduled_executor_testwere not run because their binaries were not built. These are separate from the passing view and compatibility tests.