You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2013/04/30 21:45:40 UTC
svn commit: r1477796 [2/2] - in /hive/branches/vectorization: ./ common/
common/src/java/org/apache/hadoop/hive/conf/ conf/ data/files/ hcatalog/
jdbc/src/java/org/apache/hive/jdbc/ jdbc/src/test/org/apache/hive/jdbc/
ql/src/java/org/apache/hadoop/hive...
Modified: hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java?rev=1477796&r1=1477795&r2=1477796&view=diff
==============================================================================
--- hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java (original)
+++ hive/branches/vectorization/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java Tue Apr 30 19:45:38 2013
@@ -19,14 +19,17 @@
package org.apache.hive.service.cli.session;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.metastore.HiveMetaStoreClient;
import org.apache.hadoop.hive.metastore.IMetaStoreClient;
import org.apache.hadoop.hive.metastore.api.MetaException;
import org.apache.hadoop.hive.ql.session.SessionState;
+import org.apache.hive.common.util.HiveVersionInfo;
import org.apache.hive.service.cli.FetchOrientation;
import org.apache.hive.service.cli.GetInfoType;
import org.apache.hive.service.cli.GetInfoValue;
@@ -64,6 +67,7 @@ public class HiveSessionImpl implements
private SessionManager sessionManager;
private OperationManager operationManager;
private IMetaStoreClient metastoreClient = null;
+ private final Set<OperationHandle> opHandleSet = new HashSet<OperationHandle>();
public HiveSessionImpl(String username, String password, Map<String, String> sessionConf) {
this.username = username;
@@ -141,7 +145,7 @@ public class HiveSessionImpl implements
case CLI_DBMS_NAME:
return new GetInfoValue("Apache Hive");
case CLI_DBMS_VER:
- return new GetInfoValue("0.10.0");
+ return new GetInfoValue(HiveVersionInfo.getVersion());
case CLI_MAX_COLUMN_NAME_LEN:
return new GetInfoValue(128);
case CLI_MAX_SCHEMA_NAME_LEN:
@@ -164,7 +168,9 @@ public class HiveSessionImpl implements
ExecuteStatementOperation operation = getOperationManager()
.newExecuteStatementOperation(getSession(), statement, confOverlay);
operation.run();
- return operation.getHandle();
+ OperationHandle opHandle = operation.getHandle();
+ opHandleSet.add(opHandle);
+ return opHandle;
} finally {
release();
}
@@ -176,7 +182,9 @@ public class HiveSessionImpl implements
try {
GetTypeInfoOperation operation = getOperationManager().newGetTypeInfoOperation(getSession());
operation.run();
- return operation.getHandle();
+ OperationHandle opHandle = operation.getHandle();
+ opHandleSet.add(opHandle);
+ return opHandle;
} finally {
release();
}
@@ -188,7 +196,9 @@ public class HiveSessionImpl implements
try {
GetCatalogsOperation operation = getOperationManager().newGetCatalogsOperation(getSession());
operation.run();
- return operation.getHandle();
+ OperationHandle opHandle = operation.getHandle();
+ opHandleSet.add(opHandle);
+ return opHandle;
} finally {
release();
}
@@ -201,7 +211,9 @@ public class HiveSessionImpl implements
GetSchemasOperation operation =
getOperationManager().newGetSchemasOperation(getSession(), catalogName, schemaName);
operation.run();
- return operation.getHandle();
+ OperationHandle opHandle = operation.getHandle();
+ opHandleSet.add(opHandle);
+ return opHandle;
} finally {
release();
}
@@ -215,7 +227,9 @@ public class HiveSessionImpl implements
MetadataOperation operation =
getOperationManager().newGetTablesOperation(getSession(), catalogName, schemaName, tableName, tableTypes);
operation.run();
- return operation.getHandle();
+ OperationHandle opHandle = operation.getHandle();
+ opHandleSet.add(opHandle);
+ return opHandle;
} finally {
release();
}
@@ -227,7 +241,9 @@ public class HiveSessionImpl implements
try {
GetTableTypesOperation operation = getOperationManager().newGetTableTypesOperation(getSession());
operation.run();
- return operation.getHandle();
+ OperationHandle opHandle = operation.getHandle();
+ opHandleSet.add(opHandle);
+ return opHandle;
} finally {
release();
}
@@ -240,7 +256,9 @@ public class HiveSessionImpl implements
GetColumnsOperation operation = getOperationManager().newGetColumnsOperation(getSession(),
catalogName, schemaName, tableName, columnName);
operation.run();
- return operation.getHandle();
+ OperationHandle opHandle = operation.getHandle();
+ opHandleSet.add(opHandle);
+ return opHandle;
} finally {
release();
}
@@ -253,7 +271,9 @@ public class HiveSessionImpl implements
GetFunctionsOperation operation = getOperationManager()
.newGetFunctionsOperation(getSession(), catalogName, schemaName, functionName);
operation.run();
- return operation.getHandle();
+ OperationHandle opHandle = operation.getHandle();
+ opHandleSet.add(opHandle);
+ return opHandle;
} finally {
release();
}
@@ -270,6 +290,11 @@ public class HiveSessionImpl implements
if (metastoreClient != null) {
metastoreClient.close();
}
+ // Iterate through the opHandles and close their operations
+ for (OperationHandle opHandle : opHandleSet) {
+ operationManager.closeOperation(opHandle);
+ }
+ opHandleSet.clear();
} finally {
release();
}
@@ -300,7 +325,8 @@ public class HiveSessionImpl implements
public void closeOperation(OperationHandle opHandle) throws HiveSQLException {
acquire();
try {
- sessionManager.getOperationManager().closeOperation(opHandle);
+ operationManager.closeOperation(opHandle);
+ opHandleSet.remove(opHandle);
} finally {
release();
}
@@ -341,4 +367,4 @@ public class HiveSessionImpl implements
protected HiveSession getSession() {
return this;
}
-}
+}
\ No newline at end of file