是否可以在中運行此類內容Hive CLI?運行os命令並將其設置爲配置單元變量
我想將文件內容作爲變量傳遞給另一個查詢。
set column_list=!cat /home/user/filename.lst ;
create table tabname as select $column_list from ...
是否可以在中運行此類內容Hive CLI?運行os命令並將其設置爲配置單元變量
我想將文件內容作爲變量傳遞給另一個查詢。
set column_list=!cat /home/user/filename.lst ;
create table tabname as select $column_list from ...
,如果你有一個查詢文件傳遞的變量作爲hiveconf 蜂巢-hiveconf VAR1 = ABCD -f file.txt的
,或者您可以構建您的查詢,然後將它傳遞使用蜂巢CLI - Ë 蜂巢-e 「創建表...」
文件filename.lst
line
使文件test.sh,
temp=$(cat /home/user/filename.lst)
hive -f test.hql -hiveconf var=$temp
做出另一個文件test.hql
create table test(${hiveconf:var} string);
上終端
sh -x test.sh
它將線路傳遞給test.hql,它會創建一個錶行作爲列;
注意 - 所有文件應該在同一個目錄中。此腳本僅傳遞一個變量。