@Override public final boolean existDatabase(final String databaseName) { try { final BlockingInterface stub = getStub(); final ReturnState state = stub.existDatabase(null, ProtoUtil.convertString(databaseName)); if (isThisError(state, UNDEFINED_DATABASE)) { return false; } ensureOk(state); return true; } catch (ServiceException e) { throw new RuntimeException(e); } }
public boolean existSessionVariable(final String varname) { ReturnState state; try { final BlockingInterface stub = getTMStub(); state = stub.existSessionVariable(null, getSessionedString(varname)); } catch (ServiceException e) { throw new RuntimeException(e); } if (isThisError(state, NO_SUCH_SESSION_VARIABLE)) { return false; } ensureOk(state); return true; }
public boolean existSessionVariable(final String varname) { ReturnState state; try { final BlockingInterface stub = getTMStub(); state = stub.existSessionVariable(null, getSessionedString(varname)); } catch (ServiceException e) { throw new RuntimeException(e); } if (isThisError(state, NO_SUCH_SESSION_VARIABLE)) { return false; } ensureOk(state); return true; }
@Override public boolean existDatabase(final String databaseName) { try { final BlockingInterface stub = conn.getTMStub(); final ReturnState state = stub.existDatabase(null, conn.getSessionedString(databaseName)); if (isThisError(state, ResultCode.UNDEFINED_DATABASE)) { return false; } ensureOk(state); return true; } catch (ServiceException e) { throw new RuntimeException(e); } }
@Override public final boolean existDatabase(final String databaseName) { try { final BlockingInterface stub = getStub(); final ReturnState state = stub.existDatabase(null, ProtoUtil.convertString(databaseName)); if (isThisError(state, UNDEFINED_DATABASE)) { return false; } ensureOk(state); return true; } catch (ServiceException e) { throw new RuntimeException(e); } }
@Override public boolean existDatabase(final String databaseName) { try { final BlockingInterface stub = conn.getTMStub(); final ReturnState state = stub.existDatabase(null, conn.getSessionedString(databaseName)); if (isThisError(state, ResultCode.UNDEFINED_DATABASE)) { return false; } ensureOk(state); return true; } catch (ServiceException e) { throw new RuntimeException(e); } }
@Override public final boolean existTablespace(final String tablespaceName) { try { final BlockingInterface stub = getStub(); final ReturnState state = stub.existTablespace(null, ProtoUtil.convertString(tablespaceName)); if (isThisError(state, UNDEFINED_TABLESPACE)) { return false; } ensureOk(state); return true; } catch (ServiceException e) { throw new RuntimeException(e); } }
public boolean existTable(final String tableName) { final BlockingInterface stub = conn.getTMStub(); ReturnState state; try { state = stub.existTable(null, conn.getSessionedString(tableName)); } catch (ServiceException e) { throw new RuntimeException(e); } if (isThisError(state, ResultCode.UNDEFINED_TABLE)) { return false; } ensureOk(state); return true; }
@Override public final boolean existTablespace(final String tablespaceName) { try { final BlockingInterface stub = getStub(); final ReturnState state = stub.existTablespace(null, ProtoUtil.convertString(tablespaceName)); if (isThisError(state, UNDEFINED_TABLESPACE)) { return false; } ensureOk(state); return true; } catch (ServiceException e) { throw new RuntimeException(e); } }
public boolean existTable(final String tableName) { final BlockingInterface stub = conn.getTMStub(); ReturnState state; try { state = stub.existTable(null, conn.getSessionedString(tableName)); } catch (ServiceException e) { throw new RuntimeException(e); } if (isThisError(state, ResultCode.UNDEFINED_TABLE)) { return false; } ensureOk(state); return true; }
@Override public final boolean existsTable(final String databaseName, final String tableName) { if (IdentifierUtil.isFQTableName(tableName)) { throw new IllegalArgumentException( "tableName cannot be composed of multiple parts, but it is \"" + tableName + "\""); } try { final BlockingInterface stub = getStub(); final TableIdentifierProto request = buildTableIdentifier(databaseName, tableName); final ReturnState state = stub.existsTable(null, request); if (isThisError(state, UNDEFINED_TABLE)) { return false; } ensureOk(state); return true; } catch (ServiceException e) { throw new RuntimeException(e); } }
@Override public final boolean existsTable(final String databaseName, final String tableName) { if (CatalogUtil.isFQTableName(tableName)) { throw new IllegalArgumentException( "tableName cannot be composed of multiple parts, but it is \"" + tableName + "\""); } try { final BlockingInterface stub = getStub(); final TableIdentifierProto request = buildTableIdentifier(databaseName, tableName); final ReturnState state = stub.existsTable(null, request); if (isThisError(state, UNDEFINED_TABLE)) { return false; } ensureOk(state); return true; } catch (ServiceException e) { throw new RuntimeException(e); } }
@Override public final boolean existPartitionMethod(final String databaseName, final String tableName) throws UndefinedDatabaseException, UndefinedTableException { try { final BlockingInterface stub = getStub(); final TableIdentifierProto request = buildTableIdentifier(databaseName, tableName); final ReturnState state = stub.existPartitionMethod(null, request); if (isThisError(state, UNDEFINED_PARTITION_METHOD)) { return false; } throwsIfThisError(state, UndefinedDatabaseException.class); throwsIfThisError(state, UndefinedTableException.class); ensureOk(state); return true; } catch (ServiceException e) { throw new RuntimeException(e); } }
@Override public final boolean existPartitionMethod(final String databaseName, final String tableName) throws UndefinedDatabaseException, UndefinedTableException { try { final BlockingInterface stub = getStub(); final TableIdentifierProto request = buildTableIdentifier(databaseName, tableName); final ReturnState state = stub.existPartitionMethod(null, request); if (isThisError(state, UNDEFINED_PARTITION_METHOD)) { return false; } throwsIfThisError(state, UndefinedDatabaseException.class); throwsIfThisError(state, UndefinedTableException.class); ensureOk(state); return true; } catch (ServiceException e) { throw new RuntimeException(e); } }
public String getSessionVariable(final String varname) throws NoSuchSessionVariableException { synchronized (sessionVarsCache) { // If a desired variable is client side one and exists in the cache, immediately return the variable. if (sessionVarsCache.containsKey(varname)) { return sessionVarsCache.get(varname); } } NettyClientBase client = getTajoMasterConnection(); checkSessionAndGet(client); BlockingInterface stub = client.getStub(); StringResponse response; try { response = stub.getSessionVariable(null, getSessionedString(varname)); } catch (ServiceException e) { throw new RuntimeException(e); } if (isThisError(response.getState(), NO_SUCH_SESSION_VARIABLE)) { throw new NoSuchSessionVariableException(response.getState()); } ensureOk(response.getState()); return response.getValue(); }
@Override public boolean existPartitions(String databaseName, String tableName) throws UndefinedDatabaseException, UndefinedTableException, UndefinedPartitionMethodException { try { final BlockingInterface stub = getStub(); final TableIdentifierProto request = buildTableIdentifier(databaseName, tableName); final ReturnState state = stub.existsPartitions(null, request); if (isThisError(state, UNDEFINED_PARTITIONS)) { return false; } throwsIfThisError(state, UndefinedDatabaseException.class); throwsIfThisError(state, UndefinedTableException.class); throwsIfThisError(state, UndefinedPartitionMethodException.class); ensureOk(state); return true; } catch (ServiceException e) { throw new RuntimeException(e); } }
public String getSessionVariable(final String varname) throws NoSuchSessionVariableException { synchronized (sessionVarsCache) { // If a desired variable is client side one and exists in the cache, immediately return the variable. if (sessionVarsCache.containsKey(varname)) { return sessionVarsCache.get(varname); } } NettyClientBase client = getTajoMasterConnection(); checkSessionAndGet(client); BlockingInterface stub = client.getStub(); StringResponse response; try { response = stub.getSessionVariable(null, getSessionedString(varname)); } catch (ServiceException e) { throw new RuntimeException(e); } if (isThisError(response.getState(), NO_SUCH_SESSION_VARIABLE)) { throw new NoSuchSessionVariableException(response.getState()); } ensureOk(response.getState()); return response.getValue(); }
@Override public final boolean containFunction(final String signature, FunctionType funcType, DataType... paramTypes) { final ContainFunctionRequest.Builder builder = ContainFunctionRequest.newBuilder(); if (funcType != null) { builder.setFunctionType(funcType); } builder.setSignature(signature); for (DataType type : paramTypes) { builder.addParameterTypes(type); } try { final BlockingInterface stub = getStub(); final ReturnState state = stub.containFunction(null, builder.build()); if (isThisError(state, UNDEFINED_FUNCTION)) { return false; } ensureOk(state); return true; } catch (ServiceException e) { throw new RuntimeException(e); } }
@Override public TableDesc getTableDesc(final String tableName) throws UndefinedTableException { final BlockingInterface stub = conn.getTMStub(); TableResponse res; try { res = stub.getTableDesc(null, conn.getSessionedString(tableName)); } catch (ServiceException e) { throw new RuntimeException(e); } if (isThisError(res.getState(), ResultCode.UNDEFINED_TABLE)) { throw new UndefinedTableException(res.getState()); } ensureOk(res.getState()); return new TableDesc(res.getTable()); }
@Override public TableDesc getTableDesc(final String tableName) throws UndefinedTableException { final BlockingInterface stub = conn.getTMStub(); TableResponse res; try { res = stub.getTableDesc(null, conn.getSessionedString(tableName)); } catch (ServiceException e) { throw new RuntimeException(e); } if (isThisError(res.getState(), ResultCode.UNDEFINED_TABLE)) { throw new UndefinedTableException(res.getState()); } ensureOk(res.getState()); return new TableDesc(res.getTable()); }