Class ViewInfo

Object
org.apache.spark.sql.connector.catalog.TableInfo
org.apache.spark.sql.connector.catalog.ViewInfo

@Evolving public class ViewInfo extends TableInfo
View metadata DTO -- the typed payload returned by ViewCatalog.loadView(org.apache.spark.sql.connector.catalog.Identifier) and accepted by ViewCatalog.createView(org.apache.spark.sql.connector.catalog.Identifier, org.apache.spark.sql.connector.catalog.ViewInfo) / ViewCatalog.replaceView(org.apache.spark.sql.connector.catalog.Identifier, org.apache.spark.sql.connector.catalog.ViewInfo). Carries the view-specific fields that cannot be represented as string table properties: the query text, captured creation-time resolution context, captured SQL configs, schema-binding mode, and query output column names. Schema and user TBLPROPERTIES are inherited from TableInfo via the typed builder.

ViewInfo extends TableInfo so that a TableViewCatalog can opt into the single-RPC perf path by returning a MetadataTable wrapping a ViewInfo from TableViewCatalog.loadTableOrView(org.apache.spark.sql.connector.catalog.Identifier) for a view identifier. Pure ViewCatalog implementations never see TableInfo; the typed setters on ViewInfo.Builder cover everything they need to construct a ViewInfo.

Since:
4.2.0
  • Method Details

    • queryText

      public String queryText()
      The SQL text of the view.
    • currentCatalog

      public String currentCatalog()
      The current catalog at the time the view was created, used to resolve unqualified identifiers in queryText() at read time. May be null if the view was created with no captured resolution context.
    • currentNamespace

      public String[] currentNamespace()
      The current namespace at the time the view was created, used alongside currentCatalog() to resolve unqualified identifiers in queryText() at read time. Never null; empty when no namespace was captured.
    • sqlConfigs

      public Map<String,String> sqlConfigs()
      The SQL configs captured at view creation time, applied when parsing and analyzing the view body. Keys are unprefixed SQL config names (e.g. spark.sql.ansi.enabled).
    • schemaMode

      public String schemaMode()
      The view's schema binding mode. Allowed values match the toString form of org.apache.spark.sql.catalyst.analysis.ViewSchemaMode: BINDING, COMPENSATION, TYPE EVOLUTION, EVOLUTION. May be null when schema binding is not configured.
    • queryColumnNames

      public String[] queryColumnNames()
      Output column names of the query that created the view, used to map the query output to the view's declared columns during view resolution. Empty for views in EVOLUTION mode, which always use the view's current schema.