将同一配置单元会话中的多个查询输出导出到 shell 脚本?

Export multiple output of queries in the same hive session to shell script?

有没有办法将 Hive CLI 中多个 Hive 查询的输出导出到 shell 脚本?

目前,我有 shell 个脚本,其中我触发了多个配置单元查询:

VAR1=`hive -e "select count(*) from table1;"`
VAR2=`hive -e "select count(*) from table2;"`
VAR3=`hive -e "select count(*) from table3;"`

这将 运行 单独的配置单元会话中的所有查询,这将导致它等待 yarn 中的资源。相反,我想 运行 它们在同一个配置单元会话中

`hive -e "select count(*) from table1;select count(*) from table2;select count(*) from table3;"`

并将传递给 shell 脚本的输出转换为 VAR1、VAR2 和 VAR3。可能吗?

尝试子查询

select c1.*, c2.*, c3.* from 
(select count(*) from table1) c1, 
(select count(*) from table2) c2, 
(select count(*) from table3) c3;