aboutsummaryrefslogtreecommitdiff
path: root/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveStoragePlugin.java
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveStoragePlugin.java')
-rw-r--r--contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveStoragePlugin.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveStoragePlugin.java b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveStoragePlugin.java
index adf134843..bdd230e0c 100644
--- a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveStoragePlugin.java
+++ b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveStoragePlugin.java
@@ -37,6 +37,7 @@ import org.apache.drill.common.JSONOptions;
import org.apache.drill.common.exceptions.DrillRuntimeException;
import org.apache.drill.common.exceptions.ExecutionSetupException;
import org.apache.drill.common.expression.SchemaPath;
+import org.apache.drill.common.logical.FormatPluginConfig;
import org.apache.drill.exec.ExecConstants;
import org.apache.drill.exec.ops.OptimizerRulesContext;
import org.apache.drill.exec.physical.base.AbstractGroupScan;
@@ -49,10 +50,13 @@ import org.apache.drill.exec.server.options.SessionOptionManager;
import org.apache.drill.exec.store.AbstractStoragePlugin;
import org.apache.drill.exec.store.SchemaConfig;
import org.apache.drill.exec.store.StoragePluginOptimizerRule;
+import org.apache.drill.exec.store.dfs.FormatPlugin;
import org.apache.drill.exec.store.hive.schema.HiveSchemaFactory;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.drill.exec.store.mapr.db.MapRDBFormatPlugin;
+import org.apache.drill.exec.store.mapr.db.MapRDBFormatPluginConfig;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
import org.apache.hadoop.hive.metastore.api.MetaException;
@@ -62,6 +66,8 @@ public class HiveStoragePlugin extends AbstractStoragePlugin {
private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(HiveStoragePlugin.class);
+ public static final String HIVE_MAPRDB_FORMAT_PLUGIN_NAME = "hive-maprdb";
+
private final HiveStoragePluginConfig config;
private HiveSchemaFactory schemaFactory;
private final HiveConf hiveConf;
@@ -216,4 +222,19 @@ public class HiveStoragePlugin extends AbstractStoragePlugin {
return ruleBuilder.build();
}
+ @Override
+ public FormatPlugin getFormatPlugin(FormatPluginConfig formatConfig) {
+ // TODO: implement formatCreator similar to FileSystemPlugin formatCreator. DRILL-6621
+ if (formatConfig instanceof MapRDBFormatPluginConfig) {
+ try {
+ return new MapRDBFormatPlugin(HIVE_MAPRDB_FORMAT_PLUGIN_NAME, context, hiveConf, config,
+ (MapRDBFormatPluginConfig) formatConfig);
+ } catch (IOException e) {
+ throw new DrillRuntimeException("The error is occurred while connecting to MapR-DB", e);
+ }
+ }
+ throw new DrillRuntimeException(String.format("Hive storage plugin doesn't support usage of %s format plugin",
+ formatConfig.getClass().getName()));
+ }
+
}