如何将设置为 hiveconf 变量的字符串转换为可用作 table 名称一部分的对象
How to convert string set to hiveconf variable to an object usable as part of a table name
我正在寻找一种从 hiveconf
变量字符串中删除引号的方法,以便我也可以将其用作 table 名称的一部分:
基本上,我有类似的东西
set sub_name = "123";
select ${hiveconf:sub_name} from table_${hiveconf:sub_name};
执行时我需要它像这样工作:
select "123" from table_123;
为此,我可以 运行 使用类似的东西:
set variable = "123";
set table_subname = 123;
select ${hiveconf:variable} from table_${hiveconf:table_subname};
这将作为
select "123" from table_123;
但是有没有一些优雅的方法来使用一个变量,一次作为字符串,一次作为 table 名称的一部分?
hive> create table table_abc as select 'X' as x;
OK
x
hive> set sub_name=abc;
hive> select "${hiveconf:sub_name}" from table_${hiveconf:sub_name};
OK
_c0
abc
我正在寻找一种从 hiveconf
变量字符串中删除引号的方法,以便我也可以将其用作 table 名称的一部分:
基本上,我有类似的东西
set sub_name = "123";
select ${hiveconf:sub_name} from table_${hiveconf:sub_name};
执行时我需要它像这样工作:
select "123" from table_123;
为此,我可以 运行 使用类似的东西:
set variable = "123";
set table_subname = 123;
select ${hiveconf:variable} from table_${hiveconf:table_subname};
这将作为
select "123" from table_123;
但是有没有一些优雅的方法来使用一个变量,一次作为字符串,一次作为 table 名称的一部分?
hive> create table table_abc as select 'X' as x;
OK
x
hive> set sub_name=abc;
hive> select "${hiveconf:sub_name}" from table_${hiveconf:sub_name};
OK
_c0
abc