RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
Hive数据类型有哪些

这篇文章将为大家详细讲解有关Hive数据类型有哪些,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

创新互联是专业的承留网站建设公司,承留接单;提供网站设计、做网站,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行承留网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!

hive 目前支持的数据类型如下:

-- 数值类型 Numeric Types
TINYINT (1-byte signed integer, from -128 to 127)
SMALLINT (2-byte signed integer, from -32,768 to 32,767)
INT/INTEGER (4-byte signed integer, from -2,147,483,648 to 2,147,483,647)
BIGINT (8-byte signed integer, from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807)
FLOAT (4-byte single precision floating point number)
DOUBLE (8-byte double precision floating point number)
DOUBLE PRECISION (alias for DOUBLE, only available starting with Hive 2.2.0)
DECIMAL
Introduced in Hive 0.11.0 with a precision of 38 digits
Hive 0.13.0 introduced user-definable precision and scale
NUMERIC (same as DECIMAL, starting with Hive 3.0.0)

--日期/时间类型 Date/Time Types
TIMESTAMP (Note: Only available starting with Hive 0.8.0)
DATE (Note: Only available starting with Hive 0.12.0)
INTERVAL (Note: Only available starting with Hive 1.2.0)

--字符类型 String Types
STRING
VARCHAR (Note: Only available starting with Hive 0.12.0)
CHAR (Note: Only available starting with Hive 0.13.0)

Misc Types
BOOLEAN
BINARY (Note: Only available starting with Hive 0.8.0)

--复杂类型 Complex Types
arrays: ARRAY (Note: negative values and non-constant expressions are allowed as of Hive 0.14.)
maps: MAP (Note: negative values and non-constant expressions are allowed as of Hive 0.14.)
structs: STRUCT
union: UNIONTYPE (Note: Only available starting with Hive 0.7.0.)

例子:

1)Array数组
数据类型相同的元素集合。

hive>create table student 
(sid int, 
sname string, 
grade array); 
其中array代表各科成绩,比如:
{1,YY,[80,100,90]}

2)Map
key和value对:

hive>create table student2 
(sid int, 
sname string, 
grade map); 
其中map指的是学科对应的成绩,比如:
{1,yy,<'English',90>}
上面的array和map可以组合起来使用,一个人的各科成绩:

hive> create table student3 
(sid int, 
sname string, 
grades array>); 
{1,'yy',[<'English',80>,<'English3',90>]}

3)struct
结构体:

hive>create table student4 
(sid int, 
info struct); 
比如:
{1,{'yy',20,'male'}}

关于“Hive数据类型有哪些”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。


本文标题:Hive数据类型有哪些
当前网址:http://sczitong.cn/article/poehpj.html