Source:
<code>public ParquetPageSource( ParquetReader parquetReader, MessageType fileSchema, MessageColumnIO messageColumnIO, TypeManager typeManager, Properties splitSchema, List<HiveColumnHandle> columns, TupleDomain<HiveColumnHandle> effectivePredicate, boolean useParquetColumnNames) { requireNonNull(splitSchema, "splitSchema is null"); requireNonNull(columns, "columns is null"); requireNonNull(effectivePredicate, "effectivePredicate is null"); this.parquetReader = requireNonNull(parquetReader, "parquetReader is null"); this.fileSchema = requireNonNull(fileSchema, "fileSchema is null"); this.useParquetColumnNames = useParquetColumnNames; int size = columns.size(); this.constantBlocks = new Block[size]; this.hiveColumnIndexes = new int[size]; ImmutableList.Builder<String> namesBuilder = ImmutableList.builder(); ImmutableList.Builder<Type> typesBuilder = ImmutableList.builder(); ImmutableList.Builder<Optional<Field>> fieldsBuilder = ImmutableList.builder(); for (int columnIndex = 0; columnIndex < size; columnIndex++) { HiveColumnHandle column = columns.get(columnIndex); checkState(column.getColumnType() == REGULAR, "column type must be regular"); String name = column.getName(); Type type = typeManager.getType(column.getTypeSignature()); namesBuilder.add(name); typesBuilder.add(type); hiveColumnIndexes[columnIndex] = column.getHiveColumnIndex(); if (getParquetType(column, fileSchema, useParquetColumnNames) == null) { constantBlocks[columnIndex] = RunLengthEncodedBlock.create(type, null, MAX_VECTOR_LENGTH); fieldsBuilder.add(Optional.empty()); } else { String columnName = useParquetColumnNames ? name : fileSchema.getFields().get(column.getHiveColumnIndex()).getName(); <START> fieldsBuilder.add(constructField(type, getColumnIOByName(messageColumnIO, columnName))); <END> } } types = typesBuilder.build(); fields = fieldsBuilder.build(); columnNames = namesBuilder.build(); }</code><technical_language>getColumnIOByName return null, a NPE in add call. If getColumnIOByName returns null means a column name found, get column name Parquet file schema, I feel a serious error condition instead of returning a null throw</technical_language>

Target:
public ParquetPageSource( ParquetReader parquetReader, MessageType fileSchema, MessageColumnIO messageColumnIO, TypeManager typeManager, Properties splitSchema, List<HiveColumnHandle> columns, TupleDomain<HiveColumnHandle> effectivePredicate, boolean useParquetColumnNames) { requireNonNull(splitSchema, "splitSchema is null"); requireNonNull(columns, "columns is null"); requireNonNull(effectivePredicate, "effectivePredicate is null"); this.parquetReader = requireNonNull(parquetReader, "parquetReader is null"); this.fileSchema = requireNonNull(fileSchema, "fileSchema is null"); this.useParquetColumnNames = useParquetColumnNames; int size = columns.size(); this.constantBlocks = new Block[size]; this.hiveColumnIndexes = new int[size]; ImmutableList.Builder<String> namesBuilder = ImmutableList.builder(); ImmutableList.Builder<Type> typesBuilder = ImmutableList.builder(); ImmutableList.Builder<Optional<Field>> fieldsBuilder = ImmutableList.builder(); for (int columnIndex = 0; columnIndex < size; columnIndex++) { HiveColumnHandle column = columns.get(columnIndex); checkState(column.getColumnType() == REGULAR, "column type must be regular"); String name = column.getName(); Type type = typeManager.getType(column.getTypeSignature()); namesBuilder.add(name); typesBuilder.add(type); hiveColumnIndexes[columnIndex] = column.getHiveColumnIndex(); if (getParquetType(column, fileSchema, useParquetColumnNames) == null) { constantBlocks[columnIndex] = RunLengthEncodedBlock.create(type, null, MAX_VECTOR_LENGTH); fieldsBuilder.add(Optional.empty()); } else { String columnName = useParquetColumnNames ? name : fileSchema.getFields().get(column.getHiveColumnIndex()).getName(); fieldsBuilder.add(constructField(type, lookupColumnByName(messageColumnIO, columnName))); } } types = typesBuilder.build(); fields = fieldsBuilder.build(); columnNames = namesBuilder.build(); }