public static boolean isFullAcidScan(Configuration conf) { if (!HiveConf.getBoolVar(conf, ConfVars.HIVE_TRANSACTIONAL_TABLE_SCAN)) return false; int propInt = conf.getInt(ConfVars.HIVE_TXN_OPERATIONAL_PROPERTIES.varname, -1); if (propInt == -1) return true; AcidOperationalProperties props = AcidOperationalProperties.parseInt(propInt); return !props.isInsertOnly(); }
/** * Returns the acidOperationalProperties for a given configuration. * @param conf A configuration object * @return the acidOperationalProperties object for the corresponding configuration. */ public static AcidOperationalProperties getAcidOperationalProperties(Configuration conf) { // If the conf does not define any transactional properties, the parseInt() should receive // a value of zero, which will set AcidOperationalProperties to a legacy type and return that. return AcidOperationalProperties.parseInt( HiveConf.getIntVar(conf, ConfVars.HIVE_TXN_OPERATIONAL_PROPERTIES)); }
/** * Returns the acidOperationalProperties for a given configuration. * @param conf A configuration object * @return the acidOperationalProperties object for the corresponding configuration. */ public static AcidOperationalProperties getAcidOperationalProperties(Configuration conf) { // If the conf does not define any transactional properties, the parseInt() should receive // a value of 1, which will set AcidOperationalProperties to a default type and return that. return AcidOperationalProperties.parseInt( HiveConf.getIntVar(conf, ConfVars.HIVE_TXN_OPERATIONAL_PROPERTIES)); }
@Test public void testAcidOperationalProperties() throws Exception { AcidUtils.AcidOperationalProperties testObj = AcidUtils.AcidOperationalProperties.getDefault(); assertsForAcidOperationalProperties(testObj, "default"); testObj = AcidUtils.AcidOperationalProperties.parseInt(1); assertsForAcidOperationalProperties(testObj, "split_update"); testObj = AcidUtils.AcidOperationalProperties.parseString("default"); assertsForAcidOperationalProperties(testObj, "default"); }