public class CatalogImpl extends Catalog
Catalog
.Constructor and Description |
---|
CatalogImpl(SparkSession sparkSession) |
Modifier and Type | Method and Description |
---|---|
void |
cacheTable(String tableName)
Caches the specified table in-memory.
|
void |
clearCache()
Removes all cached tables from the in-memory cache.
|
Dataset<Row> |
createExternalTable(String tableName,
String path)
:: Experimental ::
Creates an external table from the given path and returns the corresponding DataFrame.
|
Dataset<Row> |
createExternalTable(String tableName,
String source,
java.util.Map<String,String> options)
:: Experimental ::
Creates an external table from the given path based on a data source and a set of options.
|
Dataset<Row> |
createExternalTable(String tableName,
String source,
scala.collection.immutable.Map<String,String> options)
:: Experimental ::
(Scala-specific)
Creates an external table from the given path based on a data source and a set of options.
|
Dataset<Row> |
createExternalTable(String tableName,
String path,
String source)
:: Experimental ::
Creates an external table from the given path based on a data source
and returns the corresponding DataFrame.
|
Dataset<Row> |
createExternalTable(String tableName,
String source,
StructType schema,
java.util.Map<String,String> options)
:: Experimental ::
Create an external table from the given path based on a data source, a schema and
a set of options.
|
Dataset<Row> |
createExternalTable(String tableName,
String source,
StructType schema,
scala.collection.immutable.Map<String,String> options)
:: Experimental ::
(Scala-specific)
Create an external table from the given path based on a data source, a schema and
a set of options.
|
String |
currentDatabase()
Returns the current default database in this session.
|
boolean |
databaseExists(String dbName)
Check if the database with the specified name exists.
|
boolean |
dropGlobalTempView(String viewName)
Drops the global temporary view with the given view name in the catalog.
|
boolean |
dropTempView(String viewName)
Drops the local temporary view with the given view name in the catalog.
|
boolean |
functionExists(String functionName)
Check if the function with the specified name exists.
|
boolean |
functionExists(String dbName,
String functionName)
Check if the function with the specified name exists in the specified database.
|
Database |
getDatabase(String dbName)
Get the database with the specified name.
|
Function |
getFunction(String functionName)
Get the function with the specified name.
|
Function |
getFunction(String dbName,
String functionName)
Get the function with the specified name.
|
Table |
getTable(String tableName)
Get the table or view with the specified name.
|
Table |
getTable(String dbName,
String tableName)
Get the table or view with the specified name in the specified database.
|
boolean |
isCached(String tableName)
Returns true if the table is currently cached in-memory.
|
Dataset<Column> |
listColumns(String tableName)
Returns a list of columns for the given table in the current database.
|
Dataset<Column> |
listColumns(String dbName,
String tableName)
Returns a list of columns for the given table in the specified database.
|
Dataset<Database> |
listDatabases()
Returns a list of databases available across all sessions.
|
Dataset<Function> |
listFunctions()
Returns a list of functions registered in the current database.
|
Dataset<Function> |
listFunctions(String dbName)
Returns a list of functions registered in the specified database.
|
Dataset<Table> |
listTables()
Returns a list of tables in the current database.
|
Dataset<Table> |
listTables(String dbName)
Returns a list of tables in the specified database.
|
static <T extends org.apache.spark.sql.catalyst.DefinedByConstructorParams> |
makeDataset(scala.collection.Seq<T> data,
SparkSession sparkSession,
scala.reflect.api.TypeTags.TypeTag<T> evidence$1) |
void |
refreshByPath(String resourcePath)
Refresh the cache entry and the associated metadata for all dataframes (if any), that contain
the given data source path.
|
void |
refreshTable(String tableName)
Refresh the cache entry for a table, if any.
|
void |
setCurrentDatabase(String dbName)
Sets the current default database in this session.
|
boolean |
tableExists(String tableName)
Check if the table or view with the specified name exists.
|
boolean |
tableExists(String dbName,
String tableName)
Check if the table or view with the specified name exists in the specified database.
|
void |
uncacheTable(String tableName)
Removes the specified table from the in-memory cache.
|
public CatalogImpl(SparkSession sparkSession)
public static <T extends org.apache.spark.sql.catalyst.DefinedByConstructorParams> Dataset<T> makeDataset(scala.collection.Seq<T> data, SparkSession sparkSession, scala.reflect.api.TypeTags.TypeTag<T> evidence$1)
public String currentDatabase()
currentDatabase
in class Catalog
public void setCurrentDatabase(String dbName) throws AnalysisException
setCurrentDatabase
in class Catalog
dbName
- (undocumented)AnalysisException
public Dataset<Database> listDatabases()
listDatabases
in class Catalog
public Dataset<Table> listTables()
listTables
in class Catalog
public Dataset<Table> listTables(String dbName) throws AnalysisException
listTables
in class Catalog
dbName
- (undocumented)AnalysisException
public Dataset<Function> listFunctions()
listFunctions
in class Catalog
public Dataset<Function> listFunctions(String dbName) throws AnalysisException
listFunctions
in class Catalog
dbName
- (undocumented)AnalysisException
public Dataset<Column> listColumns(String tableName) throws AnalysisException
listColumns
in class Catalog
tableName
- (undocumented)AnalysisException
public Dataset<Column> listColumns(String dbName, String tableName) throws AnalysisException
listColumns
in class Catalog
dbName
- (undocumented)tableName
- (undocumented)AnalysisException
public Database getDatabase(String dbName)
AnalysisException
when no
Database
can be found.getDatabase
in class Catalog
dbName
- (undocumented)public Table getTable(String tableName)
AnalysisException
when no Table
can be found.public Table getTable(String dbName, String tableName)
AnalysisException
when no Table
can be found.public Function getFunction(String functionName)
AnalysisException
when no Function
can be found.getFunction
in class Catalog
functionName
- (undocumented)public Function getFunction(String dbName, String functionName)
None
when no Function
can be
found.getFunction
in class Catalog
dbName
- (undocumented)functionName
- (undocumented)public boolean databaseExists(String dbName)
databaseExists
in class Catalog
dbName
- (undocumented)public boolean tableExists(String tableName)
tableExists
in class Catalog
tableName
- (undocumented)public boolean tableExists(String dbName, String tableName)
tableExists
in class Catalog
dbName
- (undocumented)tableName
- (undocumented)public boolean functionExists(String functionName)
functionExists
in class Catalog
functionName
- (undocumented)public boolean functionExists(String dbName, String functionName)
functionExists
in class Catalog
dbName
- (undocumented)functionName
- (undocumented)public Dataset<Row> createExternalTable(String tableName, String path)
createExternalTable
in class Catalog
tableName
- (undocumented)path
- (undocumented)public Dataset<Row> createExternalTable(String tableName, String path, String source)
createExternalTable
in class Catalog
tableName
- (undocumented)path
- (undocumented)source
- (undocumented)public Dataset<Row> createExternalTable(String tableName, String source, java.util.Map<String,String> options)
createExternalTable
in class Catalog
tableName
- (undocumented)source
- (undocumented)options
- (undocumented)public Dataset<Row> createExternalTable(String tableName, String source, scala.collection.immutable.Map<String,String> options)
createExternalTable
in class Catalog
tableName
- (undocumented)source
- (undocumented)options
- (undocumented)public Dataset<Row> createExternalTable(String tableName, String source, StructType schema, java.util.Map<String,String> options)
createExternalTable
in class Catalog
tableName
- (undocumented)source
- (undocumented)schema
- (undocumented)options
- (undocumented)public Dataset<Row> createExternalTable(String tableName, String source, StructType schema, scala.collection.immutable.Map<String,String> options)
createExternalTable
in class Catalog
tableName
- (undocumented)source
- (undocumented)schema
- (undocumented)options
- (undocumented)public boolean dropTempView(String viewName)
dropTempView
in class Catalog
viewName
- the name of the view to be dropped.public boolean dropGlobalTempView(String viewName)
dropGlobalTempView
in class Catalog
viewName
- the name of the view to be dropped.public boolean isCached(String tableName)
public void cacheTable(String tableName)
cacheTable
in class Catalog
tableName
- (undocumented)public void uncacheTable(String tableName)
uncacheTable
in class Catalog
tableName
- (undocumented)public void clearCache()
clearCache
in class Catalog
public void refreshTable(String tableName)
refreshTable
in class Catalog
tableName
- (undocumented)public void refreshByPath(String resourcePath)
refreshByPath
in class Catalog
resourcePath
- (undocumented)