在Hive中执行任何查询时,是否有任何方法可以获得列名和输出? [英] Is there any way to get the column name along with the output while execute any query in Hive?

查看:621
本文介绍了在Hive中执行任何查询时,是否有任何方法可以获得列名和输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Hive中,当我们做一个查询时(例如: select * from employee ),我们不会在输出中获得任何列名称(如姓名,年龄,薪水我们将获得 RDBMS SQL ),我们只获取值。



有没有什么办法让列名一起显示如果我们想要查看HiveQl中表的列名,那么下面的代码可以使用输出:

解决方案

hive conf属性应该设置为true。

  hive>设置hive.cli.print.header = true; 

如果您希望始终查看列名,请使用上述方法更新$ HOME / .hiverc文件设置在第一行。



- Hive会自动在您的HOME目录中查找名为.hiverc的文件,并运行它包含的命令(如果有的话)

In Hive, when we do a query (like: select * from employee), we do not get any column names in the output (like name, age, salary that we would get in RDBMS SQL), we only get the values.

Is there any way to get the column names to be displayed along with the output when you execute any query?

解决方案

If we want to see the columns names of the table in HiveQl, the following hive conf property should be set to true.

hive> set hive.cli.print.header=true;

If you prefer to see the column names always then update the $HOME/.hiverc file with the above setting in the first line..

--Hive automatically looks for a file named .hiverc in your HOME directory and runs the commands it contains, if any

这篇关于在Hive中执行任何查询时,是否有任何方法可以获得列名和输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