Is there a way to get Hive to output the results in a columnar-fashion, like the "\G" option available from MySQL?
是否有一种方法可以让Hive以一种列的方式输出结果,就像MySQL中提供的“\G”选项一样?
http://dev.mysql.com/doc/refman//5.5/en/mysql-commands.html
http://dev.mysql.com/doc/refman//5.5/en/mysql-commands.html
2 个解决方案
#1
17
If you use HiveServer2 (Hive > 0.14), you can use "beeline" shell and there is "vertical
" option.
如果您使用HiveServer2 (Hive > 0.14),您可以使用“beeline”shell,并且有“垂直”选项。
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>
#2
3
No there are no such facility in hive.
在蜂巢里没有这样的设施。
The result of map-reduce programs are always displayed row by row.
map-reduce程序的结果总是逐行显示。
How ever, you can use Hive/Thrift server and write your hive queries though other scripting language like python and control the display of output. Only disadvantage is that you will have to parse the output and then display it.
无论如何,您可以使用Hive/Thrift服务器并编写您的Hive查询,尽管其他脚本语言如python和控制输出的显示。唯一的缺点是必须解析输出,然后显示它。
#1
17
If you use HiveServer2 (Hive > 0.14), you can use "beeline" shell and there is "vertical
" option.
如果您使用HiveServer2 (Hive > 0.14),您可以使用“beeline”shell,并且有“垂直”选项。
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>
#2
3
No there are no such facility in hive.
在蜂巢里没有这样的设施。
The result of map-reduce programs are always displayed row by row.
map-reduce程序的结果总是逐行显示。
How ever, you can use Hive/Thrift server and write your hive queries though other scripting language like python and control the display of output. Only disadvantage is that you will have to parse the output and then display it.
无论如何,您可以使用Hive/Thrift服务器并编写您的Hive查询,尽管其他脚本语言如python和控制输出的显示。唯一的缺点是必须解析输出,然后显示它。