gpt4 book ai didi

mysql - 如何漂亮地打印 Hive 输出

转载 作者:可可西里 更新时间:2023-11-01 07:48:13 25 4
gpt4 key购买 nike

如何让 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 这样的扩展 View 。

最佳答案

使用

set hive.cli.print.header=true;

打印列名 [1]。

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

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

关于mysql - 如何漂亮地打印 Hive 输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18625959/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com