drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [3/4] drill git commit: DRILL-4445: Standardize the Physical and Logical plan nodes to use Lists instead of arrays for their inputs
Date Wed, 20 Apr 2016 16:08:55 GMT
DRILL-4445: Standardize the Physical and Logical plan nodes to use Lists instead of arrays for their inputs

Remove some extra translation logic used to move between the
two representations.

TODO - look back the the Join logical node, has two JsonCreator annotations,
but only one will be used. Not sure if the behavior of which is chosen
is considered documented behavior, should just fix it on our end.


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/d24205d4
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/d24205d4
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/d24205d4

Branch: refs/heads/master
Commit: d24205d4e795a1aab54b64708dde1e7deeca668b
Parents: c6a03eb
Author: Jason Altekruse <altekrusejason@gmail.com>
Authored: Wed Feb 10 17:36:47 2016 -0800
Committer: Jason Altekruse <altekrusejason@gmail.com>
Committed: Wed Apr 20 08:10:40 2016 -0700

----------------------------------------------------------------------
 .../apache/drill/exec/opt/BasicOptimizer.java   | 18 +++++++----------
 .../exec/physical/base/AbstractMultiple.java    |  9 +++++----
 .../exec/physical/config/HashAggregate.java     | 15 +++++++++-----
 .../physical/config/StreamingAggregate.java     | 12 ++++++-----
 .../drill/exec/physical/config/UnionAll.java    |  4 ++--
 .../drill/exec/physical/config/WindowPOP.java   | 20 ++++++++++---------
 .../physical/impl/aggregate/HashAggBatch.java   | 11 +++++-----
 .../impl/aggregate/HashAggTemplate.java         |  2 +-
 .../impl/aggregate/StreamingAggBatch.java       | 14 ++++++-------
 .../physical/impl/common/ChainedHashTable.java  | 10 +++++-----
 .../physical/impl/common/HashTableConfig.java   | 14 +++++++------
 .../physical/impl/common/HashTableTemplate.java |  2 +-
 .../exec/physical/impl/join/HashJoinBatch.java  |  9 +++++----
 .../impl/window/WindowFrameRecordBatch.java     |  2 +-
 .../physical/impl/window/WindowFunction.java    |  4 ++--
 .../exec/planner/physical/HashAggPrel.java      |  5 +----
 .../exec/planner/physical/StreamAggPrel.java    |  3 +--
 .../exec/planner/physical/UnionAllPrel.java     |  2 +-
 .../planner/physical/UnionDistinctPrel.java     |  2 +-
 .../drill/exec/planner/physical/WindowPrel.java |  6 +++---
 .../common/logical/data/AbstractBuilder.java    | 17 ----------------
 .../common/logical/data/GroupingAggregate.java  | 12 +++++------
 .../apache/drill/common/logical/data/Join.java  | 13 +++++++-----
 .../apache/drill/common/logical/data/Order.java |  8 ++++----
 .../drill/common/logical/data/Project.java      | 21 +++++---------------
 .../common/logical/data/RunningAggregate.java   |  8 +++++---
 .../drill/common/logical/data/Sequence.java     |  9 +++++++--
 .../drill/common/logical/data/Transform.java    |  7 ++++---
 .../apache/drill/common/logical/data/Union.java | 15 +++++---------
 .../drill/common/logical/data/Window.java       | 20 +++++++++----------
 30 files changed, 139 insertions(+), 155 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/exec/java-exec/src/main/java/org/apache/drill/exec/opt/BasicOptimizer.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/opt/BasicOptimizer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/opt/BasicOptimizer.java
index 3f064d4..27c853a 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/opt/BasicOptimizer.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/opt/BasicOptimizer.java
@@ -56,15 +56,12 @@ import org.apache.drill.exec.physical.config.WindowPOP;
 import org.apache.drill.exec.rpc.user.UserServer.UserClientConnection;
 import org.apache.drill.exec.server.options.OptionManager;
 import org.apache.drill.exec.store.StoragePlugin;
