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

Data type of hive

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

1. Basic data type

Because hive is also written in java, its basic data types are roughly the same as those of java:

two。 Basic data type (1) array (array)

Features: the number can be different, but the type is the same.

Example: take the family table (name string familes array) as an example:

# Table creation statement: create table t_family (name string, familes array) row format delimited fields terminated by'\ t 'collection items terminated by','; # query select * from t_family

# query a select name in the array, familes [0] from t_family

(2) map-mapping

Features: key-value can be different, the number can also be different

Data format: zs age:28,salary:20000,address:beijing

# Table creation statement: create table user_info (name string,info map) row format delimieted fields terminated by'\ t 'collection items terminated by', 'map keys terminated by':'# query statement select * from user_info

# query the key values of specific map select name, info ['age'], info [' salary'] from user_info

(3) struct type-object

Features: same number, same type

Example:

Take stu (name, info) as an example

Data format: zss 26, 123456, Shanghai.695

# Table creation statement: `create table stu_info (name string, info struct) row format delimted fields terminated by'\ t 'collection items terminated by', ``# query statement select * from stu_info

# query select name,info.address from stu_info for specific object attributes

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