Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/877#discussion_r127365973 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetGroupScan.java --- @@ -723,19 +723,20 @@ private void init(MetadataContext metaContext) throws IOException { // if querying a single file we can look up the metadata directly from the file metaPath = new Path(p, Metadata.METADATA_FILENAME); } - if (metaPath != null && fs.exists(metaPath)) { + if (metaPath != null && fs.exists(metaPath) && Metadata.MetadataVersion.isVersionSupported(fs, metaPath)) { usedMetadataCache = true; - parquetTableMetadata = Metadata.readBlockMeta(fs, metaPath.toString(), metaContext, formatConfig); + parquetTableMetadata = Metadata.readBlockMeta(fs, metaPath, metaContext, formatConfig); } else { parquetTableMetadata = Metadata.getParquetTableMetadata(fs, p.toString(), formatConfig); } } else { Path p = Path.getPathWithoutSchemeAndAuthority(new Path(selectionRoot)); metaPath = new Path(p, Metadata.METADATA_FILENAME); - if (fs.isDirectory(new Path(selectionRoot)) && fs.exists(metaPath)) { + if (fs.isDirectory(new Path(selectionRoot)) && fs.exists(metaPath) --- End diff -- Can we factor out this code so that we do the checks in only one place? Something like a `boolean loadMetadata(...)` method that does all the checks mentioned above? In general, repeated code = bad. Somebody has to test this code multiple times if it is repeated. Do the unit tests do so?
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---