Packages

class SessionCatalog extends Logging

An internal catalog that is used by a Spark Session. This internal catalog serves as a proxy to the underlying metastore (e.g. Hive Metastore) and it also manages temporary views and functions of the Spark Session that it belongs to.

This class must be thread-safe.

Linear Supertypes
Logging, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SessionCatalog
  2. Logging
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new SessionCatalog(externalCatalog: ExternalCatalog)
  2. new SessionCatalog(externalCatalog: ExternalCatalog, functionRegistry: FunctionRegistry, conf: SQLConf)
  3. new SessionCatalog(externalCatalogBuilder: () ⇒ ExternalCatalog, globalTempViewManagerBuilder: () ⇒ GlobalTempViewManager, functionRegistry: FunctionRegistry, conf: SQLConf, hadoopConf: Configuration, parser: ParserInterface, functionResourceLoader: FunctionResourceLoader)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def alterDatabase(dbDefinition: CatalogDatabase): Unit
  5. def alterFunction(funcDefinition: CatalogFunction): Unit

    overwrite a metastore function in the database specified in funcDefinition..

    overwrite a metastore function in the database specified in funcDefinition.. If no database is specified, assume the function is in the current database.

  6. def alterPartitions(tableName: TableIdentifier, parts: Seq[CatalogTablePartition]): Unit

    Alter one or many table partitions whose specs that match those specified in parts, assuming the partitions exist.

    Alter one or many table partitions whose specs that match those specified in parts, assuming the partitions exist.

    If no database is specified, assume the table is in the current database.

    Note: If the underlying implementation does not support altering a certain field, this becomes a no-op.

  7. def alterTable(tableDefinition: CatalogTable): Unit

    Alter the metadata of an existing metastore table identified by tableDefinition.

    Alter the metadata of an existing metastore table identified by tableDefinition.

    If no database is specified in tableDefinition, assume the table is in the current database.

    Note: If the underlying implementation does not support altering a certain field, this becomes a no-op.

  8. def alterTableDataSchema(identifier: TableIdentifier, newDataSchema: StructType): Unit

    Alter the data schema of a table identified by the provided table identifier.

    Alter the data schema of a table identified by the provided table identifier. The new data schema should not have conflict column names with the existing partition columns, and should still contain all the existing data columns.

    identifier

    TableIdentifier

    newDataSchema

    Updated data schema to be used for the table

  9. def alterTableStats(identifier: TableIdentifier, newStats: Option[CatalogStatistics]): Unit

    Alter Spark's statistics of an existing metastore table identified by the provided table identifier.

  10. def alterTempViewDefinition(name: TableIdentifier, viewDefinition: LogicalPlan): Boolean

    Alter the definition of a local/global temp view matching the given name, returns true if a temp view is matched and altered, false otherwise.

  11. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  12. def cacheTable(t: QualifiedTableName, l: LogicalPlan): Unit

    This method provides a way to cache a plan.

  13. def clearTempTables(): Unit

    Drop all existing temporary views.

    Drop all existing temporary views. For testing only.

  14. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  15. def createDatabase(dbDefinition: CatalogDatabase, ignoreIfExists: Boolean): Unit
  16. def createFunction(funcDefinition: CatalogFunction, ignoreIfExists: Boolean): Unit

    Create a function in the database specified in funcDefinition.

    Create a function in the database specified in funcDefinition. If no such database is specified, create it in the current database.

  17. def createGlobalTempView(name: String, viewDefinition: LogicalPlan, overrideIfExists: Boolean): Unit

    Create a global temporary view.

  18. def createPartitions(tableName: TableIdentifier, parts: Seq[CatalogTablePartition], ignoreIfExists: Boolean): Unit

    Create partitions in an existing table, assuming it exists.

    Create partitions in an existing table, assuming it exists. If no database is specified, assume the table is in the current database.

  19. def createTable(tableDefinition: CatalogTable, ignoreIfExists: Boolean, validateLocation: Boolean = true): Unit

    Create a metastore table in the database specified in tableDefinition.

    Create a metastore table in the database specified in tableDefinition. If no such database is specified, create it in the current database.

  20. def createTempView(name: String, tableDefinition: LogicalPlan, overrideIfExists: Boolean): Unit

    Create a local temporary view.

  21. var currentDb: String
    Attributes
    protected
  22. def databaseExists(db: String): Boolean
  23. def defaultTablePath(tableIdent: TableIdentifier): URI
  24. def dropDatabase(db: String, ignoreIfNotExists: Boolean, cascade: Boolean): Unit
  25. def dropFunction(name: FunctionIdentifier, ignoreIfNotExists: Boolean): Unit

    Drop a metastore function.

    Drop a metastore function. If no database is specified, assume the function is in the current database.

  26. def dropGlobalTempView(name: String): Boolean

    Drop a global temporary view.

    Drop a global temporary view.

    Returns true if this view is dropped successfully, false otherwise.

  27. def dropPartitions(tableName: TableIdentifier, specs: Seq[TablePartitionSpec], ignoreIfNotExists: Boolean, purge: Boolean, retainData: Boolean): Unit

    Drop partitions from a table, assuming they exist.

    Drop partitions from a table, assuming they exist. If no database is specified, assume the table is in the current database.

  28. def dropTable(name: TableIdentifier, ignoreIfNotExists: Boolean, purge: Boolean): Unit

    Drop a table.

    Drop a table.

    If a database is specified in name, this will drop the table from that database. If no database is specified, this will first attempt to drop a temporary view with the same name, then, if that does not exist, drop the table from the current database.

  29. def dropTempFunction(name: String, ignoreIfNotExists: Boolean): Unit

    Drop a temporary function.

  30. def dropTempView(name: String): Boolean

    Drop a local temporary view.

    Drop a local temporary view.

    Returns true if this view is dropped successfully, false otherwise.

  31. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  32. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  33. lazy val externalCatalog: ExternalCatalog
  34. def failFunctionLookup(name: FunctionIdentifier, cause: Option[Throwable] = None): Nothing
    Attributes
    protected[sql]
  35. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  36. def formatDatabaseName(name: String): String

    Format database name, taking into account case sensitivity.

    Format database name, taking into account case sensitivity.

    Attributes
    protected[this]
  37. def formatTableName(name: String): String

    Format table name, taking into account case sensitivity.

    Format table name, taking into account case sensitivity.

    Attributes
    protected[this]
  38. def functionExists(name: FunctionIdentifier): Boolean

    Check if the function with the specified name exists

  39. def getCachedPlan(t: QualifiedTableName, c: Callable[LogicalPlan]): LogicalPlan

    This method provides a way to get a cached plan.

  40. def getCachedTable(key: QualifiedTableName): LogicalPlan

    This method provides a way to get a cached plan if the key exists.

  41. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  42. def getCurrentDatabase: String
  43. def getDatabaseMetadata(db: String): CatalogDatabase
  44. def getDefaultDBPath(db: String): URI

    Get the path for creating a non-default database when database location is not provided by users.

  45. def getFunctionMetadata(name: FunctionIdentifier): CatalogFunction

    Retrieve the metadata of a metastore function.

    Retrieve the metadata of a metastore function.

    If a database is specified in name, this will return the function in that database. If no database is specified, this will return the function in the current database.

  46. def getGlobalTempView(name: String): Option[LogicalPlan]

    Return a global temporary view exactly as it was stored.

  47. def getPartition(tableName: TableIdentifier, spec: TablePartitionSpec): CatalogTablePartition

    Retrieve the metadata of a table partition, assuming it exists.

    Retrieve the metadata of a table partition, assuming it exists. If no database is specified, assume the table is in the current database.

  48. def getRelation(metadata: CatalogTable): LogicalPlan
  49. def getTableMetadata(name: TableIdentifier): CatalogTable

    Retrieve the metadata of an existing permanent table/view.

    Retrieve the metadata of an existing permanent table/view. If no database is specified, assume the table/view is in the current database.

    Annotations
    @throws( ... ) @throws( ... )
  50. def getTablesByName(names: Seq[TableIdentifier]): Seq[CatalogTable]

    Retrieve all metadata of existing permanent tables/views.

    Retrieve all metadata of existing permanent tables/views. If no database is specified, assume the table/view is in the current database. Only the tables/views belong to the same database that can be retrieved are returned. For example, if none of the requested tables could be retrieved, an empty list is returned. There is no guarantee of ordering of the returned tables.

    Annotations
    @throws( ... )
  51. def getTempView(name: String): Option[LogicalPlan]

    Return a local temporary view exactly as it was stored.

  52. def getTempViewNames(): Seq[String]
  53. def getTempViewOrPermanentTableMetadata(name: TableIdentifier): CatalogTable

    Retrieve the metadata of an existing temporary view or permanent table/view.

    Retrieve the metadata of an existing temporary view or permanent table/view.

    If a database is specified in name, this will return the metadata of table/view in that database. If no database is specified, this will first attempt to get the metadata of a temporary view with the same name, then, if that does not exist, return the metadata of table/view in the current database.

  54. lazy val globalTempViewManager: GlobalTempViewManager
  55. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  56. def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  57. def initializeLogIfNecessary(isInterpreter: Boolean): Unit
    Attributes
    protected
    Definition Classes
    Logging
  58. def invalidateAllCachedTables(): Unit

    This method provides a way to invalidate all the cached plans.

  59. def invalidateCachedTable(key: QualifiedTableName): Unit

    This method provides a way to invalidate a cached plan.

  60. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  61. def isPersistentFunction(name: FunctionIdentifier): Boolean

    Returns whether it is a persistent function.

    Returns whether it is a persistent function. If not existed, returns false.

  62. def isRegisteredFunction(name: FunctionIdentifier): Boolean

    Return whether this function has been registered in the function registry of the current session.

    Return whether this function has been registered in the function registry of the current session. If not existed, return false.

  63. def isTempFunction(name: String): Boolean
  64. def isTempView(nameParts: Seq[String]): Boolean
  65. def isTemporaryFunction(name: FunctionIdentifier): Boolean

    Returns whether it is a temporary function.

    Returns whether it is a temporary function. If not existed, returns false.

  66. def isTemporaryTable(name: TableIdentifier): Boolean

    Return whether a table with the specified name is a temporary view.

    Return whether a table with the specified name is a temporary view.

    Note: The temporary view cache is checked only when database is not explicitly specified.

  67. def isTraceEnabled(): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  68. def isView(nameParts: Seq[String]): Boolean
  69. def listDatabases(pattern: String): Seq[String]
  70. def listDatabases(): Seq[String]
  71. def listFunctions(db: String, pattern: String): Seq[(FunctionIdentifier, String)]

    List all matching functions in the specified database, including temporary functions.

    List all matching functions in the specified database, including temporary functions. This returns the function identifier and the scope in which it was defined (system or user defined).

  72. def listFunctions(db: String): Seq[(FunctionIdentifier, String)]

    List all functions in the specified database, including temporary functions.

    List all functions in the specified database, including temporary functions. This returns the function identifier and the scope in which it was defined (system or user defined).

  73. def listLocalTempViews(pattern: String): Seq[TableIdentifier]

    List all matching local temporary views.

  74. def listPartitionNames(tableName: TableIdentifier, partialSpec: Option[TablePartitionSpec] = None): Seq[String]

    List the names of all partitions that belong to the specified table, assuming it exists.

    List the names of all partitions that belong to the specified table, assuming it exists.

    A partial partition spec may optionally be provided to filter the partitions returned. For instance, if there exist partitions (a='1', b='2'), (a='1', b='3') and (a='2', b='4'), then a partial spec of (a='1') will return the first two only.

  75. def listPartitions(tableName: TableIdentifier, partialSpec: Option[TablePartitionSpec] = None): Seq[CatalogTablePartition]

    List the metadata of all partitions that belong to the specified table, assuming it exists.

    List the metadata of all partitions that belong to the specified table, assuming it exists.

    A partial partition spec may optionally be provided to filter the partitions returned. For instance, if there exist partitions (a='1', b='2'), (a='1', b='3') and (a='2', b='4'), then a partial spec of (a='1') will return the first two only.

  76. def listPartitionsByFilter(tableName: TableIdentifier, predicates: Seq[Expression]): Seq[CatalogTablePartition]

    List the metadata of partitions that belong to the specified table, assuming it exists, that satisfy the given partition-pruning predicate expressions.

  77. def listTables(db: String, pattern: String, includeLocalTempViews: Boolean): Seq[TableIdentifier]

    List all matching tables in the specified database, including local temporary views if includeLocalTempViews is enabled.

    List all matching tables in the specified database, including local temporary views if includeLocalTempViews is enabled.

    Note that, if the specified database is global temporary view database, we will list global temporary views.

  78. def listTables(db: String, pattern: String): Seq[TableIdentifier]

    List all matching tables in the specified database, including local temporary views.

    List all matching tables in the specified database, including local temporary views.

    Note that, if the specified database is global temporary view database, we will list global temporary views.

  79. def listTables(db: String): Seq[TableIdentifier]

    List all tables in the specified database, including local temporary views.

    List all tables in the specified database, including local temporary views.

    Note that, if the specified database is global temporary view database, we will list global temporary views.

  80. def listViews(db: String, pattern: String): Seq[TableIdentifier]

    List all matching views in the specified database, including local temporary views.

  81. def loadFunctionResources(resources: Seq[FunctionResource]): Unit

    Loads resources such as JARs and Files for a function.

    Loads resources such as JARs and Files for a function. Every resource is represented by a tuple (resource type, resource uri).

  82. def loadPartition(name: TableIdentifier, loadPath: String, spec: TablePartitionSpec, isOverwrite: Boolean, inheritTableSpecs: Boolean, isSrcLocal: Boolean): Unit

    Load files stored in given path into the partition of an existing metastore table.

    Load files stored in given path into the partition of an existing metastore table. If no database is specified, assume the table is in the current database. If the specified table is not found in the database then a NoSuchTableException is thrown.

  83. def loadTable(name: TableIdentifier, loadPath: String, isOverwrite: Boolean, isSrcLocal: Boolean): Unit

    Load files stored in given path into an existing metastore table.

    Load files stored in given path into an existing metastore table. If no database is specified, assume the table is in the current database. If the specified table is not found in the database then a NoSuchTableException is thrown.

  84. def log: Logger
    Attributes
    protected
    Definition Classes
    Logging
  85. def logDebug(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  86. def logDebug(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  87. def logError(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  88. def logError(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  89. def logInfo(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  90. def logInfo(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  91. def logName: String
    Attributes
    protected
    Definition Classes
    Logging
  92. def logTrace(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  93. def logTrace(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  94. def logWarning(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  95. def logWarning(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  96. def lookupFunction(name: FunctionIdentifier, children: Seq[Expression]): Expression

    Return an Expression that represents the specified function, assuming it exists.

    Return an Expression that represents the specified function, assuming it exists.

    For a temporary function or a permanent function that has been loaded, this method will simply lookup the function through the FunctionRegistry and create an expression based on the builder.

    For a permanent function that has not been loaded, we will first fetch its metadata from the underlying external catalog. Then, we will load all resources associated with this function (i.e. jars and files). Finally, we create a function builder based on the function class and put the builder into the FunctionRegistry. The name of this function in the FunctionRegistry will be databaseName.functionName.

  97. def lookupFunctionInfo(name: FunctionIdentifier): ExpressionInfo

    Look up the ExpressionInfo associated with the specified function, assuming it exists.

  98. def lookupGlobalTempView(db: String, table: String): Option[SubqueryAlias]
  99. def lookupRelation(name: TableIdentifier): LogicalPlan

    Return a LogicalPlan that represents the given table or view.

    Return a LogicalPlan that represents the given table or view.

    If a database is specified in name, this will return the table/view from that database. If no database is specified, this will first attempt to return a temporary view with the same name, then, if that does not exist, return the table/view from the current database.

    Note that, the global temp view database is also valid here, this will return the global temp view matching the given name.

    If the relation is a view, we generate a View operator from the view description, and wrap the logical plan in a SubqueryAlias which will track the name of the view. SubqueryAlias will also keep track of the name and database(optional) of the table/view

    name

    The name of the table/view that we look up.

  100. def lookupTempView(table: String): Option[SubqueryAlias]
  101. def makeFunctionExpression(name: String, clazz: Class[_], input: Seq[Expression]): Expression

    Constructs a Expression based on the provided class that represents a function.

    Constructs a Expression based on the provided class that represents a function.

    This performs reflection to decide what type of Expression to return in the builder.

    Attributes
    protected
  102. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  103. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  104. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  105. def refreshTable(name: TableIdentifier): Unit

    Refresh the cache entry for a metastore table, if any.

  106. def registerFunction(funcDefinition: CatalogFunction, overrideIfExists: Boolean, functionBuilder: Option[FunctionBuilder] = None): Unit

    Registers a temporary or permanent function into a session-specific FunctionRegistry

  107. def renamePartitions(tableName: TableIdentifier, specs: Seq[TablePartitionSpec], newSpecs: Seq[TablePartitionSpec]): Unit

    Override the specs of one or many existing table partitions, assuming they exist.

    Override the specs of one or many existing table partitions, assuming they exist.

    This assumes index i of specs corresponds to index i of newSpecs. If no database is specified, assume the table is in the current database.

  108. def renameTable(oldName: TableIdentifier, newName: TableIdentifier): Unit

    Rename a table.

    Rename a table.

    If a database is specified in oldName, this will rename the table in that database. If no database is specified, this will first attempt to rename a temporary view with the same name, then, if that does not exist, rename the table in the current database.

    This assumes the database specified in newName matches the one in oldName.

  109. def reset(): Unit

    Drop all existing databases (except "default"), tables, partitions and functions, and set the current database to "default".

    Drop all existing databases (except "default"), tables, partitions and functions, and set the current database to "default".

    This is mainly used for tests.

  110. def setCurrentDatabase(db: String): Unit
  111. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  112. def tableExists(name: TableIdentifier): Boolean

    Return whether a table/view with the specified name exists.

    Return whether a table/view with the specified name exists. If no database is specified, check with current database.

  113. val tempViews: HashMap[String, LogicalPlan]

    List of temporary views, mapping from table name to their logical plan.

    List of temporary views, mapping from table name to their logical plan.

    Attributes
    protected
  114. def toString(): String
    Definition Classes
    AnyRef → Any
  115. def validateTableLocation(table: CatalogTable): Unit
  116. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  117. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  118. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from Logging

Inherited from AnyRef

Inherited from Any

Ungrouped