You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by th...@apache.org on 2013/10/04 04:12:28 UTC
svn commit: r1529064 - in
/hive/branches/branch-0.12/service/src/test/org/apache/hive/service/cli:
CLIServiceTest.java thrift/ThriftCLIServiceTest.java
Author: thejas
Date: Fri Oct 4 02:12:27 2013
New Revision: 1529064
URL: http://svn.apache.org/r1529064
Log:
HIVE-5426: TestThriftBinaryCLIService tests fail on branch 0.12 (Vaibhav Gumashta via Thejas Nair)
Modified:
hive/branches/branch-0.12/service/src/test/org/apache/hive/service/cli/CLIServiceTest.java
hive/branches/branch-0.12/service/src/test/org/apache/hive/service/cli/thrift/ThriftCLIServiceTest.java
Modified: hive/branches/branch-0.12/service/src/test/org/apache/hive/service/cli/CLIServiceTest.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.12/service/src/test/org/apache/hive/service/cli/CLIServiceTest.java?rev=1529064&r1=1529063&r2=1529064&view=diff
==============================================================================
--- hive/branches/branch-0.12/service/src/test/org/apache/hive/service/cli/CLIServiceTest.java (original)
+++ hive/branches/branch-0.12/service/src/test/org/apache/hive/service/cli/CLIServiceTest.java Fri Oct 4 02:12:27 2013
@@ -122,18 +122,23 @@ public abstract class CLIServiceTest {
assertNotNull(sessionHandle);
// Change lock manager, otherwise unit-test doesn't go through
- String setLockMgr = "SET hive.lock.manager=" +
+ String queryString = "SET hive.lock.manager=" +
"org.apache.hadoop.hive.ql.lockmgr.EmbeddedLockManager";
- client.executeStatement(sessionHandle, setLockMgr, confOverlay);
+ client.executeStatement(sessionHandle, queryString, confOverlay);
- String createTable = "CREATE TABLE TEST_EXEC(ID STRING)";
- client.executeStatement(sessionHandle, createTable, confOverlay);
+ // Drop the table if it exists
+ queryString = "DROP TABLE IF EXISTS TEST_EXEC";
+ client.executeStatement(sessionHandle, queryString, confOverlay);
- // blocking execute
- String select = "SELECT ID FROM TEST_EXEC";
- OperationHandle ophandle = client.executeStatement(sessionHandle, select, confOverlay);
+ // Create a test table
+ queryString = "CREATE TABLE TEST_EXEC(ID STRING)";
+ client.executeStatement(sessionHandle, queryString, confOverlay);
- // expect query to be completed now
+ // Blocking execute
+ queryString = "SELECT ID FROM TEST_EXEC";
+ OperationHandle ophandle = client.executeStatement(sessionHandle, queryString, confOverlay);
+
+ // Expect query to be completed now
assertEquals("Query should be finished",
OperationState.FINISHED, client.getOperationStatus(ophandle));
}
@@ -150,23 +155,28 @@ public abstract class CLIServiceTest {
OperationHandle ophandle;
// Change lock manager, otherwise unit-test doesn't go through
- String setLockMgr = "SET hive.lock.manager=" +
+ String queryString = "SET hive.lock.manager=" +
"org.apache.hadoop.hive.ql.lockmgr.EmbeddedLockManager";
- client.executeStatement(sessionHandle, setLockMgr, confOverlay);
+ client.executeStatement(sessionHandle, queryString, confOverlay);
- String createTable = "CREATE TABLE TEST_EXEC_ASYNC(ID STRING)";
- client.executeStatementAsync(sessionHandle, createTable, confOverlay);
+ // Drop the table if it exists
+ queryString = "DROP TABLE IF EXISTS TEST_EXEC_ASYNC";
+ client.executeStatement(sessionHandle, queryString, confOverlay);
+
+ // Create a test table
+ queryString = "CREATE TABLE TEST_EXEC_ASYNC(ID STRING)";
+ client.executeStatement(sessionHandle, queryString, confOverlay);
// Test async execution response when query is malformed
- String wrongQuery = "SELECT NAME FROM TEST_EXEC";
- ophandle = client.executeStatementAsync(sessionHandle, wrongQuery, confOverlay);
+ String wrongQueryString = "SELECT NAME FROM TEST_EXEC";
+ ophandle = client.executeStatementAsync(sessionHandle, wrongQueryString, confOverlay);
int count = 0;
while (true) {
// Break if polling times out
if (System.currentTimeMillis() > pollTimeout) {
- System.out.println("Polling timed out");
- break;
+ System.out.println("Polling timed out");
+ break;
}
state = client.getOperationStatus(ophandle);
System.out.println("Polling: " + ophandle + " count=" + (++count)
@@ -182,16 +192,16 @@ public abstract class CLIServiceTest {
OperationState.ERROR, client.getOperationStatus(ophandle));
// Test async execution when query is well formed
- String select = "SELECT ID FROM TEST_EXEC_ASYNC";
+ queryString = "SELECT ID FROM TEST_EXEC_ASYNC";
ophandle =
- client.executeStatementAsync(sessionHandle, select, confOverlay);
+ client.executeStatementAsync(sessionHandle, queryString, confOverlay);
count = 0;
while (true) {
// Break if polling times out
if (System.currentTimeMillis() > pollTimeout) {
- System.out.println("Polling timed out");
- break;
+ System.out.println("Polling timed out");
+ break;
}
state = client.getOperationStatus(ophandle);
System.out.println("Polling: " + ophandle + " count=" + (++count)
@@ -207,7 +217,7 @@ public abstract class CLIServiceTest {
OperationState.FINISHED, client.getOperationStatus(ophandle));
// Cancellation test
- ophandle = client.executeStatementAsync(sessionHandle, select, confOverlay);
+ ophandle = client.executeStatementAsync(sessionHandle, queryString, confOverlay);
System.out.println("cancelling " + ophandle);
client.cancelOperation(ophandle);
state = client.getOperationStatus(ophandle);
Modified: hive/branches/branch-0.12/service/src/test/org/apache/hive/service/cli/thrift/ThriftCLIServiceTest.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.12/service/src/test/org/apache/hive/service/cli/thrift/ThriftCLIServiceTest.java?rev=1529064&r1=1529063&r2=1529064&view=diff
==============================================================================
--- hive/branches/branch-0.12/service/src/test/org/apache/hive/service/cli/thrift/ThriftCLIServiceTest.java (original)
+++ hive/branches/branch-0.12/service/src/test/org/apache/hive/service/cli/thrift/ThriftCLIServiceTest.java Fri Oct 4 02:12:27 2013
@@ -174,10 +174,16 @@ public abstract class ThriftCLIServiceTe
"org.apache.hadoop.hive.ql.lockmgr.EmbeddedLockManager";
executeQuerySync(queryString, sessHandle);
- queryString = "CREATE TABLE TEST_EXEC(ID STRING)";
+ // Drop the table if it exists
+ queryString = "DROP TABLE IF EXISTS TEST_EXEC_THRIFT";
executeQuerySync(queryString, sessHandle);
- queryString = "SELECT ID FROM TEST_EXEC";
+ // Create a test table
+ queryString = "CREATE TABLE TEST_EXEC_THRIFT(ID STRING)";
+ executeQuerySync(queryString, sessHandle);
+
+ // Execute another query to test
+ queryString = "SELECT ID FROM TEST_EXEC_THRIFT";
TExecuteStatementResp execResp = executeQuerySync(queryString, sessHandle);
TOperationHandle operationHandle = execResp.getOperationHandle();
assertNotNull(operationHandle);
@@ -187,7 +193,7 @@ public abstract class ThriftCLIServiceTe
assertNotNull(opStatusReq);
TGetOperationStatusResp opStatusResp = client.GetOperationStatus(opStatusReq);
- // expect query to be completed now since it was an async call
+ // Expect query to be completed now
assertEquals("Query should be finished",
OperationState.FINISHED, OperationState.getOperationState(opStatusResp.getOperationState()));