public class SparkCatalog
extends java.lang.Object
Catalog
.
This supports the following catalog configuration options:
type
- catalog type, "hive" or "hadoop" or "rest". To specify a non-hive or
hadoop catalog, use the catalog-impl
option.
uri
- the Hive Metastore URI for Hive catalog or REST URI for REST catalog
warehouse
- the warehouse path (Hadoop catalog only)
catalog-impl
- a custom Catalog
implementation to use
io-impl
- a custom FileIO
implementation to use
metrics-reporter-impl
- a custom MetricsReporter
implementation to use
default-namespace
- a namespace to use as the default
cache-enabled
- whether to enable catalog cache
cache.case-sensitive
- whether the catalog cache should compare table
identifiers in a case sensitive way
cache.expiration-interval-ms
- interval in millis before expiring tables from
catalog cache. Refer to CatalogProperties.CACHE_EXPIRATION_INTERVAL_MS
for further
details and significant values.
table-default.$tablePropertyKey
- table property $tablePropertyKey default at
catalog level
table-override.$tablePropertyKey
- table property $tablePropertyKey enforced
at catalog level
Constructor and Description |
---|
SparkCatalog() |
Modifier and Type | Method and Description |
---|---|
void |
alterNamespace(java.lang.String[] namespace,
org.apache.spark.sql.connector.catalog.NamespaceChange... changes) |
org.apache.spark.sql.connector.catalog.Table |
alterTable(org.apache.spark.sql.connector.catalog.Identifier ident,
org.apache.spark.sql.connector.catalog.TableChange... changes) |
protected Catalog |
buildIcebergCatalog(java.lang.String name,
org.apache.spark.sql.util.CaseInsensitiveStringMap options)
Build an Iceberg
Catalog to be used by this Spark catalog adapter. |
protected TableIdentifier |
buildIdentifier(org.apache.spark.sql.connector.catalog.Identifier identifier)
Build an Iceberg
TableIdentifier for the given Spark identifier. |
void |
createNamespace(java.lang.String[] namespace,
java.util.Map<java.lang.String,java.lang.String> metadata) |
org.apache.spark.sql.connector.catalog.Table |
createTable(org.apache.spark.sql.connector.catalog.Identifier ident,
org.apache.spark.sql.types.StructType schema,
org.apache.spark.sql.connector.expressions.Transform[] transforms,
java.util.Map<java.lang.String,java.lang.String> properties) |
java.lang.String[] |
defaultNamespace() |
boolean |
dropNamespace(java.lang.String[] namespace,
boolean cascade) |
boolean |
dropTable(org.apache.spark.sql.connector.catalog.Identifier ident) |
Catalog |
icebergCatalog()
Returns the underlying
Catalog backing this Spark Catalog |
void |
initialize(java.lang.String name,
org.apache.spark.sql.util.CaseInsensitiveStringMap options) |
void |
invalidateTable(org.apache.spark.sql.connector.catalog.Identifier ident) |
boolean |
isExistingNamespace(java.lang.String[] namespace) |
boolean |
isFunctionNamespace(java.lang.String[] namespace) |
default org.apache.spark.sql.connector.catalog.Identifier[] |
listFunctions(java.lang.String[] namespace) |
java.lang.String[][] |
listNamespaces() |
java.lang.String[][] |
listNamespaces(java.lang.String[] namespace) |
org.apache.spark.sql.connector.catalog.Identifier[] |
listTables(java.lang.String[] namespace) |
default org.apache.spark.sql.connector.catalog.functions.UnboundFunction |
loadFunction(org.apache.spark.sql.connector.catalog.Identifier ident) |
java.util.Map<java.lang.String,java.lang.String> |
loadNamespaceMetadata(java.lang.String[] namespace) |
Procedure |
loadProcedure(org.apache.spark.sql.connector.catalog.Identifier ident)
Load a
stored procedure by identifier . |
org.apache.spark.sql.connector.catalog.Table |
loadTable(org.apache.spark.sql.connector.catalog.Identifier ident) |
org.apache.spark.sql.connector.catalog.Table |
loadTable(org.apache.spark.sql.connector.catalog.Identifier ident,
long timestamp) |
org.apache.spark.sql.connector.catalog.Table |
loadTable(org.apache.spark.sql.connector.catalog.Identifier ident,
java.lang.String version) |
java.lang.String |
name() |
boolean |
purgeTable(org.apache.spark.sql.connector.catalog.Identifier ident) |
void |
renameTable(org.apache.spark.sql.connector.catalog.Identifier from,
org.apache.spark.sql.connector.catalog.Identifier to) |
org.apache.spark.sql.connector.catalog.StagedTable |
stageCreate(org.apache.spark.sql.connector.catalog.Identifier ident,
org.apache.spark.sql.types.StructType schema,
org.apache.spark.sql.connector.expressions.Transform[] transforms,
java.util.Map<java.lang.String,java.lang.String> properties) |
org.apache.spark.sql.connector.catalog.StagedTable |
stageCreateOrReplace(org.apache.spark.sql.connector.catalog.Identifier ident,
org.apache.spark.sql.types.StructType schema,
org.apache.spark.sql.connector.expressions.Transform[] transforms,
java.util.Map<java.lang.String,java.lang.String> properties) |
org.apache.spark.sql.connector.catalog.StagedTable |
stageReplace(org.apache.spark.sql.connector.catalog.Identifier ident,
org.apache.spark.sql.types.StructType schema,
org.apache.spark.sql.connector.expressions.Transform[] transforms,
java.util.Map<java.lang.String,java.lang.String> properties) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
stageCreate, stageCreateOrReplace, stageReplace
namespaceExists
protected Catalog buildIcebergCatalog(java.lang.String name, org.apache.spark.sql.util.CaseInsensitiveStringMap options)
Catalog
to be used by this Spark catalog adapter.name
- Spark's catalog nameoptions
- Spark's catalog optionsprotected TableIdentifier buildIdentifier(org.apache.spark.sql.connector.catalog.Identifier identifier)
TableIdentifier
for the given Spark identifier.identifier
- Spark's identifierpublic org.apache.spark.sql.connector.catalog.Table loadTable(org.apache.spark.sql.connector.catalog.Identifier ident) throws org.apache.spark.sql.catalyst.analysis.NoSuchTableException
org.apache.spark.sql.catalyst.analysis.NoSuchTableException
public org.apache.spark.sql.connector.catalog.Table loadTable(org.apache.spark.sql.connector.catalog.Identifier ident, java.lang.String version) throws org.apache.spark.sql.catalyst.analysis.NoSuchTableException
org.apache.spark.sql.catalyst.analysis.NoSuchTableException
public org.apache.spark.sql.connector.catalog.Table loadTable(org.apache.spark.sql.connector.catalog.Identifier ident, long timestamp) throws org.apache.spark.sql.catalyst.analysis.NoSuchTableException
org.apache.spark.sql.catalyst.analysis.NoSuchTableException
public org.apache.spark.sql.connector.catalog.Table createTable(org.apache.spark.sql.connector.catalog.Identifier ident, org.apache.spark.sql.types.StructType schema, org.apache.spark.sql.connector.expressions.Transform[] transforms, java.util.Map<java.lang.String,java.lang.String> properties) throws org.apache.spark.sql.catalyst.analysis.TableAlreadyExistsException
org.apache.spark.sql.catalyst.analysis.TableAlreadyExistsException
public org.apache.spark.sql.connector.catalog.StagedTable stageCreate(org.apache.spark.sql.connector.catalog.Identifier ident, org.apache.spark.sql.types.StructType schema, org.apache.spark.sql.connector.expressions.Transform[] transforms, java.util.Map<java.lang.String,java.lang.String> properties) throws org.apache.spark.sql.catalyst.analysis.TableAlreadyExistsException
org.apache.spark.sql.catalyst.analysis.TableAlreadyExistsException
public org.apache.spark.sql.connector.catalog.StagedTable stageReplace(org.apache.spark.sql.connector.catalog.Identifier ident, org.apache.spark.sql.types.StructType schema, org.apache.spark.sql.connector.expressions.Transform[] transforms, java.util.Map<java.lang.String,java.lang.String> properties) throws org.apache.spark.sql.catalyst.analysis.NoSuchTableException
org.apache.spark.sql.catalyst.analysis.NoSuchTableException
public org.apache.spark.sql.connector.catalog.StagedTable stageCreateOrReplace(org.apache.spark.sql.connector.catalog.Identifier ident, org.apache.spark.sql.types.StructType schema, org.apache.spark.sql.connector.expressions.Transform[] transforms, java.util.Map<java.lang.String,java.lang.String> properties)
public org.apache.spark.sql.connector.catalog.Table alterTable(org.apache.spark.sql.connector.catalog.Identifier ident, org.apache.spark.sql.connector.catalog.TableChange... changes) throws org.apache.spark.sql.catalyst.analysis.NoSuchTableException
org.apache.spark.sql.catalyst.analysis.NoSuchTableException
public boolean dropTable(org.apache.spark.sql.connector.catalog.Identifier ident)
public boolean purgeTable(org.apache.spark.sql.connector.catalog.Identifier ident)
public void renameTable(org.apache.spark.sql.connector.catalog.Identifier from, org.apache.spark.sql.connector.catalog.Identifier to) throws org.apache.spark.sql.catalyst.analysis.NoSuchTableException, org.apache.spark.sql.catalyst.analysis.TableAlreadyExistsException
org.apache.spark.sql.catalyst.analysis.NoSuchTableException
org.apache.spark.sql.catalyst.analysis.TableAlreadyExistsException
public void invalidateTable(org.apache.spark.sql.connector.catalog.Identifier ident)
public org.apache.spark.sql.connector.catalog.Identifier[] listTables(java.lang.String[] namespace)
public java.lang.String[] defaultNamespace()
public java.lang.String[][] listNamespaces()
public java.lang.String[][] listNamespaces(java.lang.String[] namespace) throws org.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException
org.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException
public java.util.Map<java.lang.String,java.lang.String> loadNamespaceMetadata(java.lang.String[] namespace) throws org.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException
org.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException
public void createNamespace(java.lang.String[] namespace, java.util.Map<java.lang.String,java.lang.String> metadata) throws org.apache.spark.sql.catalyst.analysis.NamespaceAlreadyExistsException
org.apache.spark.sql.catalyst.analysis.NamespaceAlreadyExistsException
public void alterNamespace(java.lang.String[] namespace, org.apache.spark.sql.connector.catalog.NamespaceChange... changes) throws org.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException
org.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException
public boolean dropNamespace(java.lang.String[] namespace, boolean cascade) throws org.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException
org.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException
public final void initialize(java.lang.String name, org.apache.spark.sql.util.CaseInsensitiveStringMap options)
public java.lang.String name()
public Catalog icebergCatalog()
HasIcebergCatalog
Catalog
backing this Spark Catalogpublic Procedure loadProcedure(org.apache.spark.sql.connector.catalog.Identifier ident) throws NoSuchProcedureException
ProcedureCatalog
stored procedure
by identifier
.loadProcedure
in interface ProcedureCatalog
ident
- a stored procedure identifierNoSuchProcedureException
- if there is no matching stored procedurepublic boolean isFunctionNamespace(java.lang.String[] namespace)
public boolean isExistingNamespace(java.lang.String[] namespace)
public org.apache.spark.sql.connector.catalog.Identifier[] listFunctions(java.lang.String[] namespace) throws org.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException
listFunctions
in interface org.apache.spark.sql.connector.catalog.FunctionCatalog
org.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException
public org.apache.spark.sql.connector.catalog.functions.UnboundFunction loadFunction(org.apache.spark.sql.connector.catalog.Identifier ident) throws org.apache.spark.sql.catalyst.analysis.NoSuchFunctionException
loadFunction
in interface org.apache.spark.sql.connector.catalog.FunctionCatalog
org.apache.spark.sql.catalyst.analysis.NoSuchFunctionException