use of org.apache.hive.service.cli.OperationHandle in project hive by apache.
the class HiveSessionImpl method uploadData.
@Override
public OperationHandle uploadData(ByteBuffer values, String tableName, String path) throws HiveSQLException {
acquire(true, true);
OperationManager operationManager = getOperationManager();
Operation operation = operationManager.newUploadDataOperation(getSession(), values, tableName, path);
OperationHandle opHandle = operation.getHandle();
try {
operation.run();
opHandleSet.add(opHandle);
return opHandle;
} catch (HiveSQLException e) {
operationManager.closeOperation(opHandle);
throw e;
} finally {
release(true, true);
}
}
use of org.apache.hive.service.cli.OperationHandle 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.OperationHandle 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.OperationHandle in project hive by apache.
the class ThriftCLIServiceClient method getSchemas.
/* (non-Javadoc)
* @see org.apache.hive.service.cli.ICLIService#getSchemas(org.apache.hive.service.cli.SessionHandle, java.lang.String, java.lang.String)
*/
@Override
public OperationHandle getSchemas(SessionHandle sessionHandle, String catalogName, String schemaName) throws HiveSQLException {
try {
TGetSchemasReq req = new TGetSchemasReq(sessionHandle.toTSessionHandle());
req.setCatalogName(catalogName);
req.setSchemaName(schemaName);
TGetSchemasResp resp = cliService.GetSchemas(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.OperationHandle in project hive by apache.
the class QueryInfoCache method removeLiveQueryInfo.
/**
* Remove the live operation's query info from the {@liveQueryInfos},
* and push the query info to the historic query cache if enabled.
* @param operation the to remove operation
*/
public void removeLiveQueryInfo(Operation operation) {
if (operation instanceof SQLOperation) {
OperationHandle operationHandle = operation.getHandle();
synchronized (webuiLock) {
String opKey = operationHandle.getHandleIdentifier().toString();
// remove from list of live operations
QueryInfo display = liveQueryInfos.remove(opKey);
if (display == null) {
LOG.debug("Unexpected display object value of null for operation {}", opKey);
} else if (historicalQueryInfos != null) {
// add to list of saved historic operations
historicalQueryInfos.put(opKey, display);
}
}
}
}
Aggregations