有没有办法让Hive以列式方式输出结果,比如MySQL提供的"\ G"选项?
az3*_*az3 20
如果您使用HiveServer2(Hive> 0.14),您可以使用"beeline"shell并且有" vertical"选项.
0: jdbc:hive2://127.0.0.1:10000> !set outputformat table
0: jdbc:hive2://127.0.0.1:10000> select * from sample_07 limit 1;
+-----------------+------------------------+----------------------+-------------------+
| sample_07.code | sample_07.description | sample_07.total_emp | sample_07.salary |
+-----------------+------------------------+----------------------+-------------------+
| 00-0000 | All Occupations | 134354250 | 40690 |
+-----------------+------------------------+----------------------+-------------------+
1 row selected (0.131 seconds)
0: jdbc:hive2://127.0.0.1:10000> !set outputformat vertical
0: jdbc:hive2://127.0.0.1:10000> select * from sample_07 limit 1;
sample_07.code 00-0000
sample_07.description All Occupations
sample_07.total_emp 134354250
sample_07.salary 40690
1 row selected (0.063 seconds)
0: jdbc:hive2://127.0.0.1:10000>
Run Code Online (Sandbox Code Playgroud)