Search in sources :

Example 1 with EnabledOverride

use of org.apache.hadoop.hive.ql.optimizer.physical.Vectorizer.EnabledOverride in project hive by apache.

the class MapJoinProcessor method isFullOuterMapEnabled.

public static boolean isFullOuterMapEnabled(HiveConf hiveConf, JoinOperator joinOp) throws SemanticException {
    final String testMapJoinFullOuterOverrideString = HiveConf.getVar(hiveConf, HiveConf.ConfVars.HIVE_TEST_MAPJOINFULLOUTER_OVERRIDE);
    EnabledOverride mapJoinFullOuterOverride = EnabledOverride.nameMap.get(testMapJoinFullOuterOverrideString);
    final boolean isEnabled = HiveConf.getBoolVar(hiveConf, HiveConf.ConfVars.HIVEMAPJOINFULLOUTER);
    switch(mapJoinFullOuterOverride) {
        case NONE:
            {
                if (!isEnabled) {
                    LOG.debug("FULL OUTER MapJoin not enabled: {} is false", HiveConf.ConfVars.HIVEMAPJOINFULLOUTER.varname);
                    return false;
                }
            }
            break;
        case DISABLE:
            if (LOG.isDebugEnabled()) {
                LOG.debug("FULL OUTER MapJoin not enabled: " + HiveConf.ConfVars.HIVE_TEST_MAPJOINFULLOUTER_OVERRIDE.varname + " is disable (" + " " + HiveConf.ConfVars.HIVEMAPJOINFULLOUTER.varname + " is " + isEnabled + ")");
            }
            return false;
        case ENABLE:
            // Different parts of the code may rely on this being set...
            HiveConf.setBoolVar(hiveConf, HiveConf.ConfVars.HIVEMAPJOINFULLOUTER, true);
            if (LOG.isDebugEnabled()) {
                LOG.debug("FULL OUTER MapJoin is enabled: " + HiveConf.ConfVars.HIVE_TEST_MAPJOINFULLOUTER_OVERRIDE.varname + " is enable (" + " " + HiveConf.ConfVars.HIVEMAPJOINFULLOUTER.varname + " is " + isEnabled + ")");
            }
            break;
        default:
            throw new RuntimeException("Unexpected vectorization enabled override " + mapJoinFullOuterOverride);
    }
    final String engine = HiveConf.getVar(hiveConf, HiveConf.ConfVars.HIVE_EXECUTION_ENGINE);
    final boolean isTezEngine = engine.equalsIgnoreCase("tez");
    if (!isTezEngine) {
        // Only Tez for now.
        LOG.debug("FULL OUTER MapJoin not enabled: Only Tez engine supported");
        return false;
    }
    /*
     * Optimized Hash Table (i.e. not old-style MR HashMap).
     */
    final boolean isOptimizedHashTableEnabled = HiveConf.getBoolVar(hiveConf, HiveConf.ConfVars.HIVEMAPJOINUSEOPTIMIZEDTABLE);
    if (!isOptimizedHashTableEnabled) {
        LOG.debug("FULL OUTER MapJoin not enabled: {} is false", HiveConf.ConfVars.HIVEMAPJOINUSEOPTIMIZEDTABLE.varname);
        return false;
    }
    boolean isCompatibleFullOuterMapJoin = checkFullOuterMapJoinCompatible(hiveConf, joinOp);
    if (!isCompatibleFullOuterMapJoin) {
        return false;
    }
    LOG.debug("FULL OUTER MapJoin enabled");
    return true;
}
Also used : EnabledOverride(org.apache.hadoop.hive.ql.optimizer.physical.Vectorizer.EnabledOverride)

Aggregations

EnabledOverride (org.apache.hadoop.hive.ql.optimizer.physical.Vectorizer.EnabledOverride)1