有没有办法将hive CLI中多个配置单元查询的输出导出到shell脚本?
目前,我有一个shell脚本,其中有多个配置单元查询,我将触发:
VAR1=`hive -e "select count(*) from table1;"`
VAR2=`hive -e "select count(*) from table2;"`
VAR3=`hive -e "select count(*) from table3;"`
这将在单独的配置单元会话中运行所有查询,这将导致它等待纱线中的资源。相反,我想在同一个hive会话中运行它们
`hive -e "select count(*) from table1;select count(*) from table2;select count(*) from table3;"`
并将传递给shell脚本的输出转换为VAR1,VAR2& VAR3。可能吗?
答案 0 :(得分:2)
尝试子查询
select c1.*, c2.*, c3.* from
(select count(*) from table1) c1,
(select count(*) from table2) c2,
(select count(*) from table3) c3;