This is an automated email from the ASF dual-hosted git repository. arina pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/drill.git
The following commit(s) were added to refs/heads/master by this push: new e43cfeb DRILL-6721: Fix SchemalessScan plan serialization / deserialization e43cfeb is described below commit e43cfebe8229bc8cd01ba5a3eafeeef987f5e425 Author: Arina Ielchiieva <arina.yelchiy...@gmail.com> AuthorDate: Wed Aug 29 13:31:00 2018 +0300 DRILL-6721: Fix SchemalessScan plan serialization / deserialization --- .../drill/exec/physical/base/SchemalessScan.java | 26 +++++++++++++--------- .../org/apache/drill/exec/TestEmptyInputSql.java | 13 ++++++----- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/SchemalessScan.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/SchemalessScan.java index b2d12cd..1db83f5 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/SchemalessScan.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/SchemalessScan.java @@ -17,24 +17,26 @@ */ package org.apache.drill.exec.physical.base; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeName; -import org.apache.drill.shaded.guava.com.google.common.base.Preconditions; -import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.common.expression.SchemaPath; -import org.apache.drill.exec.physical.PhysicalOperatorSetupException; import org.apache.drill.exec.proto.CoordinationProtos; +import org.apache.drill.shaded.guava.com.google.common.base.Preconditions; import java.util.List; /** - * The type of scan operator, which allows to scan schemaless tables ({@link DynamicDrillTable} with null selection) + * The type of scan operator, which allows to scan schemaless tables ({@link org.apache.drill.exec.planner.logical.DynamicDrillTable} with null selection) */ @JsonTypeName("schemaless-scan") public class SchemalessScan extends AbstractFileGroupScan implements SubScan { private final String selectionRoot; - public SchemalessScan(String userName, String selectionRoot) { + @JsonCreator + public SchemalessScan(@JsonProperty("userName") String userName, + @JsonProperty("selectionRoot") String selectionRoot) { super(userName); this.selectionRoot = selectionRoot; } @@ -44,12 +46,17 @@ public class SchemalessScan extends AbstractFileGroupScan implements SubScan { this.selectionRoot = that.selectionRoot; } + @JsonProperty + public String getSelectionRoot() { + return selectionRoot; + } + @Override - public void applyAssignments(List<CoordinationProtos.DrillbitEndpoint> endpoints) throws PhysicalOperatorSetupException { + public void applyAssignments(List<CoordinationProtos.DrillbitEndpoint> endpoints) { } @Override - public SubScan getSpecificScan(int minorFragmentId) throws ExecutionSetupException { + public SubScan getSpecificScan(int minorFragmentId) { return this; } @@ -65,14 +72,13 @@ public class SchemalessScan extends AbstractFileGroupScan implements SubScan { @Override public String toString() { - final String pattern = "SchemalessScan [selectionRoot = %s]"; + String pattern = "SchemalessScan [selectionRoot = %s]"; return String.format(pattern, selectionRoot); } @Override - public PhysicalOperator getNewWithChildren(List<PhysicalOperator> children) throws ExecutionSetupException { + public PhysicalOperator getNewWithChildren(List<PhysicalOperator> children) { Preconditions.checkArgument(children.isEmpty()); - assert children == null || children.isEmpty(); return new SchemalessScan(this); } diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/TestEmptyInputSql.java b/exec/java-exec/src/test/java/org/apache/drill/exec/TestEmptyInputSql.java index 1e85cb1..1512059 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/TestEmptyInputSql.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/TestEmptyInputSql.java @@ -17,6 +17,7 @@ */ package org.apache.drill.exec; +import org.apache.drill.PlanTestBase; import org.apache.drill.shaded.guava.com.google.common.collect.Lists; import org.apache.commons.lang3.tuple.Pair; import org.apache.drill.exec.planner.physical.PlannerSettings; @@ -69,7 +70,6 @@ public class TestEmptyInputSql extends BaseTestQuery { /** * Test with query against an empty file. Select clause has one or more * * star column is expanded into an empty list. - * @throws Exception */ @Test public void testQueryStarColEmptyJson() throws Exception { @@ -92,7 +92,6 @@ public class TestEmptyInputSql extends BaseTestQuery { /** * Test with query against an empty file. Select clause has one or more qualified * * star column is expanded into an empty list. - * @throws Exception */ @Test public void testQueryQualifiedStarColEmptyJson() throws Exception { @@ -180,7 +179,6 @@ public class TestEmptyInputSql extends BaseTestQuery { /** * Test select * against empty csv with empty header. * is expanded into empty list of fields. - * @throws Exception */ @Test public void testQueryEmptyCsvH() throws Exception { @@ -195,9 +193,8 @@ public class TestEmptyInputSql extends BaseTestQuery { } /** - * Test select * against empty csv file. * is exapnede into "columns : repeated-varchar", + * Test select * against empty csv file. * is expanded into "columns : repeated-varchar", * which is the default column from reading a csv file. - * @throws Exception */ @Test public void testQueryEmptyCsv() throws Exception { @@ -239,6 +236,10 @@ public class TestEmptyInputSql extends BaseTestQuery { .run(); } - + @Test + public void testEmptyDirectoryPlanSerDe() throws Exception { + String query = String.format("select * from dfs.tmp.`%s`", EMPTY_DIR_NAME); + PlanTestBase.testPhysicalPlanExecutionBasedOnQuery(query); + } }