You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by ih...@apache.org on 2020/02/12 10:52:05 UTC
[drill] 01/05: DRILL-5733: Unable to SELECT from parquet file with
Hadoop 2.7.4
This is an automated email from the ASF dual-hosted git repository.
ihuzenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/drill.git
commit 806760bc71fda421c08ca070f23c1f677d182f9b
Author: Volodymyr Vysotskyi <vv...@gmail.com>
AuthorDate: Wed Feb 5 20:17:08 2020 +0200
DRILL-5733: Unable to SELECT from parquet file with Hadoop 2.7.4
closes #1969
---
.../parquet/ParquetTableMetadataProviderImpl.java | 27 ++++++++++++----------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetTableMetadataProviderImpl.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetTableMetadataProviderImpl.java
index 18167ba..d05c7e8 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetTableMetadataProviderImpl.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetTableMetadataProviderImpl.java
@@ -37,6 +37,8 @@ import org.apache.hadoop.fs.Path;
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;
@@ -126,22 +128,23 @@ public class ParquetTableMetadataProviderImpl extends BaseParquetMetadataProvide
* @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 {