当前位置:  开发笔记 > 后端 > 正文

如何打印Hive输出

如何解决《如何打印Hive输出》经验,为你挑选了1个好方法。

我如何让Hive打印出格式精美的结果,列名和空间,如mysql?例如:

$ hive -f performanceStatistics.hql
...
Kill Command = /usr/lib/hadoop/bin/hadoop job  -kill job_201306211023_1053
Hadoop job information for Stage-1: number of mappers: 8; number of reducers: 1
2013-09-04 17:30:56,092 Stage-1 map = 0%,  reduce = 0%
2013-09-04 17:31:03,132 Stage-1 map = 25%,  reduce = 0%, Cumulative CPU 13.87 sec
...
MapReduce Total cumulative CPU time: 2 minutes 5 seconds 260 msec
Ended Job = job_201306211023_1053
MapReduce Jobs Launched:
Job 0: Map: 8  Reduce: 1   Cumulative CPU: 125.26 sec   HDFS Read: 1568029694 HDFS Write: 93 SUCCESS
Total MapReduce CPU Time Spent: 2 minutes 5 seconds 260 msec
OK
19.866045211878546  0.023310810810810812    10  0   824821  25  1684.478659112734   0.16516737901191694
Time taken: 34.324 seconds

如何使用列名和良好的间距获得结果?我还想在PostgreSQL中有一个像mysql\G或\ x这样的扩展视图.



1> jkovacs..:

使用

set hive.cli.print.header=true;

打印列名[1].

至于间距,输出已经是制表符分隔的,所以你如何进一步处理它取决于你.

[1] https://cwiki.apache.org/confluence/display/Hive/Configuration+Properties#ConfigurationProperties-CommandLineInterface

推荐阅读
手机用户2502851955
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有