use of org.apache.hadoop.hive.conf.HiveConf.ConfVars in project hive by apache.
the class DDLTask method showConf.
private int showConf(Hive db, ShowConfDesc showConf) throws Exception {
ConfVars conf = HiveConf.getConfVars(showConf.getConfName());
if (conf == null) {
throw new HiveException("invalid configuration name " + showConf.getConfName());
}
String description = conf.getDescription();
String defaultValue = conf.getDefaultValue();
DataOutputStream output = getOutputStream(showConf.getResFile());
try {
if (defaultValue != null) {
output.write(defaultValue.getBytes());
}
output.write(separator);
output.write(conf.typeString().getBytes());
output.write(separator);
if (description != null) {
output.write(description.replaceAll(" *\n *", " ").getBytes());
}
output.write(terminator);
} finally {
output.close();
}
return 0;
}
use of org.apache.hadoop.hive.conf.HiveConf.ConfVars in project hive by apache.
the class TestRestrictedList method addToExpectedRestrictedMap.
private static void addToExpectedRestrictedMap(String parameter) {
HiveConf.ConfVars confVars = HiveConf.getConfVars(parameter);
String value = "foo";
if (confVars != null) {
if (confVars.isType("foo") && confVars.validate("foo") == null) {
value = "foo";
} else if (confVars.isType("1s") && confVars.validate("1s") == null) {
value = "1s";
} else if (confVars.isType("1") && confVars.validate("1") == null) {
value = "1";
}
}
expectedRestrictedMap.put(parameter, value);
}
use of org.apache.hadoop.hive.conf.HiveConf.ConfVars in project hive by apache.
the class ShowConfOperation method execute.
@Override
public int execute() throws HiveException, IOException {
ConfVars conf = HiveConf.getConfVars(desc.getConfName());
if (conf == null) {
throw new HiveException("invalid configuration name " + desc.getConfName());
}
String description = conf.getDescription();
String defaultValue = conf.getDefaultValue();
try (DataOutputStream output = ShowUtils.getOutputStream(desc.getResFile(), context)) {
if (defaultValue != null) {
output.write(defaultValue.getBytes(StandardCharsets.UTF_8));
}
output.write(Utilities.tabCode);
output.write(conf.typeString().getBytes(StandardCharsets.UTF_8));
output.write(Utilities.tabCode);
if (description != null) {
output.write(description.replaceAll(" *\n *", " ").getBytes(StandardCharsets.UTF_8));
}
output.write(Utilities.newLineCode);
}
return 0;
}
use of org.apache.hadoop.hive.conf.HiveConf.ConfVars in project hive by apache.
the class RestrictedConfigChecker method validate.
public void validate(HiveConf conf) throws HiveException {
for (ConfVars var : restrictedHiveConf) {
String userValue = HiveConf.getVarWithoutType(conf, var), serverValue = HiveConf.getVarWithoutType(initConf, var);
// Note: with some trickery, we could add logic for each type in ConfVars; for now the
// potential spurious mismatches (e.g. 0 and 0.0 for float) should be easy to work around.
validateRestrictedConfigValues(var.varname, userValue, serverValue);
}
for (String var : restrictedNonHiveConf) {
String userValue = conf.get(var), serverValue = initConf.get(var);
validateRestrictedConfigValues(var, userValue, serverValue);
}
}
use of org.apache.hadoop.hive.conf.HiveConf.ConfVars in project hive by apache.
the class LlapUtil method createRpcServer.
public static RPC.Server createRpcServer(Class<?> pbProtocol, InetSocketAddress addr, Configuration conf, int numHandlers, BlockingService blockingService, SecretManager<?> secretManager, PolicyProvider provider, ConfVars... aclVars) throws IOException {
Configuration serverConf = conf;
boolean isSecurityEnabled = conf.getBoolean(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION, false);
if (isSecurityEnabled) {
// Enforce Hive defaults.
for (ConfVars acl : aclVars) {
// Some value is set.
if (conf.get(acl.varname) != null)
continue;
if (serverConf == conf) {
serverConf = new Configuration(conf);
}
// Set the default.
serverConf.set(acl.varname, HiveConf.getVar(serverConf, acl));
}
}
RPC.setProtocolEngine(serverConf, pbProtocol, ProtobufRpcEngine.class);
RPC.Builder builder = new RPC.Builder(serverConf).setProtocol(pbProtocol).setInstance(blockingService).setBindAddress(addr.getHostName()).setPort(addr.getPort()).setNumHandlers(numHandlers);
if (secretManager != null) {
builder = builder.setSecretManager(secretManager);
}
RPC.Server server = builder.build();
if (isSecurityEnabled) {
server.refreshServiceAcl(serverConf, provider);
}
return server;
}
Aggregations