You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by sm...@apache.org on 2015/06/26 23:53:15 UTC

drill git commit: DRILL-3402: Throw exception when attempting to partition in format that doesn't support it

Repository: drill
Updated Branches:
  refs/heads/master 60bc9459b -> e347a5287


DRILL-3402: Throw exception when attempting to partition in format that doesn't support it


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

Branch: refs/heads/master
Commit: e347a528787f373a6de6d314a4a110e7ed6d66ff
Parents: 60bc945
Author: Steven Phillips <sm...@apache.org>
Authored: Fri Jun 26 13:07:12 2015 -0700
Committer: Steven Phillips <sm...@apache.org>
Committed: Fri Jun 26 14:24:04 2015 -0700

----------------------------------------------------------------------
 .../exec/planner/logical/FileSystemCreateTableEntry.java     | 8 ++++++++
 .../java/org/apache/drill/exec/store/dfs/FormatPlugin.java   | 6 ++++++
 .../apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java   | 6 ++++++
 .../apache/drill/exec/store/parquet/ParquetFormatPlugin.java | 4 ++++
 4 files changed, 24 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/e347a528/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/FileSystemCreateTableEntry.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/FileSystemCreateTableEntry.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/FileSystemCreateTableEntry.java
index 672092d..90eb05c 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/FileSystemCreateTableEntry.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/FileSystemCreateTableEntry.java
@@ -21,6 +21,7 @@ import java.io.IOException;
 import java.util.List;
 
 import org.apache.drill.common.exceptions.ExecutionSetupException;
+import org.apache.drill.common.exceptions.UserException;
 import org.apache.drill.common.expression.SchemaPath;
 import org.apache.drill.common.logical.FormatPluginConfig;
 import org.apache.drill.exec.physical.base.PhysicalOperator;
@@ -40,6 +41,7 @@ import org.apache.drill.exec.store.ischema.Records;
  */
 @JsonTypeName("filesystem")
 public class FileSystemCreateTableEntry implements CreateTableEntry {
+  private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(FileSystemCreateTableEntry.class);
 
   private FileSystemConfig storageConfig;
   private FormatPlugin formatPlugin;
@@ -81,6 +83,12 @@ public class FileSystemCreateTableEntry implements CreateTableEntry {
 
   @Override
   public Writer getWriter(PhysicalOperator child) throws IOException {
+    if (!(formatPlugin.supportsAutoPartitioning() ||
+        partitionColumns == null || partitionColumns.size() == 0)) {
+      throw UserException.unsupportedError().message(String.format("%s format does not support auto-partitioning.",
+          formatPlugin.getName())).build(logger);
+    }
+
     return formatPlugin.getWriter(child, location, partitionColumns);
   }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/e347a528/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FormatPlugin.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FormatPlugin.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FormatPlugin.java
index 81f9f76..14f1441 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FormatPlugin.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FormatPlugin.java
@@ -40,6 +40,12 @@ public interface FormatPlugin {
 
   public boolean supportsWrite();
 
+  /**
+   * Indicates whether this FormatPlugin supports auto-partitioning for CTAS statements
+   * @return true if auto-partitioning is supported
+   */
+  public boolean supportsAutoPartitioning();
+
   public FormatMatcher getMatcher();
 
   public AbstractWriter getWriter(PhysicalOperator child, String location, List<String> partitionColumns) throws IOException;

http://git-wip-us.apache.org/repos/asf/drill/blob/e347a528/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java
index 2918ca7..82a4fba 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java
@@ -23,6 +23,7 @@ import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import com.google.common.base.Preconditions;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.drill.common.exceptions.ExecutionSetupException;
 import org.apache.drill.common.expression.SchemaPath;
@@ -247,6 +248,11 @@ public abstract class EasyFormatPlugin<T extends FormatPluginConfig> implements
   }
 
   @Override
+  public boolean supportsAutoPartitioning() {
+    return false;
+  }
+
+  @Override
   public FormatMatcher getMatcher() {
     return matcher;
   }

http://git-wip-us.apache.org/repos/asf/drill/blob/e347a528/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetFormatPlugin.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetFormatPlugin.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetFormatPlugin.java
index eff7872..56a1f00 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetFormatPlugin.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetFormatPlugin.java
@@ -177,6 +177,10 @@ public class ParquetFormatPlugin implements FormatPlugin{
     return false;
   }
 
+  @Override
+  public boolean supportsAutoPartitioning() {
+    return true;
+  }
 
 
   @Override