vvysotskyi commented on a change in pull request #1969: DRILL-5733: Unable to 
SELECT from parquet file with Hadoop 2.7.4
URL: https://github.com/apache/drill/pull/1969#discussion_r375711722
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetTableMetadataProviderImpl.java
 ##########
 @@ -126,22 +128,23 @@ public Path getSelectionRoot() {
    * @return list of cache files found in the given directory path
    */
   public List<Path> populateMetaPaths(Path p, DrillFileSystem fs) throws 
IOException {
-    List<Path> metaFilepaths = new ArrayList<>();
-    for (String filename : Metadata.CURRENT_METADATA_FILENAMES) {
-      metaFilepaths.add(new Path(p, filename));
-    }
-    for (String filename : Metadata.OLD_METADATA_FILENAMES) {
-      // Read the older version of metadata file if the current version of 
metadata cache files donot exist.
+    if (fs.isDirectory(p)) {
+      List<Path> metaFilepaths = 
Arrays.stream(Metadata.CURRENT_METADATA_FILENAMES)
+          .map(filename -> new Path(p, filename))
+          .collect(Collectors.toList());
+      for (String filename : Metadata.OLD_METADATA_FILENAMES) {
+        // Read the older version of metadata file if the current version of 
metadata cache files do not exist.
+        if (fileExists(fs, metaFilepaths)) {
+          return metaFilepaths;
+        }
+        metaFilepaths.clear();
+        metaFilepaths.add(new Path(p, filename));
 
 Review comment:
   No, we will check whether the metadata files from the last iteration exist 
below the loop and in this case return list with files or an empty collection 
if they do not exist.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to