@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 | Class and Description |
---|---|
static class |
KuduClient.KuduClientBuilder
Builder class to use in order to connect to Kudu.
|
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
LOG |
Modifier and Type | Method and Description |
---|---|
AlterTableResponse |
alterTable(String name,
AlterTableOptions ato)
Alter a table on the cluster as specified by the builder.
|
void |
close()
Analogous to
shutdown() . |
KuduTable |
createTable(String name,
Schema schema,
CreateTableOptions 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.
|
Statistics |
getStatistics()
Get the statistics object of this client.
|
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.
|
boolean |
isStatisticsEnabled()
Check if statistics collection is enabled for this client.
|
ListTabletServersResponse |
listTabletServers()
Get the list of running tablet servers.
|
KuduScanner.KuduScannerBuilder |
newScannerBuilder(KuduTable table)
Creates a new
KuduScanner.KuduScannerBuilder for a particular table. |
KuduScanToken.KuduScanTokenBuilder |
newScanTokenBuilder(KuduTable table)
Creates a new
KuduScanToken.KuduScanTokenBuilder 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, CreateTableOptions builder) throws KuduException
name
- the table's nameschema
- the table's schemabuilder
- a builder containing the table's configurationsKuduException
- if anything went wrongpublic DeleteTableResponse deleteTable(String name) throws KuduException
name
- the table's nameKuduException
- if anything went wrongpublic AlterTableResponse alterTable(String name, AlterTableOptions ato) throws KuduException
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 passedato
- the alter table builderKuduException
- if anything went wrongpublic boolean isAlterTableDone(String name) throws KuduException
name
- Table's name, if the table was renamed then that name must be checked againstKuduException
- for any error returned by sending RPCs to the masterpublic ListTabletServersResponse listTabletServers() throws KuduException
KuduException
- if anything went wrongpublic ListTablesResponse getTablesList() throws KuduException
KuduException
- if anything went wrongpublic ListTablesResponse getTablesList(String nameFilter) throws KuduException
nameFilter
- an optional table name filterKuduException
- if anything went wrongpublic boolean tableExists(String name) throws KuduException
name
- a non-null table nameKuduException
- if anything went wrongpublic KuduTable openTable(String name) throws KuduException
name
- table to openKuduException
- if anything went wrongpublic KuduSession newSession()
public boolean isStatisticsEnabled()
public Statistics getStatistics()
IllegalStateException
- thrown if statistics collection has been disabledpublic KuduScanner.KuduScannerBuilder newScannerBuilder(KuduTable table)
KuduScanner.KuduScannerBuilder
for a particular table.table
- the table you intend to scan.
The string is assumed to use the platform's default charset.public KuduScanToken.KuduScanTokenBuilder newScanTokenBuilder(KuduTable table)
KuduScanToken.KuduScanTokenBuilder
for a particular table.
Used for integrations with compute frameworks.table
- the table you intend to scanpublic void close() throws KuduException
shutdown()
.close
in interface AutoCloseable
KuduException
- if an error happens while closing the connectionspublic void shutdown() throws KuduException
KuduException
- if anything went wrongpublic long getDefaultOperationTimeoutMs()
public long getDefaultAdminOperationTimeoutMs()
Copyright © 2016 The Apache Software Foundation. All rights reserved.