use of org.apache.hive.service.cli.HiveSQLException in project hive by apache.
the class HiveSessionImpl method getTypeInfo.
@Override
public OperationHandle getTypeInfo() throws HiveSQLException {
acquire(true, true);
OperationManager operationManager = getOperationManager();
GetTypeInfoOperation operation = operationManager.newGetTypeInfoOperation(getSession());
OperationHandle opHandle = operation.getHandle();
try {
addOpHandle(opHandle);
operation.run();
return opHandle;
} catch (HiveSQLException e) {
removeOpHandle(opHandle);
operationManager.closeOperation(opHandle);
throw e;
} finally {
release(true, true);
}
}
use of org.apache.hive.service.cli.HiveSQLException in project hive by apache.
the class HiveSessionImpl method open.
@Override
public /**
* Opens a new HiveServer2 session for the client connection.
* Creates a new SessionState object that will be associated with this HiveServer2 session.
* When the server executes multiple queries in the same session,
* this SessionState object is reused across multiple queries.
* Note that if doAs is true, this call goes through a proxy object,
* which wraps the method logic in a UserGroupInformation#doAs.
* That's why it is important to create SessionState here rather than in the constructor.
*/
void open(Map<String, String> sessionConfMap) throws HiveSQLException {
sessionState = new SessionState(sessionConf, username);
sessionState.setUserIpAddress(ipAddress);
sessionState.setIsHiveServerQuery(true);
sessionState.setForwardedAddresses(SessionManager.getForwardedAddresses());
sessionState.setIsUsingThriftJDBCBinarySerDe(updateIsUsingThriftJDBCBinarySerDe());
try {
if (sessionManager != null) {
sessionState.setHiveServer2Host(sessionManager.getHiveServer2HostName());
}
} catch (Exception e) {
throw new HiveSQLException(e);
}
sessionState.setKillQuery(new KillQueryImpl(operationManager));
SessionState.start(sessionState);
try {
sessionState.loadAuxJars();
sessionState.loadReloadableAuxJars();
} catch (IOException e) {
String msg = "Failed to load reloadable jar file path: " + e;
LOG.error(msg, e);
throw new HiveSQLException(msg, e);
}
try {
sessionHive = Hive.get(getHiveConf());
} catch (HiveException e) {
throw new HiveSQLException("Failed to get metastore connection", e);
}
// Process global init file: .hiverc
processGlobalInitFile();
// Set fetch size in session conf map
sessionConfMap = setFetchSize(sessionConfMap);
if (sessionConfMap != null) {
configureSession(sessionConfMap);
}
lastAccessTime = System.currentTimeMillis();
}
use of org.apache.hive.service.cli.HiveSQLException in project hive by apache.
the class HiveSessionImplwithUGI method cancelDelegationToken.
// If the session has a delegation token obtained from the metastore, then cancel it
private void cancelDelegationToken() throws HiveSQLException {
if (hmsDelegationTokenStr != null) {
try {
Hive.get(getHiveConf()).cancelDelegationToken(hmsDelegationTokenStr);
hmsDelegationTokenStr = null;
getHiveConf().setVar(HiveConf.ConfVars.METASTORE_TOKEN_SIGNATURE, "");
} catch (HiveException e) {
throw new HiveSQLException("Couldn't cancel delegation token", e);
}
}
}
use of org.apache.hive.service.cli.HiveSQLException in project hive by apache.
the class ThriftCLIServiceClient method getCrossReference.
@Override
public OperationHandle getCrossReference(SessionHandle sessionHandle, String primaryCatalog, String primarySchema, String primaryTable, String foreignCatalog, String foreignSchema, String foreignTable) throws HiveSQLException {
try {
TGetCrossReferenceReq req = new TGetCrossReferenceReq(sessionHandle.toTSessionHandle());
req.setParentCatalogName(primaryCatalog);
req.setParentSchemaName(primarySchema);
req.setParentTableName(primaryTable);
req.setForeignCatalogName(foreignCatalog);
req.setForeignSchemaName(foreignSchema);
req.setForeignTableName(foreignTable);
TGetCrossReferenceResp resp = cliService.GetCrossReference(req);
checkStatus(resp.getStatus());
TProtocolVersion protocol = sessionHandle.getProtocolVersion();
return new OperationHandle(resp.getOperationHandle(), protocol);
} catch (HiveSQLException e) {
throw e;
} catch (Exception e) {
throw new HiveSQLException(e);
}
}
use of org.apache.hive.service.cli.HiveSQLException in project hive by apache.
the class ThriftCLIServiceClient method getTables.
/* (non-Javadoc)
* @see org.apache.hive.service.cli.ICLIService#getTables(org.apache.hive.service.cli.SessionHandle, java.lang.String, java.lang.String, java.lang.String, java.util.List)
*/
@Override
public OperationHandle getTables(SessionHandle sessionHandle, String catalogName, String schemaName, String tableName, List<String> tableTypes) throws HiveSQLException {
try {
TGetTablesReq req = new TGetTablesReq(sessionHandle.toTSessionHandle());
req.setTableName(tableName);
req.setTableTypes(tableTypes);
req.setSchemaName(schemaName);
TGetTablesResp resp = cliService.GetTables(req);
checkStatus(resp.getStatus());
TProtocolVersion protocol = sessionHandle.getProtocolVersion();
return new OperationHandle(resp.getOperationHandle(), protocol);
} catch (HiveSQLException e) {
throw e;
} catch (Exception e) {
throw new HiveSQLException(e);
}
}
Aggregations