public void extractVertex(JSONObject object) throws Exception {
    if (object.has(this.parser.getFrameworkName())) {
      this.tezStageDependency = new TreeMap<>();
      JSONObject tez = (JSONObject) object.get(this.parser.getFrameworkName());
      JSONObject jsonVertices = tez.getJSONObject("Vertices:");
      if (tez.has("Edges:")) {
        JSONObject edges = tez.getJSONObject("Edges:");
        // iterate for the first time to get all the jsonVertices
        for (String to : JSONObject.getNames(edges)) {
          vertices.put(to, new Vertex(to, jsonVertices.getJSONObject(to), this, parser));
        }
        // iterate for the second time to get all the vertex dependency
        for (String to : JSONObject.getNames(edges)) {
          Object o = edges.get(to);
          Vertex v = vertices.get(to);
          // 1 to 1 mapping
          if (o instanceof JSONObject obj) {
            String parent = obj.getString("parent");
            Vertex parentVertex = vertices.get(parent);
            if (parentVertex == null) {
              parentVertex = new Vertex(parent, jsonVertices.getJSONObject(parent), this, parser);
              vertices.put(parent, parentVertex);
            }
            String type = obj.getString("type");
            // for union vertex, we reverse the dependency relationship
            if (!"CONTAINS".equals(type)) {
              v.addDependency(new Connection(type, parentVertex));
              parentVertex.setType(type);
              parentVertex.children.add(v);
            } else {
              parentVertex.addDependency(new Connection(type, v));
              v.children.add(parentVertex);
            }
            this.tezStageDependency.put(v, Arrays.asList(new Connection(type, parentVertex)));
          } else {
            // 1 to many mapping
            JSONArray from = (JSONArray) o;
            List<Connection> list = new ArrayList<>();
            for (int index = 0; index < from.length(); index++) {
              JSONObject obj = from.getJSONObject(index);
              String parent = obj.getString("parent");
              Vertex parentVertex = vertices.get(parent);
              if (parentVertex == null) {
                parentVertex = new Vertex(parent, jsonVertices.getJSONObject(parent), this, parser);
                vertices.put(parent, parentVertex);
              }
              String type = obj.getString("type");
              if (!"CONTAINS".equals(type)) {
                v.addDependency(new Connection(type, parentVertex));
                parentVertex.setType(type);
                parentVertex.children.add(v);
              } else {
                parentVertex.addDependency(new Connection(type, v));
                v.children.add(parentVertex);
              }
              list.add(new Connection(type, parentVertex));
            }
            this.tezStageDependency.put(v, list);
          }
        }
      } else {
        for (String vertexName : JSONObject.getNames(jsonVertices)) {
          vertices.put(vertexName, new Vertex(vertexName, jsonVertices.getJSONObject(vertexName), this, parser));
        }
      }

      // iterate for the first time to extract opTree in vertex
      for (Vertex v : vertices.values()) {
        if (v.vertexType == VertexType.MAP || v.vertexType == VertexType.REDUCE) {
          v.extractOpTree();
        }
      }
      // iterate for the second time to rewrite object
      for (Vertex v : vertices.values()) {
        v.checkMultiReduceOperator(parser.rewriteObject);
      }
    } else {
      String[] names = JSONObject.getNames(object);
      if (names != null) {
        for (String name : names) {
          if (name.contains("Operator")) {
            this.op = extractOp(name, object.getJSONObject(name));
          } else {
            if (!object.get(name).toString().isEmpty()) {
              attrs.put(name, object.get(name).toString());
            }
          }
        }
      }
    }
  }
@param object
@throws Exception
          If the object of stage contains "Tez", we need to extract the
          jsonVertices and edges Else we need to directly extract operators
          and/or attributes.
common/src/java/org/apache/hadoop/hive/common/jsonexplain/Stage.java