欢迎您光临本小站。希望您在这里可以找到自己想要的信息。。。

Hive query results in vertical format like MySQL’s “\G”? 开启列展示

大数据云计算 water 3264℃ 0评论

  1. set hive.cli.print.header=true;  // 打印列名 

  2. set hive.cli.print.row.to.vertical=true;   // 开启行转列功能, 前提必须开启打印列名功能 

  3. set hive.cli.print.row.to.vertical.num=1; // 设置每行显示的列数 

或者

If you use HiveServer2 (Hive > 0.14), you can use "beeline" shell and there is "vertical" option.

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>

转载请注明:学时网 » Hive query results in vertical format like MySQL’s “\G”? 开启列展示

喜欢 (0)or分享 (0)

您必须 登录 才能发表评论!