Search in sources :

Example 1 with StoragePluginOptimizerRule

use of org.apache.drill.exec.store.StoragePluginOptimizerRule in project drill by apache.

the class HiveStoragePlugin method getPhysicalOptimizerRules.

@Override
public Set<StoragePluginOptimizerRule> getPhysicalOptimizerRules(OptimizerRulesContext optimizerRulesContext) {
    ImmutableSet.Builder<StoragePluginOptimizerRule> ruleBuilder = ImmutableSet.builder();
    OptionManager options = optimizerRulesContext.getPlannerSettings().getOptions();
    // once "store.parquet.reader.int96_as_timestamp" will be true by default
    if (options.getBoolean(ExecConstants.HIVE_OPTIMIZE_SCAN_WITH_NATIVE_READERS) || options.getBoolean(ExecConstants.HIVE_OPTIMIZE_PARQUET_SCAN_WITH_NATIVE_READER)) {
        ruleBuilder.add(ConvertHiveParquetScanToDrillParquetScan.INSTANCE);
    }
    if (options.getBoolean(ExecConstants.HIVE_OPTIMIZE_MAPRDB_JSON_SCAN_WITH_NATIVE_READER)) {
        try {
            Class<?> hiveToDrillMapRDBJsonRuleClass = Class.forName("org.apache.drill.exec.planner.sql.logical.ConvertHiveMapRDBJsonScanToDrillMapRDBJsonScan");
            ruleBuilder.add((StoragePluginOptimizerRule) hiveToDrillMapRDBJsonRuleClass.getField("INSTANCE").get(null));
        } catch (ReflectiveOperationException e) {
            logger.warn("Current Drill build is not designed for working with Hive MapR-DB tables. " + "Please disable {} option", ExecConstants.HIVE_OPTIMIZE_MAPRDB_JSON_SCAN_WITH_NATIVE_READER);
        }
    }
    return ruleBuilder.build();
}
Also used : ImmutableSet(org.apache.drill.shaded.guava.com.google.common.collect.ImmutableSet) StoragePluginOptimizerRule(org.apache.drill.exec.store.StoragePluginOptimizerRule) OptionManager(org.apache.drill.exec.server.options.OptionManager) SessionOptionManager(org.apache.drill.exec.server.options.SessionOptionManager)

Aggregations

OptionManager (org.apache.drill.exec.server.options.OptionManager)1 SessionOptionManager (org.apache.drill.exec.server.options.SessionOptionManager)1 StoragePluginOptimizerRule (org.apache.drill.exec.store.StoragePluginOptimizerRule)1 ImmutableSet (org.apache.drill.shaded.guava.com.google.common.collect.ImmutableSet)1