You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by GitBox <gi...@apache.org> on 2018/08/29 15:41:44 UTC

[GitHub] arina-ielchiieva closed pull request #1452: DRILL-6721: Fix SchemalessScan plan serialization / deserialization

arina-ielchiieva closed pull request #1452: DRILL-6721: Fix SchemalessScan plan serialization / deserialization
URL: https://github.com/apache/drill/pull/1452
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 b2d12cd6012..1db83f579e0 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 SchemalessScan(final SchemalessScan that) {
     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 String getDigest() {
 
   @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 1e85cb15c59..1512059a59b 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 void testQueryEmptyJson() throws Exception {
   /**
    * 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 void testQueryStarColEmptyJson() throws Exception {
   /**
    * 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 void testQueryConstExprEmptyJson() throws Exception {
 
   /**
    * 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 void testQueryEmptyCsvH() throws Exception {
   }
 
   /**
-   * 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 void testEmptyDirectoryAndFieldInQuery() throws Exception {
         .run();
   }
 
-
+  @Test
+  public void testEmptyDirectoryPlanSerDe() throws Exception {
+    String query = String.format("select * from dfs.tmp.`%s`", EMPTY_DIR_NAME);
+    PlanTestBase.testPhysicalPlanExecutionBasedOnQuery(query);
+  }
 
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services