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

Example Analysis of hive1.1.0

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article will explain the example analysis of hive1.1.0 for you in detail. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

MySQL-server-5.1.73-1.glibc23.i386.rpm

MySQL-client-5.1.73-1.glibc23.i386.rpm

1 derby single connection

/ bin starts hive, the library is automatically generated, but only one connection is supported, so you can start hive in other folders, but this is another library

Show databases

Create table user (id int, name string)

Show tables

Show create table user

Load data local inpath'/ root/user.txt' into table user;-after execution, you cannot select it. You need to specify the delimiter in the file.

Select count (*) from user

Create table role (id bigint, name string) row format delimited fileds terminated by'\ t'

Install mysql

"linux system installation mysql"

MySQL-server-5.1.73-1.glibc23.i386.rpm

MySQL-client-5.1.73-1.glibc23.i386.rpm

1 installed through rpm source code, the download file is small, but there are too many dependent packages, so it is not recommended

2 through binary installation, the download file is large, but the installation is fast, recommended

Mirror: http://mysql.mirror.kangaroot.net/Downloads/

Tar-zxvf mysql-5.1.72

Cp mysql-5.1.72 / usr/local/mysql-r

Delete the folder used when derby

Linux:

Hadoop fs-rmr / usr/hive

Mv hive-default.xml.template hive-site.xml

Managed table

Hive:

Create table user (id int, name string)

Mysql:

Tables created by TBLS-hive are defined here

CLOUMNS_V2-literal field

SDS-location on the hdfs

Hive:

Create table role (id bigint, name string) row format limited fields terminited by'\ t'

External table (data first, then table)

Query hdfs in hive

Hive: (operate hdfs in hive)

Dfs-fs /

Dfs-mkdir / data

Dfs-put / root/user.txt / data/user.txt

Create external table ext_user (id int, name string) row format delimited fields termited by'\ t 'location' / data'

No matter the internal table or external table, you can just put it under the corresponding folder.

Create table sms (id bigint, content string, area string) partitioned by (area_par string) row format delimited fileds terminated by'\ t'

Create table trade_detail (id bigint, account string, income double, expense double, time string) row format delimited fields terminated by't'

Create table user_info (id int, account string, name string, age int) row format delimited fields terminated by'\ t'

Sqoop is imported from mysql to hive

Execute the associated query between trade_detail and user_info under hive

UDF

Extends UDF

Define evaluate function

Add jar: add jar * .jar

Create a temporary function: create temporary function toUpper as' net.oschina.udf.ToUpperUDF'

This is the end of this article on "sample Analysis of hive1.1.0". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

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

Servers

Wechat

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

12
Report