private ObjectNode visitStruct(final ObjectInspector oi, final Object o,
      final List<String> fieldNames) throws SerDeException {
    final StructObjectInspector structInspector = (StructObjectInspector) oi;

    final ObjectNode structNode = this.nodeFactory.objectNode();

    for (final StructField field : structInspector.getAllStructFieldRefs()) {
      final Object fieldValue = structInspector.getStructFieldData(o, field);
      final ObjectInspector coi = field.getFieldObjectInspector();
      final JsonNode fieldNode =
          walkObjectGraph(coi, fieldValue, Collections.emptyList());

      // Map field names to something else if require
      final String fieldName = (fieldNames.isEmpty()) ? field.getFieldName()
          : fieldNames.get(field.getFieldID());

      structNode.set(fieldName, fieldNode);
    }

    return structNode;
  }
Visit a vertex in the graph that is a struct data type. A struct is
represented as a Java List where the name associated with each element in
the list is stored in the ObjectInspector.

@param oi The struct's ObjectInspector
@param o The List object
@param fieldNames List of names to override the default field names
@return A JsonNode representation of the List
@throws SerDeException The struct cannot be parsed
serde/src/java/org/apache/hadoop/hive/serde2/json/HiveJsonWriter.java