@ThreadSafe public class TajoClient extends Object implements Closeable
Constructor and Description |
---|
TajoClient(InetSocketAddress addr) |
TajoClient(String hostname,
int port,
String baseDatabase) |
TajoClient(TajoConf conf) |
TajoClient(TajoConf conf,
InetSocketAddress addr,
String baseDatabase)
Connect to TajoMaster
|
TajoClient(TajoConf conf,
String baseDatabase) |
public TajoClient(TajoConf conf) throws IOException
IOException
public TajoClient(TajoConf conf, @Nullable String baseDatabase) throws IOException
IOException
public TajoClient(TajoConf conf, InetSocketAddress addr, @Nullable String baseDatabase) throws IOException
conf
- TajoConfaddr
- TajoMaster addressbaseDatabase
- The base database name. It is case sensitive. If it is null,
the 'default' database will be used.IOException
public TajoClient(InetSocketAddress addr) throws IOException
IOException
public TajoClient(String hostname, int port, String baseDatabase) throws IOException
IOException
public boolean isConnected()
public TajoIdProtos.SessionIdProto getSessionId()
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public TajoConf getConf()
public org.apache.hadoop.security.UserGroupInformation getUserInfo()
public void closeQuery(QueryId queryId)
queryId
- public String getCurrentDatabase() throws com.google.protobuf.ServiceException
com.google.protobuf.ServiceException
public Boolean selectDatabase(String databaseName) throws com.google.protobuf.ServiceException
com.google.protobuf.ServiceException
public Boolean updateSessionVariables(Map<String,String> variables) throws com.google.protobuf.ServiceException
com.google.protobuf.ServiceException
public Boolean unsetSessionVariables(List<String> variables) throws com.google.protobuf.ServiceException
com.google.protobuf.ServiceException
public String getSessionVariable(String varname) throws com.google.protobuf.ServiceException
com.google.protobuf.ServiceException
public Boolean existSessionVariable(String varname) throws com.google.protobuf.ServiceException
com.google.protobuf.ServiceException
public Map<String,String> getAllSessionVariables() throws com.google.protobuf.ServiceException
com.google.protobuf.ServiceException
public ClientProtos.SubmitQueryResponse executeQuery(String sql) throws com.google.protobuf.ServiceException
getQueryResult(org.apache.tajo.QueryId)
or getQueryResultAndWait(org.apache.tajo.QueryId)
.com.google.protobuf.ServiceException
public ResultSet executeQueryAndGetResult(String sql) throws com.google.protobuf.ServiceException, IOException
executeQuery(String)
is a blocking method. So, this method is wait for
the finish of the submitted query.com.google.protobuf.ServiceException
IOException
public QueryStatus getQueryStatus(QueryId queryId) throws com.google.protobuf.ServiceException
com.google.protobuf.ServiceException
public static boolean isQueryRunnning(TajoProtos.QueryState state)
public ResultSet getQueryResult(QueryId queryId) throws com.google.protobuf.ServiceException, IOException
com.google.protobuf.ServiceException
IOException
public static ResultSet createResultSet(TajoClient client, QueryId queryId, ClientProtos.GetQueryResultResponse response) throws IOException
IOException
public static ResultSet createResultSet(TajoClient client, ClientProtos.SubmitQueryResponse response) throws IOException
IOException
public ResultSet createNullResultSet(QueryId queryId) throws IOException
IOException
public ClientProtos.GetQueryResultResponse getResultResponse(QueryId queryId) throws com.google.protobuf.ServiceException
com.google.protobuf.ServiceException
public boolean updateQuery(String sql) throws com.google.protobuf.ServiceException
com.google.protobuf.ServiceException
public boolean createDatabase(String databaseName) throws com.google.protobuf.ServiceException
databaseName
- The database name to be created. This name is case sensitive.com.google.protobuf.ServiceException
public boolean existDatabase(String databaseName) throws com.google.protobuf.ServiceException
databaseName
- The database name to be checked. This name is case sensitive.com.google.protobuf.ServiceException
public boolean dropDatabase(String databaseName) throws com.google.protobuf.ServiceException
databaseName
- The database name to be dropped. This name is case sensitive.com.google.protobuf.ServiceException
public List<String> getAllDatabaseNames() throws com.google.protobuf.ServiceException
com.google.protobuf.ServiceException
public boolean existTable(String tableName) throws com.google.protobuf.ServiceException
tableName
- The table name to be checked. This name is case sensitive.com.google.protobuf.ServiceException
public TableDesc createExternalTable(String tableName, Schema schema, org.apache.hadoop.fs.Path path, TableMeta meta) throws SQLException, com.google.protobuf.ServiceException
tableName
- The table name to be created. This name is case sensitive. This name can be qualified or not.
If the table name is not qualified, the current database in the session will be used.schema
- The schemapath
- The external table locationmeta
- Table metaSQLException
com.google.protobuf.ServiceException
public boolean dropTable(String tableName) throws com.google.protobuf.ServiceException
tableName
- The table name to be dropped. This name is case sensitive.com.google.protobuf.ServiceException
public boolean dropTable(String tableName, boolean purge) throws com.google.protobuf.ServiceException
tableName
- The table name to be dropped. This name is case sensitive.purge
- If purge is true, this call will remove the entry in catalog as well as the table contents.com.google.protobuf.ServiceException
public List<ClientProtos.BriefQueryInfo> getRunningQueryList() throws com.google.protobuf.ServiceException
com.google.protobuf.ServiceException
public List<ClientProtos.BriefQueryInfo> getFinishedQueryList() throws com.google.protobuf.ServiceException
com.google.protobuf.ServiceException
public List<ClientProtos.WorkerResourceInfo> getClusterInfo() throws com.google.protobuf.ServiceException
com.google.protobuf.ServiceException
public List<String> getTableList(@Nullable String databaseName) throws com.google.protobuf.ServiceException
databaseName
- The database name to show all tables. This name is case sensitive.
If it is null, this method will show all tables
in the current database of this session.com.google.protobuf.ServiceException
public TableDesc getTableDesc(String tableName) throws com.google.protobuf.ServiceException
tableName
- The table name to get. This name is case sensitive.com.google.protobuf.ServiceException
public boolean killQuery(QueryId queryId) throws com.google.protobuf.ServiceException, IOException
com.google.protobuf.ServiceException
IOException
public List<CatalogProtos.FunctionDescProto> getFunctions(String functionName) throws com.google.protobuf.ServiceException
com.google.protobuf.ServiceException
Copyright © 2014 Apache Software Foundation. All Rights Reserved.