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

Several ways to execute hive in HIVE and an example analysis of several ways to save HIVE locally

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Today, I will talk to you about several ways to implement hive in HIVE and the example analysis of several ways to save HIVE locally. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

Several ways for HIVE- to execute hive, and several ways to save HIVE locally

There are many online-related tutorials, here I am mainly a brief summary of several commonly used methods to facilitate future inquiry.

First, directly through the hive-e command in bash, and use the > output stream to output the execution results to the formulation file hive-e "select * from student where sex = 'male'" > / tmp/output.txt, and execute one or more sql statements in the file directly through the hive-f command in bash. And use > output stream to output the execution result to the formulation file hive- f exer.sql > / tmp/output.txt file content select * from student where sex = 'male'; the third kind of select count (*) from student;, enter the hive-sql statement in hive, by using the INSERT OVERWRITE LOCAL DIRECTORY result to the local system and the HDFS file system

The syntax is the same, but the path is different.

Insert overwrite local directory "/ tmp/out" > select cno,avg (grade) from sc group by (cno); there are more than three kinds of insert overwrite directory 'hdfs://server71:9000/user/hive/warehouse/mystudent'select * from student1;, including 3 methods to execute hive-sql. The first two methods that save the results locally belong to linxu BASH's native methods. The third is HIVE's own way of exporting data. The fourth is the basic SQL syntax, which extracts data from one table and inserts it directly into another table. Just refer to the SQL syntax. Insert overwrite table student3 select sno,sname,sex,sage,sdept from student3 where year='1996'; after reading the above, do you have any further understanding of the sample analysis of several ways to execute hive in HIVE and several ways to save HIVE locally? If you want to know more knowledge or related content, 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

Development

Wechat

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

12
Report