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

Basic use of Hive

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly explains "the basic use of Hive". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the basic use of Hive".

Hive has three complex data types: ARRAY, MAP, and STRUCT. ARRAY and MAP are similar to Array and Map in Java, while STRUCT, like Struct in C, encapsulates a collection of named fields, and complex data types allow for any level of nesting.

Create a datasheet

Create table test (name string,friends array,children map,address struct) row format delimited fields terminated by', 'collection items terminated by' _ 'map keys terminated by': 'lines terminated by'\ n

View data structures

Hive (default) > desc test;OKcol_name data_type commentname string friends array children map address struct Time taken: 0.053 seconds, Fetched: 4 row (s)

test data

Liming,zhangsan_lisi,xiao ming:12_xiaoxiao ming:3,haidian_beijingwangwu,zhaoliu_sunba_qianer,xiao wang:18_xiaoxiao wang:9,chao yang_beijing

Load test data

Hive (default) > load data local inpath'/ opt/module/data/people.txt' into table test;Loading data to table default.testTable default.test stats: [numFiles=1, numRows=0, totalSize=141, rawDataSize=0] OKTime taken: 0.354 seconds

View data content

Hive (default) > select * from test;OKtest.name test.friends test.children test.addressliming ["zhangsan", "lisi"] {"xiao ming": 12, "xiaoxiao ming": 3} {"street": "haidian", "city": "beijing"} wangwu ["zhaoliu", "sunba", "qianer"] {"xiao wang": 18, "xiaoxiao wang": 9} {"street": "chao yang", "city": "beijing"} Time taken: 0.069 seconds, Fetched: 2 row (s)

# # Mysql to view the structure of hive table

View the fields of the table

# # loading data into hive

LOAD DATA LOCAL (local files need to add LOCAL) INPATH 'file path' OVERWRITE INTO TABLE table name

Thank you for your reading, the above is the content of "the basic use of Hive", after the study of this article, I believe you have a deeper understanding of the basic use of Hive, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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