Skip to content

Commit

Permalink
DRILL-5733: Unable to SELECT from parquet file with Hadoop 2.7.4
Browse files Browse the repository at this point in the history
closes #1969
  • Loading branch information
vvysotskyi authored and ihuzenko committed Feb 12, 2020
1 parent b93e085 commit 806760b
Showing 1 changed file with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
Expand Down Expand Up @@ -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 does not exist.
if (fileExists(fs, metaFilepaths)) {
return metaFilepaths;
}
metaFilepaths.clear();
metaFilepaths.add(new Path(p, filename));
}
if (fileExists(fs, metaFilepaths)) {
return metaFilepaths;
}
metaFilepaths.clear();
metaFilepaths.add(new Path(p, filename));
}
if (fileExists(fs, metaFilepaths)) {
return metaFilepaths;
}
return new ArrayList<>();
return Collections.emptyList();
}

public boolean fileExists(DrillFileSystem fs, List<Path> paths) throws IOException {
Expand Down

0 comments on commit 806760b

Please sign in to comment.