-import org.apache.drill.exec.work.foreman.ForemanException;
 import org.apache.calcite.rel.RelFieldCollation.Direction;
 import org.apache.calcite.rel.RelFieldCollation.NullDirection;
 
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.List;
 
 public class BasicOptimizer extends Optimizer {
@@ -139,7 +136,7 @@ public class BasicOptimizer extends Optimizer {
       final List<Ordering> orderDefs = Lists.newArrayList();
       PhysicalOperator input = groupBy.getInput().accept(this, value);
 
-      if (groupBy.getKeys().length > 0) {
+      if (groupBy.getKeys().size() > 0) {
         for(NamedExpression e : groupBy.getKeys()) {
           orderDefs.add(new Ordering(Direction.ASCENDING, e.getExpr(), NullDirection.FIRST));
         }
@@ -197,8 +194,7 @@ public class BasicOptimizer extends Optimizer {
       rightOp = new Sort(rightOp, rightOrderDefs, false);
       rightOp = new SelectionVectorRemover(rightOp);
 
-      final MergeJoinPOP mjp = new MergeJoinPOP(leftOp, rightOp, Arrays.asList(join.getConditions()),
-          join.getJoinType());
+      final MergeJoinPOP mjp = new MergeJoinPOP(leftOp, rightOp, join.getConditions(), join.getJoinType());
       return new SelectionVectorRemover(mjp);
     }
 
@@ -221,17 +217,17 @@ public class BasicOptimizer extends Optimizer {
 
     @Override
     public PhysicalOperator visitStore(final Store store, final Object obj) throws OptimizerException {
-      final Iterator<LogicalOperator> iterator = store.iterator();
-      if (!iterator.hasNext()) {
+      LogicalOperator input = store.getInput();
+      if (input == null) {
         throw new OptimizerException("Store node in logical plan does not have a child.");
       }
-      return new Screen(iterator.next().accept(this, obj), queryContext.getCurrentEndpoint());
+      return new Screen(store.getInput().accept(this, obj), queryContext.getCurrentEndpoint());
     }
 
     @Override
     public PhysicalOperator visitProject(final Project project, final Object obj) throws OptimizerException {
       return new org.apache.drill.exec.physical.config.Project(
-          Arrays.asList(project.getSelections()), project.iterator().next().accept(this, obj));
+          project.getSelections(), project.getInput().accept(this, obj));
     }
 
     @Override
@@ -239,7 +235,7 @@ public class BasicOptimizer extends Optimizer {
       final TypeProtos.MajorType.Builder b = TypeProtos.MajorType.getDefaultInstance().newBuilderForType();
       b.setMode(DataMode.REQUIRED);
       b.setMinorType(MinorType.BIGINT);
-      final PhysicalOperator child = filter.iterator().next().accept(this, obj);
+      final PhysicalOperator child = filter.getInput().accept(this, obj);
       return new SelectionVectorRemover(new org.apache.drill.exec.physical.config.Filter(child, filter.getExpr(), 1.0f));
     }
   }

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractMultiple.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractMultiple.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractMultiple.java
index 909a152..075643d 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractMultiple.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractMultiple.java
@@ -18,6 +18,7 @@
 package org.apache.drill.exec.physical.base;
 
 import java.util.Iterator;
+import java.util.List;
 
 import com.google.common.collect.Iterators;
 
@@ -27,19 +28,19 @@ import com.google.common.collect.Iterators;
 public abstract class AbstractMultiple extends AbstractBase{
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(AbstractMultiple.class);
 
-  protected final PhysicalOperator[] children;
+  protected final List<PhysicalOperator> children;
 
-  protected AbstractMultiple(PhysicalOperator[] children) {
+  protected AbstractMultiple(List<PhysicalOperator> children) {
     this.children = children;
   }
 
-  public PhysicalOperator[] getChildren() {
+  public List<PhysicalOperator> getChildren() {
     return children;
   }
 
   @Override
   public Iterator<PhysicalOperator> iterator() {
-    return Iterators.forArray(children);
+    return children.iterator();
   }
 
 

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/HashAggregate.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/HashAggregate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/HashAggregate.java
index 694570c..4dafbe8 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/HashAggregate.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/HashAggregate.java
@@ -27,29 +27,34 @@ import com.fasterxml.jackson.annotation.JsonCreator;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.annotation.JsonTypeName;
 
+import java.util.List;
+
 @JsonTypeName("hash-aggregate")
 public class HashAggregate extends AbstractSingle {
 
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(HashAggregate.class);
 
-  private final NamedExpression[] groupByExprs;
-  private final NamedExpression[] aggrExprs;
+  private final List<NamedExpression> groupByExprs;
+  private final List<NamedExpression> aggrExprs;
 
   private final float cardinality;
 
   @JsonCreator
-  public HashAggregate(@JsonProperty("child") PhysicalOperator child, @JsonProperty("keys") NamedExpression[] groupByExprs, @JsonProperty("exprs") NamedExpression[] aggrExprs, @JsonProperty("cardinality") float cardinality) {
+  public HashAggregate(@JsonProperty("child") PhysicalOperator child,
+                       @JsonProperty("keys") List<NamedExpression> groupByExprs,
+                       @JsonProperty("exprs") List<NamedExpression> aggrExprs,
+                       @JsonProperty("cardinality") float cardinality) {
     super(child);
     this.groupByExprs = groupByExprs;
     this.aggrExprs = aggrExprs;
     this.cardinality = cardinality;
   }
 
-  public NamedExpression[] getGroupByExprs() {
+  public List<NamedExpression> getGroupByExprs() {
     return groupByExprs;
   }
 
-  public NamedExpression[] getAggrExprs() {
+  public List<NamedExpression> getAggrExprs() {
     return aggrExprs;
   }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/StreamingAggregate.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/StreamingAggregate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/StreamingAggregate.java
index 9486f6d..5669166 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/StreamingAggregate.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/StreamingAggregate.java
@@ -27,29 +27,31 @@ import com.fasterxml.jackson.annotation.JsonCreator;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.annotation.JsonTypeName;
 
+import java.util.List;
+
 @JsonTypeName("streaming-aggregate")
 public class StreamingAggregate extends AbstractSingle {
 
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(StreamingAggregate.class);
 
-  private final NamedExpression[] keys;
-  private final NamedExpression[] exprs;
+  private final List<NamedExpression> keys;
+  private final List<NamedExpression> exprs;
 
   private final float cardinality;
 
   @JsonCreator
-  public StreamingAggregate(@JsonProperty("child") PhysicalOperator child, @JsonProperty("keys") NamedExpression[] keys, @JsonProperty("exprs") NamedExpression[] exprs, @JsonProperty("cardinality") float cardinality) {
+  public StreamingAggregate(@JsonProperty("child") PhysicalOperator child, @JsonProperty("keys") List<NamedExpression> keys, @JsonProperty("exprs") List<NamedExpression> exprs, @JsonProperty("cardinality") float cardinality) {
     super(child);
     this.keys = keys;
     this.exprs = exprs;
     this.cardinality = cardinality;
   }
 
-  public NamedExpression[] getKeys() {
+  public List<NamedExpression> getKeys() {
     return keys;
   }
 
-  public NamedExpression[] getExprs() {
+  public List<NamedExpression> getExprs() {
     return exprs;
   }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/UnionAll.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/UnionAll.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/UnionAll.java
index b703a9d..54ba588 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/UnionAll.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/UnionAll.java
@@ -35,7 +35,7 @@ public class UnionAll extends AbstractMultiple {
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Filter.class);
 
   @JsonCreator
-  public UnionAll(@JsonProperty("children") PhysicalOperator[] children) {
+  public UnionAll(@JsonProperty("children") List<PhysicalOperator> children) {
     super(children);
   }
 
@@ -46,7 +46,7 @@ public class UnionAll extends AbstractMultiple {
 
   @Override
   public PhysicalOperator getNewWithChildren(List<PhysicalOperator> children) {
-    return new UnionAll(children.toArray(new PhysicalOperator[children.size()]));
+    return new UnionAll(children);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/WindowPOP.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/WindowPOP.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/WindowPOP.java
index ec5f361..e98585d 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/WindowPOP.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/WindowPOP.java
@@ -29,20 +29,22 @@ import org.apache.drill.exec.physical.base.PhysicalOperator;
 import org.apache.drill.exec.physical.base.PhysicalVisitor;
 import org.apache.drill.exec.proto.UserBitShared;
 
+import java.util.List;
+
 @JsonTypeName("window")
 public class WindowPOP extends AbstractSingle {
 
-  private final NamedExpression[] withins;
-  private final NamedExpression[] aggregations;
-  private final Order.Ordering[] orderings;
+  private final List<NamedExpression> withins;
+  private final List<NamedExpression> aggregations;
+  private final List<Order.Ordering> orderings;
   private final boolean frameUnitsRows;
   private final Bound start;
   private final Bound end;
 
   public WindowPOP(@JsonProperty("child") PhysicalOperator child,
-                   @JsonProperty("within") NamedExpression[] withins,
-                   @JsonProperty("aggregations") NamedExpression[] aggregations,
-                   @JsonProperty("orderings") Order.Ordering[] orderings,
+                   @JsonProperty("within") List<NamedExpression> withins,
+                   @JsonProperty("aggregations") List<NamedExpression> aggregations,
+                   @JsonProperty("orderings") List<Order.Ordering> orderings,
                    @JsonProperty("frameUnitsRows") boolean frameUnitsRows,
                    @JsonProperty("start") Bound start,
                    @JsonProperty("end") Bound end) {
@@ -78,15 +80,15 @@ public class WindowPOP extends AbstractSingle {
     return end;
   }
 
-  public NamedExpression[] getAggregations() {
+  public List<NamedExpression> getAggregations() {
     return aggregations;
   }
 
-  public NamedExpression[] getWithins() {
+  public List<NamedExpression> getWithins() {
     return withins;
   }
 
-  public Order.Ordering[] getOrderings() {
+  public List<Order.Ordering> getOrderings() {
     return orderings;
   }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java
index 3595ecf..d826922 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java
@@ -182,8 +182,8 @@ public class HashAggBatch extends AbstractRecordBatch<HashAggregate> {
 
     container.clear();
 
-    int numGroupByExprs = (popConfig.getGroupByExprs() != null) ? popConfig.getGroupByExprs().length : 0;
-    int numAggrExprs = (popConfig.getAggrExprs() != null) ? popConfig.getAggrExprs().length : 0;
+    int numGroupByExprs = (popConfig.getGroupByExprs() != null) ? popConfig.getGroupByExprs().size() : 0;
+    int numAggrExprs = (popConfig.getAggrExprs() != null) ? popConfig.getAggrExprs().size() : 0;
     aggrExprs = new LogicalExpression[numAggrExprs];
     groupByOutFieldIds = new TypedFieldId[numGroupByExprs];
     aggrOutFieldIds = new TypedFieldId[numAggrExprs];
@@ -193,7 +193,7 @@ public class HashAggBatch extends AbstractRecordBatch<HashAggregate> {
     int i;
 
     for (i = 0; i < numGroupByExprs; i++) {
-      NamedExpression ne = popConfig.getGroupByExprs()[i];
+      NamedExpression ne = popConfig.getGroupByExprs().get(i);
       final LogicalExpression expr =
           ExpressionTreeMaterializer.materialize(ne.getExpr(), incoming, collector, context.getFunctionRegistry());
       if (expr == null) {
@@ -208,7 +208,7 @@ public class HashAggBatch extends AbstractRecordBatch<HashAggregate> {
     }
 
     for (i = 0; i < numAggrExprs; i++) {
-      NamedExpression ne = popConfig.getAggrExprs()[i];
+      NamedExpression ne = popConfig.getAggrExprs().get(i);
       final LogicalExpression expr =
           ExpressionTreeMaterializer.materialize(ne.getExpr(), incoming, collector, context.getFunctionRegistry());
 
@@ -239,7 +239,8 @@ public class HashAggBatch extends AbstractRecordBatch<HashAggregate> {
     HashAggregator agg = context.getImplementationClass(top);
 
     HashTableConfig htConfig =
-        new HashTableConfig(context.getOptions().getOption(ExecConstants.MIN_HASH_TABLE_SIZE_KEY).num_val.intValue(),
+        // TODO - fix the validator on this option
+        new HashTableConfig((int)context.getOptions().getOption(ExecConstants.MIN_HASH_TABLE_SIZE),
             HashTable.DEFAULT_LOAD_FACTOR, popConfig.getGroupByExprs(), null /* no probe exprs */);
 
     agg.setup(popConfig, htConfig, context, this.stats,

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggTemplate.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggTemplate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggTemplate.java
index 9ff874f..5e08163 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggTemplate.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggTemplate.java
@@ -247,7 +247,7 @@ public abstract class HashAggTemplate implements HashAggregator {
     //      e.g SELECT COUNT(DISTINCT a1) FROM t1 ;
     // we need to build a hash table on the aggregation column a1.
     // TODO:  This functionality will be added later.
-    if (hashAggrConfig.getGroupByExprs().length == 0) {
+    if (hashAggrConfig.getGroupByExprs().size() == 0) {
       throw new IllegalArgumentException("Currently, hash aggregation is only applicable if there are group-by " +
           "expressions.");
     }

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggBatch.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggBatch.java
index 19232f8..9d883f3 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggBatch.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggBatch.java
@@ -139,7 +139,7 @@ public class StreamingAggBatch extends AbstractRecordBatch<StreamingAggregate> {
       logger.debug("Next outcome of {}", outcome);
       switch (outcome) {
       case NONE:
-        if (first && popConfig.getKeys().length == 0) {
+        if (first && popConfig.getKeys().size() == 0) {
           // if we have a straight aggregate and empty input batch, we need to handle it in a different way
           constructSpecialBatch();
           first = false;
@@ -225,7 +225,7 @@ public class StreamingAggBatch extends AbstractRecordBatch<StreamingAggregate> {
            * buffer
            */
           throw new DrillRuntimeException("FixedWidth vectors is the expected output vector type. " +
-              "Corresponding expression: " + popConfig.getExprs()[exprIndex].toString());
+              "Corresponding expression: " + popConfig.getExprs().get(exprIndex).toString());
         }
       }
       exprIndex++;
@@ -260,14 +260,14 @@ public class StreamingAggBatch extends AbstractRecordBatch<StreamingAggregate> {
     ClassGenerator<StreamingAggregator> cg = CodeGenerator.getRoot(StreamingAggTemplate.TEMPLATE_DEFINITION, context.getFunctionRegistry());
     container.clear();
 
-    LogicalExpression[] keyExprs = new LogicalExpression[popConfig.getKeys().length];
-    LogicalExpression[] valueExprs = new LogicalExpression[popConfig.getExprs().length];
-    TypedFieldId[] keyOutputIds = new TypedFieldId[popConfig.getKeys().length];
+    LogicalExpression[] keyExprs = new LogicalExpression[popConfig.getKeys().size()];
+    LogicalExpression[] valueExprs = new LogicalExpression[popConfig.getExprs().size()];
+    TypedFieldId[] keyOutputIds = new TypedFieldId[popConfig.getKeys().size()];
 
     ErrorCollector collector = new ErrorCollectorImpl();
 
     for (int i = 0; i < keyExprs.length; i++) {
-      final NamedExpression ne = popConfig.getKeys()[i];
+      final NamedExpression ne = popConfig.getKeys().get(i);
       final LogicalExpression expr = ExpressionTreeMaterializer.materialize(ne.getExpr(), incoming, collector,context.getFunctionRegistry() );
       if (expr == null) {
         continue;
@@ -279,7 +279,7 @@ public class StreamingAggBatch extends AbstractRecordBatch<StreamingAggregate> {
     }
 
     for (int i = 0; i < valueExprs.length; i++) {
-      final NamedExpression ne = popConfig.getExprs()[i];
+      final NamedExpression ne = popConfig.getExprs().get(i);
       final LogicalExpression expr = ExpressionTreeMaterializer.materialize(ne.getExpr(), incoming, collector, context.getFunctionRegistry());
       if (expr instanceof IfExpression) {
         throw UserException.unsupportedError(new UnsupportedOperationException("Union type not supported in aggregate functions")).build(logger);

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/ChainedHashTable.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/ChainedHashTable.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/ChainedHashTable.java
index bd34d76..cfd95e9 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/ChainedHashTable.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/ChainedHashTable.java
@@ -143,17 +143,17 @@ public class ChainedHashTable {
     ClassGenerator<HashTable> cg = top.getRoot();
     ClassGenerator<HashTable> cgInner = cg.getInnerGenerator("BatchHolder");
 
-    LogicalExpression[] keyExprsBuild = new LogicalExpression[htConfig.getKeyExprsBuild().length];
+    LogicalExpression[] keyExprsBuild = new LogicalExpression[htConfig.getKeyExprsBuild().size()];
     LogicalExpression[] keyExprsProbe = null;
     boolean isProbe = (htConfig.getKeyExprsProbe() != null);
     if (isProbe) {
-      keyExprsProbe = new LogicalExpression[htConfig.getKeyExprsProbe().length];
+      keyExprsProbe = new LogicalExpression[htConfig.getKeyExprsProbe().size()];
     }
 
     ErrorCollector collector = new ErrorCollectorImpl();
     VectorContainer htContainerOrig = new VectorContainer(); // original ht container from which others may be cloned
-    LogicalExpression[] htKeyExprs = new LogicalExpression[htConfig.getKeyExprsBuild().length];
-    TypedFieldId[] htKeyFieldIds = new TypedFieldId[htConfig.getKeyExprsBuild().length];
+    LogicalExpression[] htKeyExprs = new LogicalExpression[htConfig.getKeyExprsBuild().size()];
+    TypedFieldId[] htKeyFieldIds = new TypedFieldId[htConfig.getKeyExprsBuild().size()];
 
     int i = 0;
     for (NamedExpression ne : htConfig.getKeyExprsBuild()) {
@@ -210,7 +210,7 @@ public class ChainedHashTable {
     setupSetValue(cgInner, keyExprsBuild, htKeyFieldIds);
     if (outgoing != null) {
 
-      if (outKeyFieldIds.length > htConfig.getKeyExprsBuild().length) {
+      if (outKeyFieldIds.length > htConfig.getKeyExprsBuild().size()) {
         throw new IllegalArgumentException("Mismatched number of output key fields.");
       }
     }

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/HashTableConfig.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/HashTableConfig.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/HashTableConfig.java
index fa6d4b5..a6b2587 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/HashTableConfig.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/HashTableConfig.java
@@ -23,6 +23,8 @@ import com.fasterxml.jackson.annotation.JsonCreator;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.annotation.JsonTypeName;
 
+import java.util.List;
+
 @JsonTypeName("hashtable-config")
 public class HashTableConfig  {
 
@@ -30,13 +32,13 @@ public class HashTableConfig  {
 
   private final int initialCapacity;
   private final float loadFactor;
-  private final NamedExpression[] keyExprsBuild;
-  private final NamedExpression[] keyExprsProbe;
+  private final List<NamedExpression> keyExprsBuild;
+  private final List<NamedExpression> keyExprsProbe;
 
   @JsonCreator
   public HashTableConfig(@JsonProperty("initialCapacity") int initialCapacity, @JsonProperty("loadFactor") float loadFactor,
-                         @JsonProperty("keyExprsBuild") NamedExpression[] keyExprsBuild,
-                         @JsonProperty("keyExprsProbe") NamedExpression[] keyExprsProbe) {
+                         @JsonProperty("keyExprsBuild") List<NamedExpression> keyExprsBuild,
+                         @JsonProperty("keyExprsProbe") List<NamedExpression> keyExprsProbe) {
     this.initialCapacity = initialCapacity;
     this.loadFactor = loadFactor;
     this.keyExprsBuild = keyExprsBuild;
@@ -51,11 +53,11 @@ public class HashTableConfig  {
     return loadFactor;
   }
 
-  public NamedExpression[] getKeyExprsBuild() {
+  public List<NamedExpression> getKeyExprsBuild() {
     return keyExprsBuild;
   }
 
-  public NamedExpression[] getKeyExprsProbe() {
+  public List<NamedExpression> getKeyExprsProbe() {
     return keyExprsProbe;
   }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/HashTableTemplate.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/HashTableTemplate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/HashTableTemplate.java
index 7d9f568..efd695e 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/HashTableTemplate.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/HashTableTemplate.java
@@ -447,7 +447,7 @@ public abstract class HashTableTemplate implements HashTable {
       throw new IllegalArgumentException("The initial capacity must be less than maximum capacity allowed");
     }
 
-    if (htConfig.getKeyExprsBuild() == null || htConfig.getKeyExprsBuild().length == 0) {
+    if (htConfig.getKeyExprsBuild() == null || htConfig.getKeyExprsBuild().size() == 0) {
       throw new IllegalArgumentException("Hash table must have at least 1 key expression");
     }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinBatch.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinBatch.java
index 3ea97c6..2ba54dd 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinBatch.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinBatch.java
@@ -18,6 +18,7 @@
 package org.apache.drill.exec.physical.impl.join;
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.drill.common.expression.FieldReference;
@@ -281,14 +282,14 @@ public class HashJoinBatch extends AbstractRecordBatch<HashJoinPOP> {
   public void setupHashTable() throws IOException, SchemaChangeException, ClassTransformationException {
     // Setup the hash table configuration object
     int conditionsSize = conditions.size();
-    final NamedExpression rightExpr[] = new NamedExpression[conditionsSize];
-    NamedExpression leftExpr[] = new NamedExpression[conditionsSize];
+    final List<NamedExpression> rightExpr = new ArrayList<>(conditionsSize);
+    List<NamedExpression> leftExpr = new ArrayList<>(conditionsSize);
 
     JoinComparator comparator = JoinComparator.NONE;
     // Create named expressions from the conditions
     for (int i = 0; i < conditionsSize; i++) {
-      rightExpr[i] = new NamedExpression(conditions.get(i).getRight(), new FieldReference("build_side_" + i));
-      leftExpr[i] = new NamedExpression(conditions.get(i).getLeft(), new FieldReference("probe_side_" + i));
+      rightExpr.add(new NamedExpression(conditions.get(i).getRight(), new FieldReference("build_side_" + i)));
+      leftExpr.add(new NamedExpression(conditions.get(i).getLeft(), new FieldReference("probe_side_" + i)));
 
       // Hash join only supports certain types of comparisons
       comparator = JoinUtils.checkAndSetComparison(conditions.get(i), comparator);

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/window/WindowFrameRecordBatch.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/window/WindowFrameRecordBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/window/WindowFrameRecordBatch.java
index 46a6c0e..d2c9e45 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/window/WindowFrameRecordBatch.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/window/WindowFrameRecordBatch.java
@@ -260,7 +260,7 @@ public class WindowFrameRecordBatch extends AbstractRecordBatch<WindowPOP> {
     boolean useDefaultFrame = false; // at least one window function uses the DefaultFrameTemplate
     boolean useCustomFrame = false; // at least one window function uses the CustomFrameTemplate
 
-    hasOrderBy = popConfig.getOrderings().length > 0;
+    hasOrderBy = popConfig.getOrderings().size() > 0;
 
     // all existing vectors will be transferred to the outgoing container in framer.doWork()
     for (final VectorWrapper<?> wrapper : batch) {

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/window/WindowFunction.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/window/WindowFunction.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/window/WindowFunction.java
index 191dad1..cd14b8a 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/window/WindowFunction.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/window/WindowFunction.java
@@ -157,7 +157,7 @@ public abstract class WindowFunction {
 
     @Override
     public boolean requiresFullPartition(final WindowPOP pop) {
-      return pop.getOrderings().length == 0 || pop.getEnd().isUnbounded();
+      return pop.getOrderings().isEmpty() || pop.getEnd().isUnbounded();
     }
 
     @Override
@@ -451,7 +451,7 @@ public abstract class WindowFunction {
 
     @Override
     public boolean requiresFullPartition(final WindowPOP pop) {
-      return pop.getOrderings().length == 0 || pop.getEnd().isUnbounded();
+      return pop.getOrderings().isEmpty() || pop.getEnd().isUnbounded();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashAggPrel.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashAggPrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashAggPrel.java
index 637fb8e..44bf170 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashAggPrel.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashAggPrel.java
@@ -73,10 +73,7 @@ public class HashAggPrel extends AggPrelBase implements Prel{
   public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException {
 
     Prel child = (Prel) this.getInput();
-    HashAggregate g = new HashAggregate(child.getPhysicalOperator(creator),
-        keys.toArray(new NamedExpression[keys.size()]),
-        aggExprs.toArray(new NamedExpression[aggExprs.size()]),
-        1.0f);
+    HashAggregate g = new HashAggregate(child.getPhysicalOperator(creator), keys, aggExprs, 1.0f);
 
     return creator.addMetadata(this, g);
 

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/StreamAggPrel.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/StreamAggPrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/StreamAggPrel.java
index 80fe1a1..c3e8afa 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/StreamAggPrel.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/StreamAggPrel.java
@@ -87,8 +87,7 @@ public class StreamAggPrel extends AggPrelBase implements Prel{
   public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException {
 
     Prel child = (Prel) this.getInput();
-    StreamingAggregate g = new StreamingAggregate(child.getPhysicalOperator(creator), keys.toArray(new NamedExpression[keys.size()]),
-        aggExprs.toArray(new NamedExpression[aggExprs.size()]), 1.0f);
+    StreamingAggregate g = new StreamingAggregate(child.getPhysicalOperator(creator), keys, aggExprs, 1.0f);
 
     return creator.addMetadata(this, g);
 

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionAllPrel.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionAllPrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionAllPrel.java
index ff2ad1b..4282a3f 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionAllPrel.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionAllPrel.java
@@ -79,7 +79,7 @@ public class UnionAllPrel extends UnionPrel {
       inputPops.add( ((Prel)this.getInputs().get(i)).getPhysicalOperator(creator));
     }
 
-    UnionAll unionall = new UnionAll(inputPops.toArray(new PhysicalOperator[inputPops.size()]));
+    UnionAll unionall = new UnionAll(inputPops);
     return creator.addMetadata(this, unionall);
   }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionDistinctPrel.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionDistinctPrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionDistinctPrel.java
index 4ef3375..5cda5a6 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionDistinctPrel.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionDistinctPrel.java
@@ -78,7 +78,7 @@ public class UnionDistinctPrel extends UnionPrel {
     }
 
     ///TODO: change this to UnionDistinct once implemented end-to-end..
-    UnionAll unionAll = new UnionAll(inputPops.toArray(new PhysicalOperator[inputPops.size()]));
+    UnionAll unionAll = new UnionAll(inputPops);
     return creator.addMetadata(this, unionAll);
   }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/WindowPrel.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/WindowPrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/WindowPrel.java
index 1a89bd7..bf52366 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/WindowPrel.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/WindowPrel.java
@@ -102,9 +102,9 @@ public class WindowPrel extends DrillWindowRelBase implements Prel {
 
     WindowPOP windowPOP = new WindowPOP(
         childPOP,
-        withins.toArray(new NamedExpression[withins.size()]),
-        aggs.toArray(new NamedExpression[aggs.size()]),
-        orderings.toArray(new Order.Ordering[orderings.size()]),
+        withins,
+        aggs,
+        orderings,
         window.isRows,
         WindowPOP.newBound(window.lowerBound),
         WindowPOP.newBound(window.upperBound));

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/logical/src/main/java/org/apache/drill/common/logical/data/AbstractBuilder.java
----------------------------------------------------------------------
diff --git a/logical/src/main/java/org/apache/drill/common/logical/data/AbstractBuilder.java b/logical/src/main/java/org/apache/drill/common/logical/data/AbstractBuilder.java
index b178cd9..d3e1330 100644
--- a/logical/src/main/java/org/apache/drill/common/logical/data/AbstractBuilder.java
+++ b/logical/src/main/java/org/apache/drill/common/logical/data/AbstractBuilder.java
@@ -26,21 +26,4 @@ public abstract class AbstractBuilder<T extends LogicalOperator> {
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(AbstractBuilder.class);
 
   public abstract T build();
-
-  protected LogicalExpression[] aL(List<LogicalExpression> exprs){
-    return exprs.toArray(new LogicalExpression[exprs.size()]);
-  }
-
-  protected FieldReference[] aF(List<FieldReference> exprs){
-    return exprs.toArray(new FieldReference[exprs.size()]);
-  }
-
-  protected NamedExpression[] aN(List<NamedExpression> exprs){
-    return exprs.toArray(new NamedExpression[exprs.size()]);
-  }
-
-  protected Order.Ordering[] aO(List<Order.Ordering> orderings) {
-    return orderings.toArray(new Order.Ordering[orderings.size()]);
-  }
-
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/logical/src/main/java/org/apache/drill/common/logical/data/GroupingAggregate.java
----------------------------------------------------------------------
diff --git a/logical/src/main/java/org/apache/drill/common/logical/data/GroupingAggregate.java b/logical/src/main/java/org/apache/drill/common/logical/data/GroupingAggregate.java
index 2913a7e..f554d96 100644
--- a/logical/src/main/java/org/apache/drill/common/logical/data/GroupingAggregate.java
+++ b/logical/src/main/java/org/apache/drill/common/logical/data/GroupingAggregate.java
@@ -33,10 +33,10 @@ import com.google.common.collect.Lists;
 public class GroupingAggregate extends SingleInputOperator{
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(GroupingAggregate.class);
 
-  private final NamedExpression[] keys;
-  private final NamedExpression[] exprs;
+  private final List<NamedExpression> keys;
+  private final List<NamedExpression> exprs;
 
-  public GroupingAggregate(@JsonProperty("keys") NamedExpression[] keys, @JsonProperty("exprs") NamedExpression[] exprs) {
+  public GroupingAggregate(@JsonProperty("keys") List<NamedExpression> keys, @JsonProperty("exprs") List<NamedExpression> exprs) {
     super();
     this.keys = keys;
     this.exprs = exprs;
@@ -56,11 +56,11 @@ public class GroupingAggregate extends SingleInputOperator{
     return new Builder();
   }
 
-  public NamedExpression[] getKeys(){
+  public List<NamedExpression> getKeys(){
     return keys;
   }
 
-  public NamedExpression[] getExprs(){
+  public List<NamedExpression> getExprs(){
     return exprs;
   }
 
@@ -90,7 +90,7 @@ public class GroupingAggregate extends SingleInputOperator{
 
     @Override
     public GroupingAggregate internalBuild(){
-      GroupingAggregate ga =  new GroupingAggregate(aN(keys), aN(exprs));
+      GroupingAggregate ga =  new GroupingAggregate(keys, exprs);
       return ga;
     }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/logical/src/main/java/org/apache/drill/common/logical/data/Join.java
----------------------------------------------------------------------
diff --git a/logical/src/main/java/org/apache/drill/common/logical/data/Join.java b/logical/src/main/java/org/apache/drill/common/logical/data/Join.java
index 2d7e6e1..bb1159c 100644
--- a/logical/src/main/java/org/apache/drill/common/logical/data/Join.java
+++ b/logical/src/main/java/org/apache/drill/common/logical/data/Join.java
@@ -38,7 +38,7 @@ public class Join extends LogicalOperatorBase {
   private final LogicalOperator left;
   private final LogicalOperator right;
   private final JoinRelType type;
-  private final JoinCondition[] conditions;
+  private final List<JoinCondition> conditions;
 
   public static JoinRelType resolve(String val) {
     for (JoinRelType jt : JoinRelType.values()) {
@@ -49,14 +49,17 @@ public class Join extends LogicalOperatorBase {
     throw new ExpressionParsingException(String.format("Unable to determine join type for value '%s'.", val));
   }
 
+  // TODO - should not have two @JsonCreators, need to figure out which one is being used
+  // I'm guess this one, is the case insensitive match in resolve() actually needed?
   @JsonCreator
   public Join(@JsonProperty("left") LogicalOperator left, @JsonProperty("right") LogicalOperator right,
-      @JsonProperty("conditions") JoinCondition[] conditions, @JsonProperty("type") String type) {
+      @JsonProperty("conditions") List<JoinCondition> conditions, @JsonProperty("type") String type) {
     this(left, right, conditions, resolve(type));
   }
 
   @JsonCreator
-  public Join(@JsonProperty("left") LogicalOperator left, @JsonProperty("right") LogicalOperator right, @JsonProperty("conditions")JoinCondition[] conditions, @JsonProperty("type") JoinRelType type) {
+  public Join(@JsonProperty("left") LogicalOperator left, @JsonProperty("right") LogicalOperator right,
+              @JsonProperty("conditions") List<JoinCondition> conditions, @JsonProperty("type") JoinRelType type) {
     super();
     this.conditions = conditions;
     this.left = left;
@@ -75,7 +78,7 @@ public class Join extends LogicalOperatorBase {
     return right;
   }
 
-  public JoinCondition[] getConditions() {
+  public List<JoinCondition> getConditions() {
     return conditions;
   }
 
@@ -132,7 +135,7 @@ public class Join extends LogicalOperatorBase {
       Preconditions.checkNotNull(left);
       Preconditions.checkNotNull(right);
       Preconditions.checkNotNull(type);
-      return new Join(left, right, conditions.toArray(new JoinCondition[conditions.size()]), type);
+      return new Join(left, right, conditions, type);
     }
 
   }

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/logical/src/main/java/org/apache/drill/common/logical/data/Order.java
----------------------------------------------------------------------
diff --git a/logical/src/main/java/org/apache/drill/common/logical/data/Order.java b/logical/src/main/java/org/apache/drill/common/logical/data/Order.java
index fca6010..ca3eec4 100644
--- a/logical/src/main/java/org/apache/drill/common/logical/data/Order.java
+++ b/logical/src/main/java/org/apache/drill/common/logical/data/Order.java
@@ -38,16 +38,16 @@ import com.google.common.collect.Lists;
 @JsonTypeName("order")
 public class Order extends SingleInputOperator {
 
-  private final Ordering[] orderings;
+  private final List<Ordering> orderings;
   private final FieldReference within;
 
   @JsonCreator
-  public Order(@JsonProperty("within") FieldReference within, @JsonProperty("orderings") Ordering... orderings) {
+  public Order(@JsonProperty("within") FieldReference within, @JsonProperty("orderings") List<Ordering> orderings) {
     this.orderings = orderings;
     this.within = within;
   }
 
-  public Ordering[] getOrderings() {
+  public List<Ordering> getOrderings() {
     return orderings;
   }
 
@@ -244,7 +244,7 @@ public class Order extends SingleInputOperator {
 
     @Override
     public Order internalBuild() {
-      return new Order(within, orderings.toArray(new Ordering[orderings.size()]));
+      return new Order(within, orderings);
     }
 
 

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/logical/src/main/java/org/apache/drill/common/logical/data/Project.java
----------------------------------------------------------------------
diff --git a/logical/src/main/java/org/apache/drill/common/logical/data/Project.java b/logical/src/main/java/org/apache/drill/common/logical/data/Project.java
index 4345c80..fc981ce 100644
--- a/logical/src/main/java/org/apache/drill/common/logical/data/Project.java
+++ b/logical/src/main/java/org/apache/drill/common/logical/data/Project.java
@@ -32,30 +32,19 @@ import com.google.common.collect.Lists;
 @JsonTypeName("project")
 public class Project extends SingleInputOperator {
 
-  private final NamedExpression[] selections;
+  private final List<NamedExpression> selections;
 
   @JsonCreator
-  public Project(@JsonProperty("projections") NamedExpression[] selections) {
+  public Project(@JsonProperty("projections") List<NamedExpression> selections) {
     this.selections = selections;
-    if (selections == null || selections.length == 0) {
+    if (selections == null || selections.size() == 0) {
       throw new ExpressionParsingException(
           "Project did not provide any projection selections.  At least one projection must be provided.");
-//    for (int i = 0; i < selections.length; i++) {
-//      PathSegment segment = selections[i].getRef().getRootSegment();
-//      CharSequence path = segment.getNameSegment().getPath();
-//      if (!segment.isNamed() || !path.equals("output"))
-//        throw new ExpressionParsingException(
-//            String
-//                .format(
-//                    "Outputs for projections always have to start with named path of output. First segment was named '%s' or was named [%s]",
-//                    path, segment.isNamed()));
-//
-//    }
     }
   }
 
   @JsonProperty("projections")
-  public NamedExpression[] getSelections() {
+  public List<NamedExpression> getSelections() {
     return selections;
   }
 
@@ -84,7 +73,7 @@ public class Project extends SingleInputOperator {
 
     @Override
     public Project internalBuild() {
-      return new Project(aN(exprs));
+      return new Project(exprs);
     }
 
   }

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/logical/src/main/java/org/apache/drill/common/logical/data/RunningAggregate.java
----------------------------------------------------------------------
diff --git a/logical/src/main/java/org/apache/drill/common/logical/data/RunningAggregate.java b/logical/src/main/java/org/apache/drill/common/logical/data/RunningAggregate.java
index e280627..d71814b 100644
--- a/logical/src/main/java/org/apache/drill/common/logical/data/RunningAggregate.java
+++ b/logical/src/main/java/org/apache/drill/common/logical/data/RunningAggregate.java
@@ -18,6 +18,7 @@
 package org.apache.drill.common.logical.data;
 
 import java.util.Iterator;
+import java.util.List;
 
 import org.apache.drill.common.expression.FieldReference;
 import org.apache.drill.common.logical.data.visitors.LogicalVisitor;
@@ -31,10 +32,11 @@ import com.google.common.collect.Iterators;
 public class RunningAggregate extends SingleInputOperator{
 
   private final FieldReference within;
-  private final NamedExpression[]  aggregations;
+  private final List<NamedExpression> aggregations;
 
   @JsonCreator
-  public RunningAggregate(@JsonProperty("within") FieldReference within, @JsonProperty("aggregations") NamedExpression[] aggregations) {
+  public RunningAggregate(@JsonProperty("within") FieldReference within,
+                          @JsonProperty("aggregations") List<NamedExpression> aggregations) {
     super();
     this.within = within;
     this.aggregations = aggregations;
@@ -44,7 +46,7 @@ public class RunningAggregate extends SingleInputOperator{
     return within;
   }
 
-  public NamedExpression[] getAggregations() {
+  public List<NamedExpression> getAggregations() {
     return aggregations;
   }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/logical/src/main/java/org/apache/drill/common/logical/data/Sequence.java
----------------------------------------------------------------------
diff --git a/logical/src/main/java/org/apache/drill/common/logical/data/Sequence.java b/logical/src/main/java/org/apache/drill/common/logical/data/Sequence.java
index f04b09c..357c9b8 100644
--- a/logical/src/main/java/org/apache/drill/common/logical/data/Sequence.java
+++ b/logical/src/main/java/org/apache/drill/common/logical/data/Sequence.java
@@ -19,6 +19,7 @@ package org.apache.drill.common.logical.data;
 
 import java.io.IOException;
 import java.util.Iterator;
+import java.util.List;
 
 import org.apache.drill.common.logical.data.Sequence.De;
 import org.apache.drill.common.logical.data.visitors.LogicalVisitor;
@@ -42,11 +43,15 @@ import com.fasterxml.jackson.databind.deser.impl.ReadableObjectId;
 import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
 import com.google.common.collect.Iterators;
 
+// TODO - is this even ever used anymore? I don't believe the planner will ever
+// generate this, we might have some tests with old logical plans that use this
+// but it should probably be removed
 /**
  * Describes a list of operators where each operator only has one input and that
  * input is the operator that came before.
  *
  */
+@Deprecated
 @JsonDeserialize(using = De.class)
 @JsonTypeName("sequence")
 public class Sequence extends LogicalOperatorBase {
@@ -57,7 +62,7 @@ public class Sequence extends LogicalOperatorBase {
   public boolean openTop;
   public LogicalOperator input;
   @JsonProperty("do")
-  public LogicalOperator[] stream;
+  public List<LogicalOperator> stream;
 
     @Override
     public <T, X, E extends Throwable> T accept(LogicalVisitor<T, X, E> logicalVisitor, X value) throws E {
@@ -66,7 +71,7 @@ public class Sequence extends LogicalOperatorBase {
 
     @Override
     public Iterator<LogicalOperator> iterator() {
-        return Iterators.singletonIterator(stream[stream.length - 1]);
+        return Iterators.singletonIterator(stream.get(stream.size() - 1));
     }
 
     public static class De extends StdDeserializer<LogicalOperator> {

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/logical/src/main/java/org/apache/drill/common/logical/data/Transform.java
----------------------------------------------------------------------
diff --git a/logical/src/main/java/org/apache/drill/common/logical/data/Transform.java b/logical/src/main/java/org/apache/drill/common/logical/data/Transform.java
index 129ae2c..5fc6c70 100644
--- a/logical/src/main/java/org/apache/drill/common/logical/data/Transform.java
+++ b/logical/src/main/java/org/apache/drill/common/logical/data/Transform.java
@@ -18,6 +18,7 @@
 package org.apache.drill.common.logical.data;
 
 import java.util.Iterator;
+import java.util.List;
 
 import org.apache.drill.common.logical.data.visitors.LogicalVisitor;
 
@@ -29,15 +30,15 @@ import com.google.common.collect.Iterators;
 @JsonTypeName("transform")
 public class Transform extends SingleInputOperator {
 
-  private final NamedExpression[] transforms;
+  private final List<NamedExpression> transforms;
 
   @JsonCreator
-  public Transform(@JsonProperty("transforms") NamedExpression[] transforms) {
+  public Transform(@JsonProperty("transforms") List<NamedExpression> transforms) {
     super();
     this.transforms = transforms;
   }
 
-  public NamedExpression[] getTransforms() {
+  public List<NamedExpression> getTransforms() {
     return transforms;
   }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/logical/src/main/java/org/apache/drill/common/logical/data/Union.java
----------------------------------------------------------------------
diff --git a/logical/src/main/java/org/apache/drill/common/logical/data/Union.java b/logical/src/main/java/org/apache/drill/common/logical/data/Union.java
index 113ffe0..909b126 100644
--- a/logical/src/main/java/org/apache/drill/common/logical/data/Union.java
+++ b/logical/src/main/java/org/apache/drill/common/logical/data/Union.java
@@ -30,16 +30,11 @@ import com.google.common.collect.Lists;
 
 @JsonTypeName("union")
 public class Union extends LogicalOperatorBase {
-  private final LogicalOperator[] inputs;
+  private final List<LogicalOperator> inputs;
   private final boolean distinct;
 
-//  @JsonCreator
-//  public Union(@JsonProperty("inputs") LogicalOperator[] inputs){
-//    this(inputs, false);
-//  }
-
   @JsonCreator
-  public Union(@JsonProperty("inputs") LogicalOperator[] inputs, @JsonProperty("distinct") Boolean distinct){
+  public Union(@JsonProperty("inputs") List<LogicalOperator> inputs, @JsonProperty("distinct") Boolean distinct){
     this.inputs = inputs;
       for (LogicalOperator o : inputs) {
           o.registerAsSubscriber(this);
@@ -47,7 +42,7 @@ public class Union extends LogicalOperatorBase {
     this.distinct = distinct == null ? false : distinct;
   }
 
-  public LogicalOperator[] getInputs() {
+  public List<LogicalOperator> getInputs() {
     return inputs;
   }
 
@@ -62,7 +57,7 @@ public class Union extends LogicalOperatorBase {
 
     @Override
     public Iterator<LogicalOperator> iterator() {
-        return Iterators.forArray(inputs);
+        return inputs.iterator();
     }
 
 
@@ -86,7 +81,7 @@ public class Union extends LogicalOperatorBase {
 
       @Override
       public Union build() {
-        return new Union(inputs.toArray(new LogicalOperator[inputs.size()]), distinct);
+        return new Union(inputs, distinct);
       }
 
     }

http://git-wip-us.apache.org/repos/asf/drill/blob/d24205d4/logical/src/main/java/org/apache/drill/common/logical/data/Window.java
----------------------------------------------------------------------
diff --git a/logical/src/main/java/org/apache/drill/common/logical/data/Window.java b/logical/src/main/java/org/apache/drill/common/logical/data/Window.java
index 0f550dc..8a33416 100644
--- a/logical/src/main/java/org/apache/drill/common/logical/data/Window.java
+++ b/logical/src/main/java/org/apache/drill/common/logical/data/Window.java
@@ -36,17 +36,17 @@ import static com.google.common.base.Preconditions.checkState;
 
 @JsonTypeName("window")
 public class Window extends SingleInputOperator {
-  private final NamedExpression[] withins;
-  private final NamedExpression[] aggregations;
-  private final Order.Ordering[] orderings;
+  private final List<NamedExpression> withins;
+  private final List<NamedExpression> aggregations;
+  private final List<Order.Ordering> orderings;
   private final long start;
   private final long end;
 
 
   @JsonCreator
-  public Window(@JsonProperty("withins") NamedExpression[] withins,
-                @JsonProperty("aggregations") NamedExpression[] aggregations,
-                @JsonProperty("orderings") Order.Ordering[] orderings,
+  public Window(@JsonProperty("withins") List<NamedExpression> withins,
+                @JsonProperty("aggregations") List<NamedExpression> aggregations,
+                @JsonProperty("orderings") List<Order.Ordering> orderings,
                 @JsonProperty("start") Long start,
                 @JsonProperty("end") Long end) {
     super();
@@ -57,7 +57,7 @@ public class Window extends SingleInputOperator {
     this.orderings = orderings;
   }
 
-  public NamedExpression[] getWithins() {
+  public List<NamedExpression> getWithins() {
     return withins;
   }
 
@@ -69,11 +69,11 @@ public class Window extends SingleInputOperator {
     return end;
   }
 
-  public NamedExpression[] getAggregations() {
+  public List<NamedExpression> getAggregations() {
     return aggregations;
   }
 
-  public Order.Ordering[] getOrderings() {
+  public List<Order.Ordering> getOrderings() {
     return orderings;
   }
 
@@ -109,7 +109,7 @@ public class Window extends SingleInputOperator {
       //TODO withins can actually be empty: over(), over(order by <expression>), ...
       checkState(!withins.isEmpty(), "Withins in window must not be empty.");
       checkState(!aggregations.isEmpty(), "Aggregations in window must not be empty.");
-      return new Window(aN(withins), aN(aggregations), aO(orderings), start, end);
+      return new Window(withins, aggregations, orderings, start, end);
     }
 
     public Builder addOrdering(Order.Ordering ordering) {


Mime
View raw message