public String substituteVariables(HiveConf conf, String line) { if (!beeLine.isBeeLine()) { // Substitution is only supported in non-beeline mode. return new VariableSubstitution(new HiveVariableSource() { @Override public Map<String, String> getHiveVariable() { return getHiveVariables(); } }).substitute(conf, line); } return line; }
String result = null; HiveConf conf = ss.getConf(); String value = new VariableSubstitution(new HiveVariableSource() { @Override public Map<String, String> getHiveVariable() {
rewrittenQuery = new VariableSubstitution(new HiveVariableSource() { @Override public Map<String, String> getHiveVariable() {
void parse(SessionState ss) throws CompileProcessorException { if (ss != null){ command = new VariableSubstitution(new HiveVariableSource() { @Override public Map<String, String> getHiveVariable() {
rewrittenQuery = new VariableSubstitution(new HiveVariableSource() { @Override public Map<String, String> getHiveVariable() {
String result = null; HiveConf conf = SessionState.get().getConf(); String value = new VariableSubstitution(new HiveVariableSource() { @Override public Map<String, String> getHiveVariable() {
@Override public CommandProcessorResponse run(String command) { SessionState ss = SessionState.get(); command = new VariableSubstitution(() -> SessionState.get().getHiveVariables()).substitute(ss.getConf(), command); String[] tokens = command.split("\\s+"); if (tokens.length < 1) { return returnErrorResponse("Command arguments are empty."); } String params[] = Arrays.copyOfRange(tokens, 1, tokens.length); try { return llapCacheCommandHandler(ss, params); } catch (Exception e) { return returnErrorResponse(e.getMessage()); } }
@Override public CommandProcessorResponse run(String command) { SessionState ss = SessionState.get(); command = new VariableSubstitution(() -> SessionState.get().getHiveVariables()).substitute(ss.getConf(), command); String[] tokens = command.split("\\s+"); if (tokens.length < 1) { return returnErrorResponse("Command arguments are empty."); } String params[] = Arrays.copyOfRange(tokens, 1, tokens.length); try { return llapClusterCommandHandler(ss, params); } catch (Exception e) { return returnErrorResponse(e.getMessage()); } }
String propName = varname.substring(SYSTEM_PREFIX.length()); System.getProperties() .setProperty(propName, new VariableSubstitution(new HiveVariableSource() { @Override public Map<String, String> getHiveVariable() { } else if (varname.startsWith(HIVEVAR_PREFIX)) { String propName = varname.substring(HIVEVAR_PREFIX.length()); ss.getHiveVariables().put(propName, new VariableSubstitution(new HiveVariableSource() { @Override public Map<String, String> getHiveVariable() { String propName = varname.substring(METACONF_PREFIX.length()); Hive hive = Hive.get(ss.getConf()); hive.setMetaConf(propName, new VariableSubstitution(new HiveVariableSource() { @Override public Map<String, String> getHiveVariable() {
String propName = varname.substring(SYSTEM_PREFIX.length()); System.getProperties() .setProperty(propName, new VariableSubstitution(new HiveVariableSource() { @Override public Map<String, String> getHiveVariable() { } else if (varname.startsWith(HIVEVAR_PREFIX)) { String propName = varname.substring(HIVEVAR_PREFIX.length()); ss.getHiveVariables().put(propName, new VariableSubstitution(new HiveVariableSource() { @Override public Map<String, String> getHiveVariable() { String propName = varname.substring(METACONF_PREFIX.length()); Hive hive = Hive.get(ss.getConf()); hive.setMetaConf(propName, new VariableSubstitution(new HiveVariableSource() { @Override public Map<String, String> getHiveVariable() {
String propName = varname.substring(SystemVariables.METACONF_PREFIX.length()); HiveConf.ConfVars confVars = getConfVar(propName); Hive.get(ss.getConf()).setMetaConf(propName, new VariableSubstitution(new HiveVariableSource() { @Override public Map<String, String> getHiveVariable() {
@Override public CommandProcessorResponse run(String command) { SessionState ss = SessionState.get(); command = new VariableSubstitution(new HiveVariableSource() { @Override public Map<String, String> getHiveVariable() {
@Override public CommandProcessorResponse run(String command) { SessionState ss = SessionState.get(); command = new VariableSubstitution(new HiveVariableSource() { @Override public Map<String, String> getHiveVariable() {
command = new VariableSubstitution(new HiveVariableSource() { @Override public Map<String, String> getHiveVariable() {
@Override public CommandProcessorResponse run(String command) { SessionState ss = SessionState.get(); command = new VariableSubstitution(new HiveVariableSource() { @Override public Map<String, String> getHiveVariable() {
@Override public CommandProcessorResponse run(String command) { SessionState ss = SessionState.get(); command = new VariableSubstitution(new HiveVariableSource() { @Override public Map<String, String> getHiveVariable() {
command = new VariableSubstitution(new HiveVariableSource() { @Override public Map<String, String> getHiveVariable() {
String propName = varname.substring(SystemVariables.METACONF_PREFIX.length()); HiveConf.ConfVars confVars = getConfVar(propName); Hive.get(ss.getConf()).setMetaConf(propName, new VariableSubstitution(new HiveVariableSource() { @Override public Map<String, String> getHiveVariable() {
@Test public void testVariableSource() throws InterruptedException { final VariableSubstitution variableSubstitution = new VariableSubstitution(new HiveVariableSource() { @Override public Map<String, String> getHiveVariable() { return TestVariableSubstitution.getMySource().map; } }); String v = variableSubstitution.substitute(new HiveConf(), "${a}"); Assert.assertEquals("${a}", v); TestVariableSubstitution.getMySource().put("a", "b"); v = variableSubstitution.substitute(new HiveConf(), "${a}"); Assert.assertEquals("b", v); } }
prompt = new VariableSubstitution(new HiveVariableSource() { @Override public Map<String, String> getHiveVariable() {