Search in sources :

Example 1 with ConfVars

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;
}
Also used : HiveException(org.apache.hadoop.hive.ql.metadata.HiveException) DataOutputStream(java.io.DataOutputStream) FSDataOutputStream(org.apache.hadoop.fs.FSDataOutputStream) ConfVars(org.apache.hadoop.hive.conf.HiveConf.ConfVars)

Example 2 with ConfVars

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);
}
Also used : ConfVars(org.apache.hadoop.hive.conf.HiveConf.ConfVars) HiveConf(org.apache.hadoop.hive.conf.HiveConf)

Example 3 with ConfVars

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;
}
Also used : HiveException(org.apache.hadoop.hive.ql.metadata.HiveException) DataOutputStream(java.io.DataOutputStream) ConfVars(org.apache.hadoop.hive.conf.HiveConf.ConfVars)

Example 4 with ConfVars

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);
    }
}
Also used : ConfVars(org.apache.hadoop.hive.conf.HiveConf.ConfVars)

Example 5 with ConfVars

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;
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) RPC(org.apache.hadoop.ipc.RPC) ConfVars(org.apache.hadoop.hive.conf.HiveConf.ConfVars)

Aggregations

ConfVars (org.apache.hadoop.hive.conf.HiveConf.ConfVars)8 Configuration (org.apache.hadoop.conf.Configuration)3 DataOutputStream (java.io.DataOutputStream)2 HiveException (org.apache.hadoop.hive.ql.metadata.HiveException)2 RPC (org.apache.hadoop.ipc.RPC)2 ByteString (com.google.protobuf.ByteString)1 HashMap (java.util.HashMap)1 FSDataOutputStream (org.apache.hadoop.fs.FSDataOutputStream)1 HiveConf (org.apache.hadoop.hive.conf.HiveConf)1 LlapNodeId (org.apache.hadoop.hive.llap.LlapNodeId)1 WmFragmentCounters (org.apache.hadoop.hive.llap.counters.WmFragmentCounters)1 LlapTokenInfo (org.apache.hadoop.hive.llap.daemon.impl.LlapTokenChecker.LlapTokenInfo)1 NotTezEvent (org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos.NotTezEvent)1 QueryIdentifierProto (org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos.QueryIdentifierProto)1 SignableVertexSpec (org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos.SignableVertexSpec)1 SubmitWorkResponseProto (org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos.SubmitWorkResponseProto)1 LlapDaemonPolicyProvider (org.apache.hadoop.hive.llap.security.LlapDaemonPolicyProvider)1 Credentials (org.apache.hadoop.security.Credentials)1 UserGroupInformation (org.apache.hadoop.security.UserGroupInformation)1 JobTokenIdentifier (org.apache.tez.common.security.JobTokenIdentifier)1