This is an automated email from the ASF dual-hosted git repository.

parthc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/drill.git

commit 758a98143261fb7369e26499c72018d04c2a2909
Author: chunhui-shi <c...@maprtech.com>
AuthorDate: Mon Apr 30 10:24:06 2018 -0700

    DRILL-6321: Lateral Join and Unnest - rules, options, logical plan supports
    
    Included changes:
    * Add planner.enable_unnest_lateral option. Default value set to false.
    * Enable FilterCorrectRule
    * Add support to logical plan
    * Fix rebase errors for DRILL-6321 commits
---
 .../drill/exec/physical/config/UnnestPOP.java      |  1 +
 .../physical/impl/unnest/UnnestRecordBatch.java    |  4 --
 .../apache/drill/exec/planner/PlannerPhase.java    |  2 +
 .../apache/drill/exec/planner/RuleInstance.java    |  4 ++
 .../exec/planner/common/DrillJoinRelBase.java      |  4 +-
 .../exec/planner/logical/DrillCorrelateRel.java    | 13 +++++-
 .../drill/exec/planner/logical/DrillJoinRel.java   | 22 ++++++++--
 .../drill/exec/planner/logical/DrillUnnestRel.java |  9 +++-
 .../exec/planner/physical/PlannerSettings.java     | 10 +++++
 .../drill/exec/planner/physical/UnnestPrule.java   |  2 -
 .../sql/parser/UnsupportedOperatorsVisitor.java    |  9 ++++
 .../exec/server/options/SystemOptionManager.java   |  1 +
 .../java-exec/src/main/resources/drill-module.conf |  1 +
 ...eralPhysicalPlan.java => TestLateralPlans.java} | 48 +++++++++++++++++-----
 .../impl/unnest/TestUnnestCorrectness.java         |  2 +
 .../drill/common/logical/data/LateralJoin.java     |  1 -
 .../apache/drill/common/logical/data/Unnest.java   |  3 +-
 pom.xml                                            |  2 +-
 18 files changed, 110 insertions(+), 28 deletions(-)

diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/UnnestPOP.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/UnnestPOP.java
index 37ba495..f954818 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/UnnestPOP.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/UnnestPOP.java
@@ -31,6 +31,7 @@ import org.apache.drill.exec.physical.base.PhysicalVisitor;
 import org.apache.drill.exec.physical.impl.unnest.UnnestRecordBatch;
 
 import java.util.Iterator;
+import java.util.List;
 
 import static 
org.apache.drill.exec.proto.UserBitShared.CoreOperatorType.UNNEST_VALUE;
 
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/unnest/UnnestRecordBatch.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/unnest/UnnestRecordBatch.java
index 3ef8179..7e6b141 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/unnest/UnnestRecordBatch.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/unnest/UnnestRecordBatch.java
@@ -18,7 +18,6 @@
 package org.apache.drill.exec.physical.impl.unnest;
 
 import com.google.common.base.Preconditions;
-import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.google.common.collect.Lists;
 import org.apache.drill.common.exceptions.UserException;
 import org.apache.drill.common.expression.FieldReference;
@@ -29,9 +28,6 @@ import org.apache.drill.exec.exception.SchemaChangeException;
 import org.apache.drill.exec.ops.FragmentContext;
 import org.apache.drill.exec.ops.MetricDef;
 import org.apache.drill.exec.physical.config.UnnestPOP;
