drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkorukanti <...@git.apache.org>
Subject [GitHub] drill pull request #527: DRILL-4728: Add support for new metadata fetch APIs
Date Fri, 05 Aug 2016 22:15:11 GMT
Github user vkorukanti commented on a diff in the pull request:

    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/pojo/PojoRecordReader.java
    @@ -47,24 +46,30 @@
     import org.apache.drill.exec.vector.AllocationHelper;
     import org.apache.drill.exec.vector.ValueVector;
    +import com.google.common.collect.ImmutableList;
     import com.google.common.collect.Lists;
    -public class PojoRecordReader<T> extends AbstractRecordReader {
    +public class PojoRecordReader<T> extends AbstractRecordReader implements Iterable<T>
       private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(PojoRecordReader.class);
       private static final ControlsInjector injector = ControlsInjectorFactory.getInjector(PojoRecordReader.class);
    -  public final int forJsonIgnore = 1;
       private final Class<T> pojoClass;
    -  private final Iterator<T> iterator;
    +  private final List<T> pojoObjects;
       private PojoWriter[] writers;
       private boolean doCurrent;
       private T currentPojo;
       private OperatorContext operatorContext;
    +  private Iterator<T> currentIterator;
    +  /**
    +   * TODO: Cleanup the callers to pass the List of POJO objects directly rather than
    +   * @param pojoClass
    +   * @param iterator
    +   */
       public PojoRecordReader(Class<T> pojoClass, Iterator<T> iterator) {
         this.pojoClass = pojoClass;
    -    this.iterator = iterator;
    +    this.pojoObjects = ImmutableList.copyOf(iterator);
    --- End diff --
    We already create a list and pass the iterator. So we are not losing any lazyness. Are
there any places where we populate when iterator is accessed?

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.

View raw message