@InterfaceAudience.Public @InterfaceStability.Evolving public class KuduClient extends Object implements AutoCloseable
This class acts as a wrapper around AsyncKuduClient
. The Deferred
objects are
joined against using the default admin operation timeout
(see KuduClient.KuduClientBuilder.defaultAdminOperationTimeoutMs(long)
(long)}).
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
LOG |
Modifier and Type | Method and Description |
---|---|
AlterTableResponse |
alterTable(String name,
AlterTableBuilder atb)
Alter a table on the cluster as specified by the builder.
|
void |
close()
Analogous to
shutdown() . |
KuduTable |
createTable(String name,
Schema schema)
Create a table on the cluster with the specified name and schema.
|
KuduTable |
createTable(String name,
Schema schema,
CreateTableBuilder builder)
Create a table on the cluster with the specified name, schema, and table configurations.
|
DeleteTableResponse |
deleteTable(String name)
Delete a table on the cluster with the specified name.
|
long |
getDefaultAdminOperationTimeoutMs()
Get the timeout used for admin operations.
|
long |
getDefaultOperationTimeoutMs()
Get the timeout used for operations on sessions and scanners.
|
ListTablesResponse |
getTablesList()
Get the list of all the tables.
|
ListTablesResponse |
getTablesList(String nameFilter)
Get a list of table names.
|
boolean |
isAlterTableDone(String name)
Helper method that checks and waits until the completion of an alter command.
|
ListTabletServersResponse |
listTabletServers()
Get the list of running tablet servers.
|
KuduScanner.KuduScannerBuilder |
newScannerBuilder(KuduTable table)
Creates a new
KuduScanner.KuduScannerBuilder for a particular table. |
KuduSession |
newSession()
Create a new session for interacting with the cluster.
|
KuduTable |
openTable(String name)
Open the table with the given name.
|
void |
shutdown()
Performs a graceful shutdown of this instance.
|
boolean |
tableExists(String name)
Test if a table exists.
|
public KuduTable createTable(String name, Schema schema) throws Exception
name
- Table's nameschema
- Table's schemaException
public KuduTable createTable(String name, Schema schema, CreateTableBuilder builder) throws Exception
name
- the table's nameschema
- the table's schemabuilder
- a builder containing the table's configurationsException
public DeleteTableResponse deleteTable(String name) throws Exception
name
- the table's nameException
public AlterTableResponse alterTable(String name, AlterTableBuilder atb) throws Exception
isAlterTableDone(String)
to know when the alter finishes.name
- the table's name, if this is a table rename then the old table name must be passedatb
- the alter table builderException
public boolean isAlterTableDone(String name) throws Exception
name
- Table's name, if the table was renamed then that name must be checked againstException
public ListTabletServersResponse listTabletServers() throws Exception
Exception
public ListTablesResponse getTablesList() throws Exception
Exception
public ListTablesResponse getTablesList(String nameFilter) throws Exception
nameFilter
- an optional table name filterException
public boolean tableExists(String name) throws Exception
name
- a non-null table nameException
public KuduTable openTable(String name) throws Exception
name
- table to openException
public KuduSession newSession()
public KuduScanner.KuduScannerBuilder newScannerBuilder(KuduTable table)
KuduScanner.KuduScannerBuilder
for a particular table.table
- the name of the table you intend to scan.
The string is assumed to use the platform's default charset.public void close() throws Exception
shutdown()
.close
in interface AutoCloseable
Exception
- if an error happens while closing the connectionspublic void shutdown() throws Exception
Exception
public long getDefaultOperationTimeoutMs()
public long getDefaultAdminOperationTimeoutMs()
Copyright © 2015. All rights reserved.