parquet-hive/parquet-hive-storage-handler/src/main/java/org/apache/hadoop/hive/ql/io/parquet/read/DataWritableReadSupport.java
private MessageType resolveSchemaAccess(MessageType requestedSchema, MessageType fileSchema,
          Configuration configuration) {
    if(configuration.getBoolean(PARQUET_COLUMN_INDEX_ACCESS, false)) {
      final List<String> listColumns = getColumns(configuration.get(IOConstants.COLUMNS));

      List<Type> requestedTypes = new ArrayList<Type>();

      for(Type t : requestedSchema.getFields()) {
        int index = listColumns.indexOf(t.getName());
        requestedTypes.add(fileSchema.getType(index));
      }

      requestedSchema = new MessageType(requestedSchema.getName(), requestedTypes);
    }

    return requestedSchema;
  }
private MessageType resolveSchemaAccess(MessageType requestedSchema, MessageType fileSchema,
          Configuration configuration) {
    if(configuration.getBoolean(PARQUET_COLUMN_INDEX_ACCESS, false)) {
      final List<String> listColumns = getColumns(configuration.get(IOConstants.COLUMNS));

      List<Type> requestedTypes = new ArrayList<Type>();

      for(Type t : requestedSchema.getFields()) {
        int index = listColumns.indexOf(t.getName());
        requestedTypes.add(fileSchema.getType(index));
      }

      requestedSchema = new MessageType(requestedSchema.getName(), requestedTypes);
    }

    return requestedSchema;
  }
private MessageType resolveSchemaAccess ( MessageType requestedSchema , MessageType fileSchema , Configuration configuration ) { if ( configuration . getBoolean ( PARQUET_COLUMN_INDEX_ACCESS , false ) ) { final List < String > listColumns = getColumns ( configuration . get ( IOConstants . COLUMNS ) ) ; List < Type > requestedTypes = new ArrayList < Type > ( ) ; for ( Type t : requestedSchema . getFields ( ) ) { int index = listColumns . indexOf ( t . getName ( ) ) ; requestedTypes . add ( fileSchema . getType ( index ) ) ; } requestedSchema = new MessageType ( requestedSchema . getName ( ) , requestedTypes ) ; } return requestedSchema ; }
Determine the file column names based on the position within the requested columns and
use that as the requested schema.
Determine the file column names based on the position within the requested columns and use that as the requested schema .