public static boolean[] firstLevelFileIncludes(SchemaEvolution evolution) {
    // This is the leaf level type description include bool array
    boolean[] lowLevelIncludes = evolution.getFileIncluded();
    Map<Integer, TypeDescription> idMap = new HashMap<>();
    Map<Integer, Integer> parentIdMap = new HashMap<>();
    idToFieldSchemaMap(evolution.getFileSchema(), idMap, parentIdMap);

    // Root + N top level columns...
    boolean[] result = new boolean[evolution.getFileSchema().getChildren().size() + 1];

    Set<Integer> requiredTopLevelSchemaIds = new HashSet<>();
    for (int i = 1; i < lowLevelIncludes.length; ++i) {
      if (lowLevelIncludes[i]) {
        int topLevelParentId = getTopLevelParentId(i, parentIdMap);
        if (!requiredTopLevelSchemaIds.contains(topLevelParentId)) {
          requiredTopLevelSchemaIds.add(topLevelParentId);
        }
      }
    }

    List<TypeDescription> topLevelFields = evolution.getFileSchema().getChildren();

    for (int typeDescriptionId : requiredTopLevelSchemaIds) {
      result[IntStream.range(0, topLevelFields.size()).filter(
          i -> typeDescriptionId == topLevelFields.get(i).getId()).findFirst().getAsInt() + 1] = true;
    }

    return result;
  }
Based on the file schema and the low level file includes provided in the SchemaEvolution instance, this method
calculates which top level columns should be included i.e. if any of the nested columns inside complex types is
required, then its relevant top level parent column will be considered as required (and thus the full subtree).
Hive and LLAP currently only supports column pruning on the first level, thus we need to calculate this ourselves.
@param evolution
@return bool array of include values, where 0th element is root struct, and any Nth element is a first level
column within that
ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcInputFormat.java