我正在尋找一種方法來從hiveconf
變量字符串中刪除引號,以便我可以將其用作表名的一部分:如何將字符串設置爲hiveconf變量轉換爲可用作表名的一部分的對象
Basicaly,我有一些像
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;
但有一些優雅的方式如何只使用一個變量,一旦爲一個字符串,一旦作爲表名的一部分嗎?
我知道我可以這樣做:'設置變量= 123;'然後'選擇 '{hiveconf:變量}' 從表_ $ {hiveconf:變量};',但如何走另一條路回合? – ira
這是一個不好的例子,因爲'select 123'和'select'123''''' –