private void testColumnLineageOutput(
     TestCase testCase, TQueryCtx queryCtx, StringBuilder errorLog, StringBuilder actualOutput)
     throws CatalogException {
   ArrayList<String> expectedLineage = testCase.getSectionContents(Section.LINEAGE);
   if (expectedLineage == null || expectedLineage.isEmpty()) return;
   String query = testCase.getQuery();
   queryCtx.request.getQuery_options().setNum_nodes(1);
   queryCtx.request.setStmt(query);
   StringBuilder explainBuilder = new StringBuilder();
   TExecRequest execRequest = null;
   String lineageGraph = null;
   try {
     execRequest = frontend_.createExecRequest(queryCtx, explainBuilder);
     if (execRequest.isSetQuery_exec_request()) {
       lineageGraph = execRequest.query_exec_request.lineage_graph;
     } else if (execRequest.isSetCatalog_op_request()) {
       lineageGraph = execRequest.catalog_op_request.lineage_graph;
     }
   } catch (ImpalaException e) {
     if (e instanceof AnalysisException) {
       errorLog.append("query:\n" + query + "\nanalysis error: " + e.getMessage() + "\n");
       return;
     } else if (e instanceof InternalException) {
       errorLog.append("query:\n" + query + "\ninternal error: " + e.getMessage() + "\n");
       return;
     }
     if (e instanceof NotImplementedException) {
       handleNotImplException(query, "", errorLog, actualOutput, e);
     } else if (e instanceof CatalogException) {
       throw (CatalogException) e;
     } else {
       errorLog.append("query:\n" + query + "\nunhandled exception: " + e.getMessage() + "\n");
     }
   }
   LOG.info("lineage graph: " + lineageGraph);
   ArrayList<String> expected = testCase.getSectionContents(Section.LINEAGE);
   if (expected.size() > 0 && lineageGraph != null) {
     String serializedGraph = Joiner.on("\n").join(expected);
     ColumnLineageGraph expectedGraph = ColumnLineageGraph.createFromJSON(serializedGraph);
     ColumnLineageGraph outputGraph = ColumnLineageGraph.createFromJSON(lineageGraph);
     if (expectedGraph == null || outputGraph == null || !outputGraph.equals(expectedGraph)) {
       StringBuilder lineageError = new StringBuilder();
       lineageError.append("section " + Section.LINEAGE + " of query:\n" + query + "\n");
       lineageError.append("Output:\n");
       lineageError.append(lineageGraph + "\n");
       lineageError.append("Expected:\n");
       lineageError.append(serializedGraph + "\n");
       errorLog.append(lineageError.toString());
     }
     actualOutput.append(Section.LINEAGE.getHeader());
     actualOutput.append(TestUtils.prettyPrintJson(lineageGraph) + "\n");
   }
 }