private static boolean [ ] findIncludedColumns ( List < OrcProto . Type > types , Configuration conf ) { String includedStr = conf . get ( ColumnProjectionUtils . READ_COLUMN_IDS_CONF_STR ) ; if ( includedStr == null || includedStr . trim ( ) . length ( ) == 0 ) { return null ; } else { int numColumns = types . size ( ) ; boolean [ ] result = new boolean [ numColumns ] ; result [ 0 ] = true ; OrcProto . Type root = types . get ( 0 ) ; List < Integer > included = ColumnProjectionUtils . getReadColumnIDs ( conf ) ; for ( int i = 0 ; i < root . getSubtypesCount ( ) ; ++ i ) { if ( included . contains ( i ) ) { includeColumnRecursive ( types , result , root . getSubtypes ( i ) ) ; } } // if we are filtering at least one column, return the boolean array for ( boolean include : result ) { if ( ! include ) { return result ; } } return null ; } }
Take the configuration and figure out which columns we need to include .