zoukankan      html  css  js  c++  java
  • hive命令行 显示字段名配置

    在hive查询中我们发现hive的查询输出不显示列名,怎么解决呢?

    解决办法:进入hive cli后: set hive.cli.print.header=true;

    hive> select * from ratings limit 5;
    OK
    ratings.userid	ratings.movieid	ratings.rating	ratings.timestamped
    1	1193	5.0	978300760
    1	661	3.0	978302109
    1	914	3.0	978301968
    1	3408	4.0	978300275
    1	2355	5.0	978824291
    Time taken: 0.1 seconds, Fetched: 5 row(s)

     

    此时显示的字段名带表名,可读性很差,继续在hive cli中:set hive.resultset.use.unique.column.names=false;

    hive> set hive.resultset.use.unique.column.names=false;
    hive> select * from ratings limit 5;
    OK
    userid	movieid	rating	timestamped
    1	1193	5.0	978300760
    1	661	3.0	978302109
    1	914	3.0	978301968
    1	3408	4.0	978300275
    1	2355	5.0	978824291
    Time taken: 0.103 seconds, Fetched: 5 row(s)

    OK!!!

    因为在cli中set配置属性只是当次有效,如果想永久配置的话,将上述命令配置到hive/conf下的配置文件中,或者配置到hiverc文件里,因为每次CLI启动时,在提示符出现之前,Hive会自动在HOME目录下查找名为.hiverc的文件,而且执行这个文件中的所有命令。非常适合做初始化,所以有些关于hive的初始化设置可以配置到家目录下的.hiverc文件里。

  • 相关阅读:
    Zoundry Raven测试
    asp.net 异步加载?
    网页数据表格自动填充序号
    1.JSP
    C#基础之CLR的执行模型(二)
    C#基础之CLR的执行模型(一)
    java提供类与cglib包实现动态代理
    CSS初窥...
    Go的牛逼之处
    Go灵魂级选手之流程控制
  • 原文地址:https://www.cnblogs.com/sunpengblog/p/11880556.html
Copyright © 2011-2022 走看看