use of org.apache.hadoop.hive.metastore.conf.MetastoreConf.ConfVars in project flink by apache.
the class HiveMetaStoreClient method isCompatibleWith.
@Override
public boolean isCompatibleWith(Configuration conf) {
// Make a copy of currentMetaVars, there is a race condition that
// currentMetaVars might be changed during the execution of the method
Map<String, String> currentMetaVarsCopy = currentMetaVars;
if (currentMetaVarsCopy == null) {
// recreate
return false;
}
boolean compatible = true;
for (ConfVars oneVar : MetastoreConf.metaVars) {
// Since metaVars are all of different types, use string for comparison
String oldVar = currentMetaVarsCopy.get(oneVar.getVarname());
String newVar = MetastoreConf.getAsString(conf, oneVar);
if (oldVar == null || (oneVar.isCaseSensitive() ? !oldVar.equals(newVar) : !oldVar.equalsIgnoreCase(newVar))) {
LOG.info("Mestastore configuration " + oneVar.toString() + " changed from " + oldVar + " to " + newVar);
compatible = false;
}
}
return compatible;
}
use of org.apache.hadoop.hive.metastore.conf.MetastoreConf.ConfVars in project hive by apache.
the class HMSHandler method setMetaConf.
@Override
public void setMetaConf(String key, String value) throws MetaException {
ConfVars confVar = MetastoreConf.getMetaConf(key);
if (confVar == null) {
throw new MetaException("Invalid configuration key " + key);
}
try {
confVar.validate(value);
} catch (IllegalArgumentException e) {
throw new MetaException("Invalid configuration value " + value + " for key " + key + " by " + e.getMessage());
}
Configuration configuration = getConf();
String oldValue = MetastoreConf.get(configuration, key);
// Save prev val of the key on threadLocal
Map<String, String> modifiedConf = HMSHandlerContext.getModifiedConfig();
if (!modifiedConf.containsKey(key)) {
modifiedConf.put(key, oldValue);
}
// metaListeners in HiveMetaStore#cleanupHandlerContext
if (!HMSHandlerContext.getHMSHandler().isPresent()) {
HMSHandlerContext.setHMSHandler(this);
}
configuration.set(key, value);
notifyMetaListeners(key, oldValue, value);
if (ConfVars.TRY_DIRECT_SQL == confVar) {
HMSHandler.LOG.info("Direct SQL optimization = {}", value);
}
}
use of org.apache.hadoop.hive.metastore.conf.MetastoreConf.ConfVars in project hive by apache.
the class TestHiveMetaStoreGetMetaConf method testGetMetaConfDefaultEmptyString.
@Test
public void testGetMetaConfDefaultEmptyString() throws TException {
ConfVars metaConfVar = ConfVars.PARTITION_NAME_WHITELIST_PATTERN;
String expected = "";
String actual = hmsc.getMetaConf(metaConfVar.toString());
assertEquals(expected, actual);
}
use of org.apache.hadoop.hive.metastore.conf.MetastoreConf.ConfVars in project hive by apache.
the class TestHiveMetaStoreGetMetaConf method testGetMetaConfOverridden.
@Test
public void testGetMetaConfOverridden() throws TException {
ConfVars metaConfVar = ConfVars.TRY_DIRECT_SQL_DDL;
String expected = "false";
String actual = hmsc.getMetaConf(metaConfVar.toString());
assertEquals(expected, actual);
}
use of org.apache.hadoop.hive.metastore.conf.MetastoreConf.ConfVars in project hive by apache.
the class HiveMetaStoreClientPreCatalog method isCompatibleWith.
@Override
public boolean isCompatibleWith(Configuration conf) {
// Make a copy of currentMetaVars, there is a race condition that
// currentMetaVars might be changed during the execution of the method
Map<String, String> currentMetaVarsCopy = currentMetaVars;
if (currentMetaVarsCopy == null) {
// recreate
return false;
}
boolean compatible = true;
for (ConfVars oneVar : MetastoreConf.metaVars) {
// Since metaVars are all of different types, use string for comparison
String oldVar = currentMetaVarsCopy.get(oneVar.getVarname());
String newVar = MetastoreConf.getAsString(conf, oneVar);
if (oldVar == null || (oneVar.isCaseSensitive() ? !oldVar.equals(newVar) : !oldVar.equalsIgnoreCase(newVar))) {
LOG.info("Mestastore configuration " + oneVar.toString() + " changed from " + oldVar + " to " + newVar);
compatible = false;
}
}
return compatible;
}
Aggregations