-import org.apache.drill.exec.physical.impl.join.LateralJoinBatch;
-import org.apache.drill.exec.record.AbstractRecordBatch;
-import org.apache.drill.exec.record.AbstractSingleRecordBatch;
 import org.apache.drill.exec.record.AbstractTableFunctionRecordBatch;
 import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode;
 import org.apache.drill.exec.record.MaterializedField;
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/PlannerPhase.java 
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/PlannerPhase.java
index 3196bd0..b5e09ef 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/PlannerPhase.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/PlannerPhase.java
@@ -279,6 +279,7 @@ public enum PlannerPhase {
       DrillFilterAggregateTransposeRule.INSTANCE,
 
       RuleInstance.FILTER_MERGE_RULE,
+      RuleInstance.FILTER_CORRELATE_RULE,
       RuleInstance.AGGREGATE_REMOVE_RULE,
       RuleInstance.PROJECT_REMOVE_RULE,
       RuleInstance.SORT_REMOVE_RULE,
@@ -448,6 +449,7 @@ public enum PlannerPhase {
     ruleList.add(UnionAllPrule.INSTANCE);
     ruleList.add(ValuesPrule.INSTANCE);
     ruleList.add(DirectScanPrule.INSTANCE);
+
     ruleList.add(UnnestPrule.INSTANCE);
     ruleList.add(CorrelatePrule.INSTANCE);
 
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/RuleInstance.java 
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/RuleInstance.java
index 49feb41..986fdbd 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/RuleInstance.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/RuleInstance.java
@@ -27,6 +27,7 @@ import org.apache.calcite.rel.logical.LogicalProject;
 import org.apache.calcite.rel.logical.LogicalUnion;
 import org.apache.calcite.rel.rules.AggregateExpandDistinctAggregatesRule;
 import org.apache.calcite.rel.rules.AggregateRemoveRule;
+import org.apache.calcite.rel.rules.FilterCorrelateRule;
 import org.apache.calcite.rel.rules.FilterMergeRule;
 import org.apache.calcite.rel.rules.FilterSetOpTransposeRule;
 import org.apache.calcite.rel.rules.JoinPushExpressionsRule;
@@ -62,6 +63,9 @@ public interface RuleInstance {
   FilterMergeRule FILTER_MERGE_RULE =
       new FilterMergeRule(DrillRelFactories.LOGICAL_BUILDER);
 
+  FilterCorrelateRule FILTER_CORRELATE_RULE =
+      new FilterCorrelateRule(DrillRelFactories.LOGICAL_BUILDER);
+
   AggregateRemoveRule AGGREGATE_REMOVE_RULE =
       new AggregateRemoveRule(LogicalAggregate.class, 
DrillRelFactories.LOGICAL_BUILDER);
 
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillJoinRelBase.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillJoinRelBase.java
index 06f02c0..10c4738 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillJoinRelBase.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillJoinRelBase.java
@@ -111,11 +111,11 @@ public abstract class DrillJoinRelBase extends Join 
implements DrillRelNode {
     return new HashSet<>(left).removeAll(right);
   }
 
-  protected boolean uniqueFieldNames(RelDataType rowType) {
+  public static boolean uniqueFieldNames(RelDataType rowType) {
     return isUnique(rowType.getFieldNames());
   }
 
-  protected static <T> boolean isUnique(List<T> list) {
+  public static <T> boolean isUnique(List<T> list) {
     return new HashSet<>(list).size() == list.size();
   }
 
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillCorrelateRel.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillCorrelateRel.java
index e5eee4e..7c49232 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillCorrelateRel.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillCorrelateRel.java
@@ -24,9 +24,12 @@ import org.apache.calcite.rel.core.Correlate;
 import org.apache.calcite.rel.core.CorrelationId;
 import org.apache.calcite.sql.SemiJoinType;
 import org.apache.calcite.util.ImmutableBitSet;
+import org.apache.drill.common.logical.data.LateralJoin;
 import org.apache.drill.common.logical.data.LogicalOperator;
 import org.apache.drill.exec.planner.common.DrillCorrelateRelBase;
 
+import java.util.List;
+
 
 public class DrillCorrelateRel extends DrillCorrelateRelBase implements 
DrillRel {
 
@@ -45,7 +48,13 @@ public class DrillCorrelateRel extends DrillCorrelateRelBase 
implements DrillRel
 
   @Override
   public LogicalOperator implement(DrillImplementor implementor) {
-    //TODO: implementation for direct convert from RelNode to logical operator 
for explainPlan
-    return null;
+    final List<String> fields = getRowType().getFieldNames();
+    assert DrillJoinRel.isUnique(fields);
+    final int leftCount = left.getRowType().getFieldCount();
+
+    final LogicalOperator leftOp = DrillJoinRel.implementInput(implementor, 0, 
0, left, this);
+    final LogicalOperator rightOp = DrillJoinRel.implementInput(implementor, 
1, leftCount, right, this);
+
+    return new LateralJoin(leftOp, rightOp);
   }
 }
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillJoinRel.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillJoinRel.java
index b6b5c03..b77fa61 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillJoinRel.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillJoinRel.java
@@ -103,9 +103,24 @@ public class DrillJoinRel extends DrillJoinRelBase 
implements DrillRel {
    * @return
    */
   private LogicalOperator implementInput(DrillImplementor implementor, int i, 
int offset, RelNode input) {
-    final LogicalOperator inputOp = implementor.visitChild(this, i, input);
+    return implementInput(implementor, i, offset, input, this);
+  }
+
+  /**
+   * Check to make sure that the fields of the inputs are the same as the 
output field names.
+   * If not, insert a project renaming them.
+   * @param implementor
+   * @param i
+   * @param offset
+   * @param input
+   * @param currentNode the node to be implemented
+   * @return
+   */
+  public static LogicalOperator implementInput(DrillImplementor implementor, 
int i, int offset,
+                                                RelNode input, DrillRel 
currentNode) {
+    final LogicalOperator inputOp = implementor.visitChild(currentNode, i, 
input);
     assert uniqueFieldNames(input.getRowType());
-    final List<String> fields = getRowType().getFieldNames();
+    final List<String> fields = currentNode.getRowType().getFieldNames();
     final List<String> inputFields = input.getRowType().getFieldNames();
     final List<String> outputFields = fields.subList(offset, offset + 
inputFields.size());
     if (!outputFields.equals(inputFields)) {
@@ -118,7 +133,8 @@ public class DrillJoinRel extends DrillJoinRelBase 
implements DrillRel {
     }
   }
 
-  private LogicalOperator rename(DrillImplementor implementor, LogicalOperator 
inputOp, List<String> inputFields, List<String> outputFields) {
+  private static LogicalOperator rename(DrillImplementor implementor, 
LogicalOperator inputOp,
+                                        List<String> inputFields, List<String> 
outputFields) {
     Project.Builder builder = Project.builder();
     builder.setInput(inputOp);
     for (Pair<String, String> pair : Pair.zip(inputFields, outputFields)) {
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnnestRel.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnnestRel.java
index ab827e5..0bf8c68 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnnestRel.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnnestRel.java
@@ -21,8 +21,11 @@ import org.apache.calcite.plan.RelOptCluster;
 import org.apache.calcite.plan.RelTraitSet;
 
 import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.rex.RexFieldAccess;
 import org.apache.calcite.rex.RexNode;
+import org.apache.drill.common.expression.SchemaPath;
 import org.apache.drill.common.logical.data.LogicalOperator;
+import org.apache.drill.common.logical.data.Unnest;
 import org.apache.drill.exec.planner.common.DrillUnnestRelBase;
 
 
@@ -37,7 +40,11 @@ public class DrillUnnestRel extends DrillUnnestRelBase 
implements DrillRel {
 
   @Override
   public LogicalOperator implement(DrillImplementor implementor) {
-    //TODO: implementation for direct convert from RelNode to logical operator 
for explainPlan
+    if(getRef() instanceof RexFieldAccess) {
+      final RexFieldAccess fldAccess = (RexFieldAccess)getRef();
+      return new 
Unnest(SchemaPath.getSimplePath(fldAccess.getField().getName()));
+    }
+
     return null;
   }
 
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/PlannerSettings.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/PlannerSettings.java
index 8b5c878..5a40ae4 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/PlannerSettings.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/PlannerSettings.java
@@ -113,6 +113,12 @@ public class PlannerSettings implements Context{
       QUOTING_IDENTIFIERS_KEY, Quoting.BACK_TICK.string, 
Quoting.DOUBLE_QUOTE.string, Quoting.BRACKET.string);
 
   /*
+    "planner.enable_unnest_lateral" is to allow users to choose enable 
unnest+lateraljoin feature.
+   */
+  public static final String ENABLE_UNNEST_LATERAL_KEY = 
"planner.enable_unnest_lateral";
+  public static final BooleanValidator ENABLE_UNNEST_LATERAL = new 
BooleanValidator(ENABLE_UNNEST_LATERAL_KEY);
+
+  /*
      Enables rules that re-write query joins in the most optimal way.
      Though its turned on be default and its value in query optimization is 
undeniable, user may want turn off such
      optimization to leave join order indicated in sql query unchanged.
@@ -317,6 +323,10 @@ public class PlannerSettings implements Context{
     return options.getOption(JOIN_OPTIMIZATION);
   }
 
+  public boolean isUnnestLateralEnabled() {
+    return options.getOption(ENABLE_UNNEST_LATERAL);
+  }
+
   @Override
   public <T> T unwrap(Class<T> clazz) {
     if(clazz == PlannerSettings.class){
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnnestPrule.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnnestPrule.java
index 765304d..48f4ea9 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnnestPrule.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnnestPrule.java
@@ -21,8 +21,6 @@ import org.apache.calcite.plan.RelOptRule;
 import org.apache.calcite.plan.RelOptRuleCall;
 import org.apache.calcite.rex.RexFieldAccess;
 import org.apache.calcite.rex.RexNode;
-import org.apache.drill.common.expression.SchemaPath;
-import org.apache.drill.exec.physical.config.UnnestPOP;
 import org.apache.drill.exec.planner.logical.DrillUnnestRel;
 import org.apache.drill.exec.planner.logical.RelOptHelper;
 
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/UnsupportedOperatorsVisitor.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/UnsupportedOperatorsVisitor.java
index da7b108..6b97841 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/UnsupportedOperatorsVisitor.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/UnsupportedOperatorsVisitor.java
@@ -266,6 +266,15 @@ public class UnsupportedOperatorsVisitor extends 
SqlShuttle {
       }
     }
 
+    //Disable UNNEST if the configuration disable it
+    if (sqlCall.getKind() == SqlKind.UNNEST) {
+      if (!context.getPlannerSettings().isUnnestLateralEnabled()) {
+        
unsupportedOperatorCollector.setException(SqlUnsupportedException.ExceptionType.RELATIONAL,
+            "Unnest is not enabled per configuration");
+        throw new UnsupportedOperationException();
+      }
+    }
+
     // Disable Function
     for(String strOperator : disabledOperators) {
       if(sqlCall.getOperator().isName(strOperator)) {
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/SystemOptionManager.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/SystemOptionManager.java
index 6f59eb4..7f02773 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/SystemOptionManager.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/SystemOptionManager.java
@@ -115,6 +115,7 @@ public class SystemOptionManager extends BaseOptionManager 
implements AutoClosea
       new 
OptionDefinition(PlannerSettings.PARQUET_ROWGROUP_FILTER_PUSHDOWN_PLANNING_THRESHOLD),
       new OptionDefinition(PlannerSettings.QUOTING_IDENTIFIERS),
       new OptionDefinition(PlannerSettings.JOIN_OPTIMIZATION),
+      new OptionDefinition(PlannerSettings.ENABLE_UNNEST_LATERAL),
       new OptionDefinition(PlannerSettings.FORCE_2PHASE_AGGR), // for testing
       new OptionDefinition(ExecConstants.HASHAGG_NUM_PARTITIONS_VALIDATOR),
       new OptionDefinition(ExecConstants.HASHAGG_MAX_MEMORY_VALIDATOR),
diff --git a/exec/java-exec/src/main/resources/drill-module.conf 
b/exec/java-exec/src/main/resources/drill-module.conf
index 8874f92..b2013d5 100644
--- a/exec/java-exec/src/main/resources/drill-module.conf
+++ b/exec/java-exec/src/main/resources/drill-module.conf
@@ -486,6 +486,7 @@ drill.exec.options: {
     planner.enable_topn: true,
     planner.enable_type_inference: true,
     planner.enable_unionall_distribute: false,
+    planner.enable_unnest_lateral: false,
     planner.filter.max_selectivity_estimate_factor: 1.0,
     planner.filter.min_selectivity_estimate_factor: 0.0,
     planner.force_2phase_aggr: false,
diff --git 
a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/lateraljoin/TestLateralPhysicalPlan.java
 
b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/lateraljoin/TestLateralPlans.java
similarity index 66%
rename from 
exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/lateraljoin/TestLateralPhysicalPlan.java
rename to 
exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/lateraljoin/TestLateralPlans.java
index 09d85d4..2125bd1 100644
--- 
a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/lateraljoin/TestLateralPhysicalPlan.java
+++ 
b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/lateraljoin/TestLateralPlans.java
@@ -18,11 +18,19 @@
 package org.apache.drill.exec.physical.impl.lateraljoin;
 
 import static org.junit.Assert.assertEquals;
+
+import org.apache.drill.PlanTestBase;
 import org.apache.drill.test.BaseTestQuery;
+import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
 
-public class TestLateralPhysicalPlan extends BaseTestQuery {
+public class TestLateralPlans extends BaseTestQuery {
+
+  @BeforeClass
+  public static void enableUnnestLateral() throws Exception {
+    test("alter session set `planner.enable_unnest_lateral`=true");
+  }
 
   @Test
   public void testLateralPlan1() throws Exception {
@@ -31,28 +39,40 @@ public class TestLateralPhysicalPlan extends BaseTestQuery {
   }
 
   @Test
-  @Ignore("To be fixed")
-  public void testLateralSqlStar() throws Exception {
-    String Sql = "select * from cp.`lateraljoin/nested-customer.json` t, 
unnest(t.orders) t2 limit 1";
+  public void testLateralSql() throws Exception {
+    String Sql = "select t.c_name, t2.o_shop as o_shop from 
cp.`lateraljoin/nested-customer.json` t,"
+                 + " unnest(t.orders) t2 limit 1";
     testBuilder()
         .unOrdered()
         .sqlQuery(Sql)
         .baselineColumns("c_name", "o_shop")
         .baselineValues("customer1", "Meno Park 1st")
         .go();
+  }
 
+  @Test
+  public void testExplainLateralSql() throws Exception {
+    String Sql = "explain plan without implementation for"
+        + " select t.c_name, t2.o_shop as o_shop from 
cp.`lateraljoin/nested-customer.json` t,"
+        + " unnest(t.orders) t2 limit 1";
+    test(Sql);
   }
 
   @Test
-  public void testLateralSql() throws Exception {
-    String Sql = "select t.c_name, t2.o_shop as o_shop from 
cp.`lateraljoin/nested-customer.json` t, unnest(t.orders) t2 limit 1";
+  public void testFilterPushCorrelate() throws Exception {
+    test("alter session set `planner.slice_target`=1");
+    String query = "select t.c_name, t2.o_shop as o_shop from 
cp.`lateraljoin/nested-customer.json` t,"
+        + " unnest(t.orders) t2 where t.c_name='customer1' AND t2.o_shop='Meno 
Park 1st' ";
+    PlanTestBase.testPlanMatchingPatterns(query,
+        new String[] 
{"Correlate(.*[\n\r])+.*Filter(.*[\n\r])+.*Scan(.*[\n\r])+.*Filter"},
+        new String[]{}
+    );
     testBuilder()
         .unOrdered()
-        .sqlQuery(Sql)
+        .sqlQuery(query)
         .baselineColumns("c_name", "o_shop")
         .baselineValues("customer1", "Meno Park 1st")
         .go();
-
   }
 
   @Test
@@ -69,9 +89,16 @@ public class TestLateralPhysicalPlan extends BaseTestQuery {
   }
 
   @Test
-  @Ignore("To be fixed")
+  public void testLateralSqlStar() throws Exception {
+    String Sql = "select * from cp.`lateraljoin/nested-customer.json` t, 
unnest(t.orders) t2 limit 1";
+    test(Sql);
+  }
+
+  @Test
+  @Ignore("To be fixed: how to specify columns names for table alias in 
dynamic case")
   public void testLateralSqlWithAS() throws Exception {
-    String Sql = "select t.c_name, t2.o_shop from 
cp.`lateraljoin/nested-customer.parquet` t, unnest(t.orders) as t2(o_shop) 
limit 1";
+    String Sql = "select t.c_name, t2.o_shop from 
cp.`lateraljoin/nested-customer.parquet` t,"
+        + " unnest(t.orders) as t2(o_shop) limit 1";
     testBuilder()
         .unOrdered()
         .sqlQuery(Sql)
@@ -80,6 +107,7 @@ public class TestLateralPhysicalPlan extends BaseTestQuery {
         .go();
 
   }
+
   @Test
   public void testSubQuerySql() throws Exception {
     String Sql = "select t2.os.* from (select t.orders as os from 
cp.`lateraljoin/nested-customer.parquet` t) t2";
diff --git 
a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/unnest/TestUnnestCorrectness.java
 
b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/unnest/TestUnnestCorrectness.java
index 137966b..8ec0c96 100644
--- 
a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/unnest/TestUnnestCorrectness.java
+++ 
b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/unnest/TestUnnestCorrectness.java
@@ -42,6 +42,7 @@ import org.apache.drill.test.rowSet.RowSetBuilder;
 import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
@@ -132,6 +133,7 @@ import static org.junit.Assert.assertTrue;
   }
 
   @Test
+  @Ignore("With DRILL-6321 commits, Unnest's output could be multiplec olumns")
   public void testUnnestMapColumn() {
 
     Object[][] data = getMapData();
diff --git 
a/logical/src/main/java/org/apache/drill/common/logical/data/LateralJoin.java 
b/logical/src/main/java/org/apache/drill/common/logical/data/LateralJoin.java
index b2c78a4..5533422 100644
--- 
a/logical/src/main/java/org/apache/drill/common/logical/data/LateralJoin.java
+++ 
b/logical/src/main/java/org/apache/drill/common/logical/data/LateralJoin.java
@@ -24,7 +24,6 @@ import com.google.common.collect.Iterators;
 import org.apache.drill.common.logical.data.visitors.LogicalVisitor;
 
 import java.util.Iterator;
-import java.util.List;
 
 @JsonTypeName("lateral-join")
 public class LateralJoin extends LogicalOperatorBase {
diff --git 
a/logical/src/main/java/org/apache/drill/common/logical/data/Unnest.java 
b/logical/src/main/java/org/apache/drill/common/logical/data/Unnest.java
index a70e8cc..9f9e964 100644
--- a/logical/src/main/java/org/apache/drill/common/logical/data/Unnest.java
+++ b/logical/src/main/java/org/apache/drill/common/logical/data/Unnest.java
@@ -24,7 +24,7 @@ import org.apache.drill.common.expression.SchemaPath;
 import org.apache.drill.common.logical.data.visitors.LogicalVisitor;
 
 @JsonTypeName("unnest")
-public class Unnest extends SingleInputOperator {
+public class Unnest extends SourceOperator {
 
   private final SchemaPath column;
 
@@ -41,5 +41,4 @@ public class Unnest extends SingleInputOperator {
   public <T, X, E extends Throwable> T accept(LogicalVisitor<T, X, E> 
logicalVisitor, X value) throws E {
     return logicalVisitor.visitUnnest(this, value);
   }
-
 }
diff --git a/pom.xml b/pom.xml
index 151f208..43207c1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,7 +45,7 @@
     <dep.guava.version>18.0</dep.guava.version>
     <forkCount>2</forkCount>
     <parquet.version>1.8.1-drill-r0</parquet.version>
-    <calcite.version>1.16.0-drill-r0</calcite.version>
+    <calcite.version>1.16.0-drill-r1</calcite.version>
     <avatica.version>1.11.0</avatica.version>
     <janino.version>2.7.6</janino.version>
     <sqlline.version>1.1.9-drill-r7</sqlline.version>

-- 
To stop receiving notification emails like this one, please contact
par...@apache.org.

Reply via email to