protected void assertMappersAreVectorized(String query)
          throws Exception {
    List<String> rs = runStatementOnDriver("EXPLAIN FORMATTED VECTORIZATION DETAIL " + query);
    ObjectMapper objectMapper = new ObjectMapper();
    Map<String, Object> plan = objectMapper.readValue(rs.get(0), Map.class);
    Map<String, Object> stages = (Map<String, Object>) plan.get("STAGE PLANS");
    Map<String, Object> tezStage = null;
    if (stages == null) {
      Assert.fail("Execution plan of query does not have have stages: " + rs.get(0));
    }
    for (Map.Entry<String, Object> stageEntry : stages.entrySet()) {
      Map<String, Object> stage = (Map<String, Object>) stageEntry.getValue();
      tezStage = (Map<String, Object>) stage.get("Tez");
      if (tezStage != null) {
        break;
      }
    }
    if (tezStage == null) {
      Assert.fail("Execution plan of query does not contain a Tez stage: " + rs.get(0));
    }
    Map<String, Object> vertices = (Map<String, Object>) tezStage.get("Vertices:");
    if (vertices == null) {
      Assert.fail("Execution plan of query does not contain Tez vertices: " + rs.get(0));
    }
    for (Map.Entry<String, Object> vertexEntry : stages.entrySet()) {
      if (vertexEntry.getKey() == null || !vertexEntry.getKey().startsWith("Map")) {
        continue;
      }
      Map<String, Object> mapVertex = (Map<String, Object>) vertexEntry.getValue();
      String executionMode = (String) mapVertex.get("Execution mode");
      boolean vectorized = isNotBlank(executionMode) && executionMode.contains("vectorized");
      String message = "Mapper was " + (shouldVectorized() ? "not vectorized: " : "vectorized but was not expected: ");
      Assert.assertTrue(message + rs.get(0),
              shouldVectorized() ^ vectorized);
    }
  }
takes raw data and turns it into a string as if from Driver.getResults()
sorts rows in dictionary order
ql/src/test/org/apache/hadoop/hive/ql/TxnCommandsBaseForTests.java