[SPARK-52729][SQL][FOLLOWUP] Introduce RelationInfo as a common base for TableInfo and ViewInfo#56606
Open
cloud-fan wants to merge 1 commit into
Open
[SPARK-52729][SQL][FOLLOWUP] Introduce RelationInfo as a common base for TableInfo and ViewInfo#56606cloud-fan wants to merge 1 commit into
cloud-fan wants to merge 1 commit into
Conversation
…for TableInfo and ViewInfo Make TableInfo and ViewInfo sibling subclasses of a new common base RelationInfo instead of having ViewInfo extend TableInfo, so views no longer inherit the table-only surface (partitioning, constraints, provider, location). Co-authored-by: Isaac
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.
What changes were proposed in this pull request?
This is a follow-up of #52729 (which introduced
ViewInfo extends TableInfo).Previously
ViewInfoextendedTableInfopurely so that aMetadataTable(which wraps aTableInfo) could also carry aViewInfo, enabling the single-RPCTableViewCatalog#loadTableOrViewperf path. The side effect was thatViewInfoinherited table-only state that is meaningless for views:partitions()/constraints()accessors (returning empty arrays) and thewithPartitions/withConstraints/withProvider/withLocationbuilder setters (callable on a view builder but semantically wrong).This PR makes
TableInfoandViewInfosibling subclasses of a new common base instead:MetadataTablenow wraps aRelationInfo, andgetTableInfo()is renamed togetRelationInfo(). Itspartitioning()/constraints()return empty for a non-TableInfopayload. The single-RPC perf path is preserved unchanged; consumers discriminate viagetRelationInfo() instanceof ViewInfo(wasgetTableInfo() instanceof ViewInfo).Callers updated accordingly:
TableViewCatalogdefault methods,Analyzer,RelationResolution,V1Table, and the in-tree test catalogs.Why are the changes needed?
ViewInfo IS-A TableInfois not a true relationship -- a view is not a table. The inheritance forced all ofTableInfo's state into the shared builder, leaking table-only operations onto the view surface. Modeling both as siblings ofRelationInforemoves the leak at compile time and keeps each builder scoped to exactly what its kind needs, while preserving theMetadataTablecarrier that theloadTableOrViewperf path relies on.Does this PR introduce any user-facing change?
No. The affected APIs (
TableInfo,ViewInfo,MetadataTable,TableViewCatalog) are@Evolvingand unreleased (@since 4.2.0).How was this patch tested?
Existing tests.
catalyst,sql/core, and their test sources compile against the refactored hierarchy; the in-treeTableViewCatalogtest implementations were updated to store the commonRelationInfotype.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8)