private static StructField[] initializeFieldsFromOi(ObjectInspector inspector) {
    if (inspector instanceof StructObjectInspector) {
      List<? extends StructField> fieldList =
          ((StructObjectInspector) inspector).getAllStructFieldRefs();
      StructField[] fields = new StructField[fieldList.size()];
      fieldList.toArray(fields);
      return fields;
    } else {
      return null;
    }
  }
An ORC file writer. The file is divided into stripes, which is the natural
unit of work when reading. Each stripe is buffered in memory until the
memory reaches the stripe size and then it is written out broken down by
columns. Each column is written by a TreeWriter that is specific to that
type of column. TreeWriters may have children TreeWriters that handle the
sub-types. Each of the TreeWriters writes the column's data as a set of
streams.

This class is unsynchronized like most Stream objects, so from the creation of an OrcFile and all
access to a single instance has to be from a single thread.

There are no known cases where these happen between different threads today.

Caveat: the MemoryManager is created during WriterOptions create, that has to be confined to a single
thread as well.
ql/src/java/org/apache/hadoop/hive/ql/io/orc/WriterImpl.java