public Map<String, String> getAllSessionVariables() { NettyClientBase client = getTajoMasterConnection(); checkSessionAndGet(client); BlockingInterface stub = client.getStub(); KeyValueSetResponse response; try { response = stub.getAllSessionVariables(null, sessionId); } catch (ServiceException e) { throw new RuntimeException(e); } ensureOk(response.getState()); return ProtoUtil.convertToMap(response.getValue()); }
public Map<String, String> getAllSessionVariables() { NettyClientBase client = getTajoMasterConnection(); checkSessionAndGet(client); BlockingInterface stub = client.getStub(); KeyValueSetResponse response; try { response = stub.getAllSessionVariables(null, sessionId); } catch (ServiceException e) { throw new RuntimeException(e); } ensureOk(response.getState()); return ProtoUtil.convertToMap(response.getValue()); }
@Override public boolean updateQuery(final String sql) throws TajoException { final BlockingInterface stub = conn.getTMStub(); final QueryRequest request = buildQueryRequest(sql, false); UpdateQueryResponse response; try { response = stub.updateQuery(null, request); } catch (ServiceException e) { throw new RuntimeException(e); } throwIfError(response.getState()); conn.updateSessionVarsCache(ProtoUtil.convertToMap(response.getSessionVars())); return true; }
@Override public boolean updateQuery(final String sql) throws TajoException { final BlockingInterface stub = conn.getTMStub(); final QueryRequest request = buildQueryRequest(sql, false); UpdateQueryResponse response; try { response = stub.updateQuery(null, request); } catch (ServiceException e) { throw new RuntimeException(e); } throwIfError(response.getState()); conn.updateSessionVarsCache(ProtoUtil.convertToMap(response.getSessionVars())); return true; }
@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 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; }
public Map<String, String> unsetSessionVariables(final List<String> variables) { final BlockingInterface stub = getTMStub(); final UpdateSessionVariableRequest request = UpdateSessionVariableRequest.newBuilder() .setSessionId(sessionId) .addAllUnsetVariables(variables) .build(); SessionUpdateResponse response; try { response = stub.updateSessionVariables(null, request); } catch (ServiceException e) { throw new RuntimeException(e); } ensureOk(response.getState()); updateSessionVarsCache(ProtoUtil.convertToMap(response.getSessionVars())); return Collections.unmodifiableMap(sessionVarsCache); }
public Map<String, String> unsetSessionVariables(final List<String> variables) { final BlockingInterface stub = getTMStub(); final UpdateSessionVariableRequest request = UpdateSessionVariableRequest.newBuilder() .setSessionId(sessionId) .addAllUnsetVariables(variables) .build(); SessionUpdateResponse response; try { response = stub.updateSessionVariables(null, request); } catch (ServiceException e) { throw new RuntimeException(e); } ensureOk(response.getState()); updateSessionVarsCache(ProtoUtil.convertToMap(response.getSessionVars())); return Collections.unmodifiableMap(sessionVarsCache); }
private void setProperties(final String databaseName, final String tableName, final PrimitiveProtos.KeyValueSetProto properties) { HiveCatalogStoreClientPool.HiveCatalogStoreClient client = null; try { client = clientPool.getClient(); Table table = client.getHiveClient().getTable(databaseName, tableName); table.getParameters().putAll(ProtoUtil.convertToMap(properties)); client.getHiveClient().alter_table(databaseName, tableName, table); } catch (NoSuchObjectException nsoe) { } catch (Exception e) { throw new TajoInternalError(e); } finally { if (client != null) { client.release(); } } }
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()); } } }
public Map<String, String> updateSessionVariables(final Map<String, String> variables) { NettyClientBase client = getTajoMasterConnection(); checkSessionAndGet(client); BlockingInterface tajoMasterService = client.getStub(); KeyValueSet keyValueSet = new KeyValueSet(); keyValueSet.putAll(variables); UpdateSessionVariableRequest request = UpdateSessionVariableRequest.newBuilder() .setSessionId(sessionId) .setSessionVars(keyValueSet.getProto()).build(); SessionUpdateResponse response; try { response = tajoMasterService.updateSessionVariables(null, request); } catch (ServiceException e) { throw new RuntimeException(e); } ensureOk(response.getState()); updateSessionVarsCache(ProtoUtil.convertToMap(response.getSessionVars())); return Collections.unmodifiableMap(sessionVarsCache); }
public Map<String, String> updateSessionVariables(final Map<String, String> variables) { NettyClientBase client = getTajoMasterConnection(); checkSessionAndGet(client); BlockingInterface tajoMasterService = client.getStub(); KeyValueSet keyValueSet = new KeyValueSet(); keyValueSet.putAll(variables); UpdateSessionVariableRequest request = UpdateSessionVariableRequest.newBuilder() .setSessionId(sessionId) .setSessionVars(keyValueSet.getProto()).build(); SessionUpdateResponse response; try { response = tajoMasterService.updateSessionVariables(null, request); } catch (ServiceException e) { throw new RuntimeException(e); } ensureOk(response.getState()); updateSessionVarsCache(ProtoUtil.convertToMap(response.getSessionVars())); return Collections.unmodifiableMap(sessionVarsCache); }
Map<String, String> sessionVars = ProtoUtil.convertToMap(response.getSessionVars()); synchronized (sessionVarsCache) { for (SessionVars var : UPDATE_ON_RECONNECT) {
Map<String, String> sessionVars = ProtoUtil.convertToMap(response.getSessionVars()); synchronized (sessionVarsCache) { for (SessionVars var : UPDATE_ON_RECONNECT) {