Github user adeneche commented on a diff in the pull request:
https://github.com/apache/drill/pull/345#discussion_r52519003
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetGroupScan.java
---
@@ -521,6 +543,25 @@ public void setEndpointByteMap(EndpointByteMap
byteMap) {
}
}
+ private FileSelection
+ getSelectionFromMetadataCache(DrillFileSystem fs, FileSelection
selection) throws IOException {
+ FileStatus metaRootDir = selection.getFirstPath(fs);
+ Path metaFilePath = new Path(metaRootDir.getPath(),
Metadata.METADATA_FILENAME);
+
+ // get the metadata for the directory by reading the metadata file
+ Metadata.ParquetTableMetadataBase metadata =
Metadata.readBlockMeta(fs, metaFilePath.toString());
+ List<String> fileNames = Lists.newArrayList();
+ for (Metadata.ParquetFileMetadata file : metadata.getFiles()) {
+ fileNames.add(file.getPath());
+ }
+ // when creating the file selection, set the selection root in the
form /a/b instead of
+ // file:/a/b. The reason is that the file names above have been
created in the form
+ // /a/b/c.parquet and the format of the selection root must match that
of the file names
+ // otherwise downstream operations such as partition pruning can break.
+ final Path metaRootPath =
Path.getPathWithoutSchemeAndAuthority(metaRootDir.getPath());
+ return FileSelection.create(selection.getStatuses(fs), fileNames,
metaRootPath.toString());
--- End diff --
`FileSelection.create()` expects either a list of statuses or a list of
filenames, but not both.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---