Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/824#discussion_r122602455
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/Metadata.java 
---
    @@ -179,10 +182,18 @@ private Metadata(FileSystem fs, ParquetFormatConfig 
formatConfig) {
     
         for (final FileStatus file : fs.listStatus(p, new DrillPathFilter())) {
           if (file.isDirectory()) {
    +        String subdirectoryName = file.getPath().getName();
             ParquetTableMetadata_v3 subTableMetadata = 
(createMetaFilesRecursively(file.getPath().toString())).getLeft();
    -        metaDataList.addAll(subTableMetadata.files);
    -        directoryList.addAll(subTableMetadata.directories);
    -        directoryList.add(file.getPath().toString());
    +        for (ParquetFileMetadata_v3 pfm_v3 : subTableMetadata.files) {
    +          // Construction of the relative file path by adding subdirectory 
name and inner relative file path
    +          String relativePath = Joiner.on("/").join(subdirectoryName, 
pfm_v3.getPath());
    --- End diff --
    
    `Path.mergePaths()`?
    
    We really don't want to work with paths as strings: such code is hard to 
test and maintain.
    
    If we need new Path operations (such as merging relative paths), I suggest 
we create a `PathUtils` class to hold the operations. Then, create unit tests 
to check all the various conditions: empty head, empty tail, neither empty, etc.
    
    Also, in general, we would work with path names as `Path` objects: the job 
of the `Path` class is do properly implement file path operations, just as the 
job of the older `File` and newer `Path` classes in Java is to handle OS paths.


---
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.
---

Reply via email to