@Test
  public void testTaskStatus() throws Exception {
    HashMap<String, String> confOverlay = new HashMap<String, String>();
    String tableName = "TEST_EXEC_ASYNC";
    String columnDefinitions = "(ID STRING)";

    // Open a session and set up the test data
    SessionHandle sessionHandle = setupTestData(tableName, columnDefinitions, confOverlay);
    assertNotNull(sessionHandle);
    // nonblocking execute
    String select = "select a.id, b.id from (SELECT ID + ' ' `ID` FROM TEST_EXEC_ASYNC) a full outer join "
      + "(SELECT ID + ' ' `ID` FROM TEST_EXEC_ASYNC) b on a.ID=b.ID";
    OperationHandle ophandle =
      client.executeStatementAsync(sessionHandle, select, confOverlay);

    OperationStatus status = null;
    int count = 0;
    while (true) {
      status = client.getOperationStatus(ophandle, false);
      checkOperationTimes(ophandle, status);
      OperationState state = status.getState();
      System.out.println("Polling: " + ophandle + " count=" + (++count)
        + " state=" + state);

      String jsonTaskStatus = status.getTaskStatus();
      assertNotNull(jsonTaskStatus);
      ObjectMapper mapper = new ObjectMapper();
      ByteArrayInputStream in = new ByteArrayInputStream(jsonTaskStatus.getBytes("UTF-8"));
      List<QueryDisplay.TaskDisplay> taskStatuses =
        mapper.readValue(in, new TypeReference<List<QueryDisplay.TaskDisplay>>(){});
      System.out.println("task statuses: " + jsonTaskStatus); // TaskDisplay doesn't have a toString, using json
      checkTaskStatuses(taskStatuses);
      if (OperationState.CANCELED == state || state == OperationState.CLOSED
        || state == OperationState.FINISHED
        || state == OperationState.ERROR) {
        for (QueryDisplay.TaskDisplay display: taskStatuses) {
          assertNotNull(display.getReturnValue());
        }
        break;
      }
      Thread.sleep(1000);
    }
  }
Test per statement configuration overlay.
Create a table using hiveconf: var substitution, with the conf var passed
via confOverlay.Verify the confOverlay works for the query and does set the
value in the session configuration
@throws Exception
service/src/test/org/apache/hive/service/cli/CLIServiceTest.java