drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hnfgns <...@git.apache.org>
Subject [GitHub] drill pull request: DRILL-2618: handle queries over empty folders ...
Date Fri, 20 Nov 2015 01:45:01 GMT
Github user hnfgns commented on a diff in the pull request:

    https://github.com/apache/drill/pull/270#discussion_r45427577
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSelection.java
---
    @@ -19,82 +19,72 @@
     
     import java.io.IOException;
     import java.net.URI;
    -import java.util.Collections;
     import java.util.List;
    -import java.util.concurrent.TimeUnit;
    -
    -import com.google.common.base.Stopwatch;
    -import org.apache.commons.lang3.ArrayUtils;
    -import org.apache.commons.lang3.StringUtils;
    -import org.apache.drill.exec.store.parquet.Metadata.ParquetTableMetadata_v1;
    -import org.apache.hadoop.fs.FileStatus;
    -import org.apache.hadoop.fs.Path;
    +import javax.annotation.Nullable;
     
     import com.fasterxml.jackson.annotation.JsonIgnore;
    +import com.google.common.base.Preconditions;
    +import com.google.common.base.Predicate;
    +import com.google.common.base.Strings;
    +import com.google.common.collect.Iterables;
     import com.google.common.collect.Lists;
    +import org.apache.hadoop.fs.FileStatus;
    +import org.apache.hadoop.fs.Path;
     
     /**
    - * Jackson serializable description of a file selection. Maintains an internal set of
file statuses. However, also
    - * serializes out as a list of Strings. All accessing methods first regenerate the FileStatus
objects if they are not
    - * available.  This allows internal movement of FileStatus and the ability to serialize
if need be.
    + * Jackson serializable description of a file selection.
      */
     public class FileSelection {
       static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(FileSelection.class);
     
       @JsonIgnore
    -  private List<FileStatus> statuses;
    +  public List<FileStatus> statuses;
     
       public List<String> files;
       public String selectionRoot;
     
    -  // this is a temporary location for the reference to Parquet metadata
    -  // TODO: ideally this should be in a Parquet specific derived class.
    -  private ParquetTableMetadata_v1 parquetMeta = null;
    -
    -  public FileSelection() {
    -  }
    -
    -  public FileSelection(List<String> files, String selectionRoot, boolean dummy)
{
    -    this.files = files;
    -    this.selectionRoot = selectionRoot;
    -  }
    -
    -  public FileSelection(List<String> files, boolean dummy) {
    -    this.files = files;
    -  }
    -
    -  public FileSelection(List<FileStatus> statuses) {
    -    this(statuses, null);
    -  }
    -
    -  public FileSelection(List<String> files, String selectionRoot,
    -      ParquetTableMetadata_v1 meta) {
    +  /**
    +   * Creates a {@link FileSelection selection} out of given file statuses/files and selection
root.
    +   *
    +   * @param statuses  list of file statuses
    +   * @param files  list of files
    +   * @param selectionRoot  root path for selections
    +   *
    +   * @throws IllegalArgumentException if the list of statuses and files are null or empty.
    +   */
    +  protected FileSelection(List<FileStatus> statuses, List<String> files,
String selectionRoot) {
    +    final boolean emptySelection = (statuses == null || statuses.size() == 0) &&
(files == null || files.size() == 0);
    +    Preconditions.checkArgument(!emptySelection, "Either statuses or files must be supplied
not both/node of them");
    --- End diff --
    
    done.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message