@InterfaceAudience.Public @InterfaceStability.Evolving public class KuduClient extends Object implements AutoCloseable
This class acts as a wrapper around AsyncKuduClient which contains all the relevant
documentation.
| 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 long |
NO_TIMESTAMP |
| 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.
|
byte[] |
exportAuthenticationCredentials()
Export serialized authentication data that may be passed to a different
client instance and imported to provide that client the ability to connect
to the cluster.
|
long |
getDefaultAdminOperationTimeoutMs()
Get the timeout used for admin operations.
|
long |
getDefaultOperationTimeoutMs()
Get the timeout used for operations on sessions and scanners.
|
long |
getLastPropagatedTimestamp()
Returns the last timestamp received from a server.
|
String |
getLocationString()
Returns a string representation of this client's location.
|
String |
getMasterAddressesAsString() |
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 |
hasLastPropagatedTimestamp()
Checks if the client received any timestamps from a server.
|
void |
importAuthenticationCredentials(byte[] authnData)
Import data allowing this client to authenticate to the cluster.
|
boolean |
isAlterTableDone(String name)
Waits for all of the tablets in a table to be altered, or until the
default admin operation timeout is reached.
|
boolean |
isCreateTableDone(String name)
Waits for all of the tablets in a table to be created, or until the
default admin operation timeout is reached.
|
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.
|
void |
updateLastPropagatedTimestamp(long lastPropagatedTimestamp)
Updates the last timestamp received from a server.
|
public static final long NO_TIMESTAMP
public void updateLastPropagatedTimestamp(long lastPropagatedTimestamp)
lastPropagatedTimestamp - the last timestamp received from a server.public long getLastPropagatedTimestamp()
public boolean hasLastPropagatedTimestamp()
public String getLocationString()
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 boolean isCreateTableDone(String name) throws KuduException
name - the table's nameKuduException - for any error returned by sending RPCs to the master
(e.g. the table does not exist)public DeleteTableResponse deleteTable(String name) throws KuduException
name - the table's nameKuduException - if anything went wrongpublic AlterTableResponse alterTable(String name, AlterTableOptions ato) throws KuduException
name - the table's name (old name if the table is being renamed)ato - the alter table optionsKuduException - if anything went wrongpublic boolean isAlterTableDone(String name) throws KuduException
name - the table's nameKuduException - for any error returned by sending RPCs to the master
(e.g. the table does not exist)public 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 AutoCloseableKuduException - if an error happens while closing the connectionspublic void shutdown()
throws KuduException
KuduException - if anything went wrong@InterfaceStability.Unstable
public byte[] exportAuthenticationCredentials()
throws KuduException
KuduException@InterfaceStability.Unstable public void importAuthenticationCredentials(byte[] authnData)
authnData - then authentication data provided by a prior call to
exportAuthenticationCredentials()public long getDefaultOperationTimeoutMs()
public long getDefaultAdminOperationTimeoutMs()
public String getMasterAddressesAsString()