diff --git a/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetFieldIdColumnResolverFactory.java b/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetFieldIdColumnResolverFactory.java index fd753807eec..d226157d00d 100644 --- a/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetFieldIdColumnResolverFactory.java +++ b/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetFieldIdColumnResolverFactory.java @@ -112,10 +112,7 @@ public ParquetColumnResolverMap of(MessageType schema) { */ @Override public ParquetColumnResolverMap of(TableKey tableKey, ParquetTableLocationKey tableLocationKey) { - final MessageType schema = tableLocationKey.getFileReader().getSchema(); - // TODO: note the potential for confusion on where to derive schema from. - // final MessageType schema = tableLocationKey.getMetadata().getFileMetaData().getSchema(); - return of(schema); + return of(tableLocationKey.getSchema()); } private class FieldIdMappingVisitor implements ParquetUtil.Visitor { diff --git a/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetTableLocationKey.java b/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetTableLocationKey.java index e56054fb859..1f6c07acf78 100644 --- a/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetTableLocationKey.java +++ b/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetTableLocationKey.java @@ -11,7 +11,9 @@ import io.deephaven.util.channel.SeekableChannelsProviderLoader; import org.apache.commons.io.FilenameUtils; import org.apache.parquet.format.RowGroup; +import org.apache.parquet.hadoop.metadata.FileMetaData; import org.apache.parquet.hadoop.metadata.ParquetMetadata; +import org.apache.parquet.schema.MessageType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -136,8 +138,8 @@ public synchronized void setFileReader(final ParquetFileReader fileReader) { } /** - * Get a previously-{@link #setMetadata(ParquetMetadata) set} or on-demand created {@link ParquetMetadata} for this - * location key's {@code file}. + * Get a previously-{@link #setMetadata(ParquetMetadata) set} or the {@link ParquetMetadata} for this location key's + * {@code file}. * * @return A {@link ParquetMetadata} for this location key's {@code file}. */ @@ -159,6 +161,28 @@ public synchronized void setMetadata(final ParquetMetadata metadata) { this.metadata = metadata; } + /** + * Equivalent to {@code getMetadata().getFileMetaData()}. + * + * @return the file metadata + * @see #getMetadata() + * @see ParquetMetadata#getFileMetaData() + */ + public FileMetaData getFileMetadata() { + return getMetadata().getFileMetaData(); + } + + /** + * Equivalent to {@code getFileMetadata().getSchema()}. + * + * @return the file metadata + * @see #getFileMetadata() + * @see FileMetaData#getSchema() + */ + public MessageType getSchema() { + return getFileMetadata().getSchema(); + } + /** * Get previously-{@link #setRowGroupIndices(int[]) set} or on-demand created {@link RowGroup} indices for this * location key's current {@link ParquetFileReader}.