Interface Relation
- All Known Subinterfaces:
StagedTable,SupportsAtomicPartitionManagement,SupportsDelete,SupportsDeleteV2,SupportsIndex,SupportsMetadataColumns,SupportsPartitionManagement,SupportsRead,SupportsRowLevelOperations,SupportsSchemaEvolution,SupportsWrite,Table,TruncatableTable
- All Known Implementing Classes:
DelegatingTable,View
@Evolving
public interface Relation
A relation in a catalog: either a
Table or a View. This is the common type
returned by RelationCatalog.loadRelation(org.apache.spark.sql.connector.catalog.Identifier) so a catalog that exposes both kinds can
answer a single read in one round trip; callers discriminate with instanceof Table /
instanceof View.
The two kinds are deliberately asymmetric, mirroring how Spark treats them: a Table is
an object Spark reads from and writes to, while a View carries only metadata (Spark
expands its query text at read time and never builds a view object). Modeling both as siblings
of Relation -- rather than smuggling a view through the Table surface -- keeps
table-only concepts (partitioning, constraints, scans, writes) off the view side.
In practice the only two kinds are Table and View. Relation is left
un-sealed because Table is itself an open interface (so a closed hierarchy would add
little) and because a sealed Java interface trips Scala's pattern-match analysis.
- Since:
- 4.2.0
-
Method Summary
-
Method Details
-
columns
Column[] columns()The columns of this relation. -
properties
The string map of properties of this relation.
-