本文整理汇总了Java中org.apache.tajo.jdbc.SQLStates类的典型用法代码示例。如果您正苦于以下问题:Java SQLStates类的具体用法?Java SQLStates怎么用?Java SQLStates使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SQLStates类属于org.apache.tajo.jdbc包,在下文中一共展示了SQLStates类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createExternalTable
import org.apache.tajo.jdbc.SQLStates; //导入依赖的package包/类
public TableDesc createExternalTable(final String name, final Schema schema, final Path path, final TableMeta meta)
throws SQLException, ServiceException {
return new ServerCallable<TableDesc>(connPool, tajoMasterAddr,
TajoMasterClientProtocol.class, false, true) {
public TableDesc call(NettyClientBase client) throws ServiceException, SQLException {
TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
CreateTableRequest.Builder builder = CreateTableRequest.newBuilder();
builder.setName(name);
builder.setSchema(schema.getProto());
builder.setMeta(meta.getProto());
builder.setPath(path.toUri().toString());
TableResponse res = tajoMasterService.createExternalTable(null, builder.build());
if (res.getResultCode() == ResultCode.OK) {
return CatalogUtil.newTableDesc(res.getTableDesc());
} else {
throw new SQLException(res.getErrorMessage(), SQLStates.ER_NO_SUCH_TABLE.getState());
}
}
}.withRetries();
}
示例2: getTableDesc
import org.apache.tajo.jdbc.SQLStates; //导入依赖的package包/类
public TableDesc getTableDesc(final String tableName) throws SQLException, ServiceException {
return new ServerCallable<TableDesc>(connPool, tajoMasterAddr,
TajoMasterClientProtocol.class, false, true) {
public TableDesc call(NettyClientBase client) throws ServiceException, SQLException {
TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
GetTableDescRequest.Builder build = GetTableDescRequest.newBuilder();
build.setTableName(tableName);
TableResponse res = tajoMasterService.getTableDesc(null, build.build());
if (res.getResultCode() == ResultCode.OK) {
return CatalogUtil.newTableDesc(res.getTableDesc());
} else {
throw new SQLException(res.getErrorMessage(), SQLStates.ER_NO_SUCH_TABLE.getState());
}
}
}.withRetries();
}
示例3: createExternalTable
import org.apache.tajo.jdbc.SQLStates; //导入依赖的package包/类
/**
* Create an external table.
*
* @param 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.
* @param schema The schema
* @param path The external table location
* @param meta Table meta
* @return the created table description.
* @throws SQLException
* @throws ServiceException
*/
public TableDesc createExternalTable(final String tableName, final Schema schema, final Path path,
final TableMeta meta)
throws SQLException, ServiceException {
return new ServerCallable<TableDesc>(connPool, tajoMasterAddr,
TajoMasterClientProtocol.class, false, true) {
public TableDesc call(NettyClientBase client) throws ServiceException, SQLException {
checkSessionAndGet(client);
TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
CreateTableRequest.Builder builder = CreateTableRequest.newBuilder();
builder.setSessionId(sessionId);
builder.setName(tableName);
builder.setSchema(schema.getProto());
builder.setMeta(meta.getProto());
builder.setPath(path.toUri().toString());
TableResponse res = tajoMasterService.createExternalTable(null, builder.build());
if (res.getResultCode() == ResultCode.OK) {
return CatalogUtil.newTableDesc(res.getTableDesc());
} else {
throw new SQLException(res.getErrorMessage(), SQLStates.ER_NO_SUCH_TABLE.getState());
}
}
}.withRetries();
}
示例4: getTableDesc
import org.apache.tajo.jdbc.SQLStates; //导入依赖的package包/类
/**
* Get a table description
*
* @param tableName The table name to get. This name is case sensitive.
* @return Table description
*/
public TableDesc getTableDesc(final String tableName) throws ServiceException {
return new ServerCallable<TableDesc>(connPool, tajoMasterAddr,
TajoMasterClientProtocol.class, false, true) {
public TableDesc call(NettyClientBase client) throws ServiceException, SQLException {
checkSessionAndGet(client);
TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
GetTableDescRequest.Builder builder = GetTableDescRequest.newBuilder();
builder.setSessionId(sessionId);
builder.setTableName(tableName);
TableResponse res = tajoMasterService.getTableDesc(null, builder.build());
if (res.getResultCode() == ResultCode.OK) {
return CatalogUtil.newTableDesc(res.getTableDesc());
} else {
throw new SQLException(res.getErrorMessage(), SQLStates.ER_NO_SUCH_TABLE.getState());
}
}
}.withRetries();
}