Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does hive display the current database name

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Hive how to display the current database name, many novices are not very clear, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

When hive CLI starts, the file .hiverc is executed first before the hive > prompt appears, and Hive automatically looks for a file named .hiverc in the ${HIVE_HOME} / bin directory, so you can set and configure some common parameters in this file. Since it is a hidden file, we can use Linux's ls-a command to view it.

Write .hiverc, refer to the link, and put it on $HOME/.hiverc or $HIVE_HOME/bin/.hiverc

Putting the global hiverc in $HIVE_HOME/bin/.hiverc is deprecated. Please use $HIVE_CONF_DIR/.hiverc instead

# display the current database name on the command line set hive.cli.print.current.db=true; # query results display the column name set hive.cli.print.header=true; # enable bucket table set hive.enforce.bucketing=true; # compress the intermediate result set hive.exec.compress.intermediate=true of hive # use BZip2 Encoder / Decoder set mapred.map.output.compression.codec=org.apache.hadoop.io.compress.BZip2Codec; # Compression hive output set hive.exec.compress.output=true; # for MR output content in hive use BZip2 Encoder / Decoder set mapred.output.compression.codec=org.apache.hadoop.io.compress.BZip2Codec # Let hive try local mode query instead of mapred mode set hive.exec.mode.local.auto=true;Wednesday, August 28, 2013Apache Hive: The .hiverc fileWhat is .hiverc file?It is a file that is executed when you launch the hive shell-making it an ideal place for adding any hive configuration/customization you want set, on start of the hive shell. This could be:- Setting column headers to be visible in query results- Making the current database name part of the hive prompt- Adding any jars or files- Registering UDFs.hiverc file locationThe file is loaded from the hive conf directory.I have the CDH4.2 distribution and the location is: / etc/hive/conf.cloudera.hive1If the file does not exist, you can create it.It needs to be deployed to every node from where you might launch the Hive shell. [Note: I had to create the file The distribution did not come with it.] Sample .hivercadd jar / home/airawat/hadoop-lib/hive-contrib-0.10.0-cdh5.2.0.jar;set hive.exec.mode.local.auto=true;set hive.cli.print.header=true;set hive.cli.print.current.db=true;set hive.auto.convert.join=true;set hive.mapjoin.smalltable.filesize=30000000; query information display configuration

1) add the following configuration information to the hive-site.xml file to display the current database and query the header information configuration of the table.

Hive.cli.print.header true hive.cli.print.current.db true

2) restart hive to compare the differences before and after configuration.

Before configuration:

After configuration:

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report