您的位置:首页 > 其它

hive查询如何显示查询的字段

2017-10-01 21:37 225 查看
实际查询中
hive >select id ,name from db_hive.student; 结果是这样的

11111 lisi
22222 wangwu
33333 zhaoxi11111

但是我们想查询出来的结果 有对应字段的意义 id , name

 
id	name
11111	lisi
22222	wangwu
33333	zhaoxi11111

这里只需要在 hive-site.xml 中配置 :

<property>
<name>hive.cli.print.header</name>
<value>true</value>
<description>Whether to print the names of the columns in query output.</description>
</property>

<property>
<name>hive.cli.print.current.db</name>
<value>true</value>
<description>Whether to include the current database in the Hive prompt.</description>
</property>

然后重新启动hive ,发现多一个(default),它是hive.cli.print.current.db 配置的结果。
再查询时,就可以得到结果,就有对应的字段信息 id , name
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: