@Override public boolean existIndexesByTable(final String databaseName, final String tableName) { try { final BlockingInterface stub = getStub(); return isSuccess( stub.existIndexesByTable(null, CatalogUtil.buildTableIdentifier(databaseName, tableName))); } catch (ServiceException e) { throw new RuntimeException(e); } }
@Override public boolean existIndex(final String indexName){ final BlockingInterface stub = conn.getTMStub(); try { return isSuccess(stub.existIndexWithName(null, conn.getSessionedString(indexName))); } catch (ServiceException e) { throw new RuntimeException(e); } }
@Override public boolean hasIndexes(final String tableName) { final BlockingInterface stub = conn.getTMStub(); try { return isSuccess(stub.existIndexesForTable(null, conn.getSessionedString(tableName))); } catch (ServiceException e) { throw new RuntimeException(e); } }
@Override public boolean hasIndexes(final String tableName) { final BlockingInterface stub = conn.getTMStub(); try { return isSuccess(stub.existIndexesForTable(null, conn.getSessionedString(tableName))); } catch (ServiceException e) { throw new RuntimeException(e); } }
@Override public boolean dropIndex(final String indexName) { final BlockingInterface stub = conn.getTMStub(); try { return isSuccess(stub.dropIndex(null, conn.getSessionedString(indexName))); } catch (ServiceException e) { throw new RuntimeException(e); } }
@Override public boolean existIndex(final String indexName){ final BlockingInterface stub = conn.getTMStub(); try { return isSuccess(stub.existIndexWithName(null, conn.getSessionedString(indexName))); } catch (ServiceException e) { throw new RuntimeException(e); } }
@Override public boolean existIndexesByTable(final String databaseName, final String tableName) { try { final BlockingInterface stub = getStub(); return isSuccess( stub.existIndexesByTable(null, CatalogUtil.buildTableIdentifier(databaseName, tableName))); } catch (ServiceException e) { throw new RuntimeException(e); } }
@Override public boolean dropIndex(final String indexName) { final BlockingInterface stub = conn.getTMStub(); try { return isSuccess(stub.dropIndex(null, conn.getSessionedString(indexName))); } catch (ServiceException e) { throw new RuntimeException(e); } }
@Override public final boolean existIndexByName(final String databaseName, final String indexName) { try { final IndexNameProto request = IndexNameProto.newBuilder() .setDatabaseName(databaseName) .setIndexName(indexName) .build(); final BlockingInterface stub = getStub(); return isSuccess(stub.existIndexByName(null, request)); } catch (ServiceException e) { throw new RuntimeException(e); } }
@Override public final boolean existIndexByName(final String databaseName, final String indexName) { try { final IndexNameProto request = IndexNameProto.newBuilder() .setDatabaseName(databaseName) .setIndexName(indexName) .build(); final BlockingInterface stub = getStub(); return isSuccess(stub.existIndexByName(null, request)); } catch (ServiceException e) { throw new RuntimeException(e); } }
@Override public boolean existIndexByColumnNames(final String databaseName, final String tableName, final String [] columnNames) { try { GetIndexByColumnNamesRequest.Builder builder = GetIndexByColumnNamesRequest.newBuilder(); builder.setTableIdentifier(CatalogUtil.buildTableIdentifier(databaseName, tableName)); for (String colunName : columnNames) { builder.addColumnNames(colunName); } final BlockingInterface stub = getStub(); return isSuccess(stub.existIndexByColumnNames(null, builder.build())); } catch (ServiceException e) { throw new RuntimeException(e); } }
@Override public SubmitQueryResponse executeQuery(final String sql) { final BlockingInterface stub = conn.getTMStub(); final QueryRequest request = buildQueryRequest(sql, false); SubmitQueryResponse response; try { response = stub.submitQuery(null, request); } catch (ServiceException e) { throw new RuntimeException(e); } if (isSuccess(response.getState())) { conn.updateSessionVarsCache(ProtoUtil.convertToMap(response.getSessionVars())); } return response; }
@Override public boolean existIndex(final String tableName, final String[] columnName) { final BlockingInterface stub = conn.getTMStub(); GetIndexWithColumnsRequest.Builder builder = GetIndexWithColumnsRequest.newBuilder(); builder.setSessionId(conn.sessionId); builder.setTableName(tableName); for (String eachColumnName : columnName) { builder.addColumnNames(eachColumnName); } try { return isSuccess(stub.existIndexWithColumns(null, builder.build())); } catch (ServiceException e) { throw new RuntimeException(e); } }
@Override public boolean existIndexByColumnNames(final String databaseName, final String tableName, final String [] columnNames) { try { GetIndexByColumnNamesRequest.Builder builder = GetIndexByColumnNamesRequest.newBuilder(); builder.setTableIdentifier(CatalogUtil.buildTableIdentifier(databaseName, tableName)); for (String colunName : columnNames) { builder.addColumnNames(colunName); } final BlockingInterface stub = getStub(); return isSuccess(stub.existIndexByColumnNames(null, builder.build())); } catch (ServiceException e) { throw new RuntimeException(e); } }
@Override public SubmitQueryResponse executeQuery(final String sql) { final BlockingInterface stub = conn.getTMStub(); final QueryRequest request = buildQueryRequest(sql, false); SubmitQueryResponse response; try { response = stub.submitQuery(null, request); } catch (ServiceException e) { throw new RuntimeException(e); } if (isSuccess(response.getState())) { conn.updateSessionVarsCache(ProtoUtil.convertToMap(response.getSessionVars())); } return response; }
@Override public boolean existIndex(final String tableName, final String[] columnName) { final BlockingInterface stub = conn.getTMStub(); GetIndexWithColumnsRequest.Builder builder = GetIndexWithColumnsRequest.newBuilder(); builder.setSessionId(conn.sessionId); builder.setTableName(tableName); for (String eachColumnName : columnName) { builder.addColumnNames(eachColumnName); } try { return isSuccess(stub.existIndexWithColumns(null, builder.build())); } catch (ServiceException e) { throw new RuntimeException(e); } }
protected void checkSessionAndGet(NettyClientBase client) { if (sessionId == null) { BlockingInterface tajoMasterService = client.getStub(); CreateSessionRequest.Builder builder = CreateSessionRequest.newBuilder(); builder.setUsername(userInfo.getUserName()).build(); if (baseDatabase != null) { builder.setBaseDatabaseName(baseDatabase); } CreateSessionResponse response = null; try { response = tajoMasterService.createSession(null, builder.build()); } catch (ServiceException se) { throw new RuntimeException(se); } if (isSuccess(response.getState())) { sessionId = response.getSessionId(); updateSessionVarsCache(ProtoUtil.convertToMap(response.getSessionVars())); if (LOG.isDebugEnabled()) { LOG.debug(String.format("Got session %s as a user '%s'.", sessionId.getId(), userInfo.getUserName())); } } else { throw new TajoRuntimeException(response.getState()); } } }
protected void checkSessionAndGet(NettyClientBase client) { if (sessionId == null) { BlockingInterface tajoMasterService = client.getStub(); CreateSessionRequest.Builder builder = CreateSessionRequest.newBuilder(); builder.setUsername(userInfo.getUserName()).build(); if (baseDatabase != null) { builder.setBaseDatabaseName(baseDatabase); } CreateSessionResponse response = null; try { response = tajoMasterService.createSession(null, builder.build()); } catch (ServiceException se) { throw new RuntimeException(se); } if (isSuccess(response.getState())) { sessionId = response.getSessionId(); updateSessionVarsCache(ProtoUtil.convertToMap(response.getSessionVars())); if (LOG.isDebugEnabled()) { LOG.debug(String.format("Got session %s as a user '%s'.", sessionId.getId(), userInfo.getUserName())); } } else { throw new TajoRuntimeException(response.getState()); } } }
private void executeJsonQuery(String json) throws TajoException { long startTime = System.currentTimeMillis(); ClientProtos.SubmitQueryResponse response = client.executeQueryWithJson(json); if (ReturnStateUtil.isSuccess(response.getState())) { switch (response.getResultType()) { case FETCH: QueryId queryId = new QueryId(response.getQueryId()); waitForQueryCompleted(queryId); break; case ENCLOSED: localQueryCompleted(response, startTime); break; default: displayFormatter.printMessage(sout, "OK"); } } else { onError((Throwable) ExceptionUtil.toTajoExceptionCommon(response.getState())); } }
private void executeJsonQuery(String json) throws TajoException { long startTime = System.currentTimeMillis(); ClientProtos.SubmitQueryResponse response = client.executeQueryWithJson(json); if (ReturnStateUtil.isSuccess(response.getState())) { switch (response.getResultType()) { case FETCH: QueryId queryId = new QueryId(response.getQueryId()); waitForQueryCompleted(queryId); break; case ENCLOSED: localQueryCompleted(response, startTime); break; default: displayFormatter.printMessage(sout, "OK"); } } else { onError((Throwable) ExceptionUtil.toTajoExceptionCommon(response.getState())); } }