public static void copyStructToArray(Object o, ObjectInspector oi,
      ObjectInspectorCopyOption objectInspectorOption, Object[] dest, int offset)
          throws SerDeException {
    if (o == null) {
      return;
    }

    if (oi.getCategory() != Category.STRUCT) {
      throw new SerDeException("Unexpected category " + oi.getCategory());
    }

    StructObjectInspector soi = (StructObjectInspector) oi;
    List<? extends StructField> fields = soi.getAllStructFieldRefs();
    for (int i = 0; i < fields.size(); ++i) {
      StructField f = fields.get(i);
      dest[offset + i] = copyToStandardObject(soi.getStructFieldData(o, f), f
          .getFieldObjectInspector(), objectInspectorOption);
    }
  }
Returns a deep copy of the Object o that can be scanned by a
StandardObjectInspector returned by getStandardObjectInspector(oi).
serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorUtils.java