public static int getStructSize(ObjectInspector oi) throws SerDeException {
    if (oi.getCategory() != Category.STRUCT) {
      throw new SerDeException("Unexpected category " + oi.getCategory());
    }
    return ((StructObjectInspector)oi).getAllStructFieldRefs().size();
  }
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