hive里有两种数据类型即:基本数据类型以及集合数据类型
一、基本数据类型
1,tinyint 1byte有符号整数
2,smalint 2byte有符号整数
3,int 4byte有符号整数
4,bigint 8byte有符号整数
5,boolean 布尔类型,true或者false
6,float 单精度浮点数
7,double 双精度浮点数
8,string 字符序列
9,timestamp 整数,浮点数或者字符串
10,binary 字节数组
二、集合数据类型
1,struct 结构体
2,map
3,array 数组
例子:
create table employees(
name string,
salary float,
subordinates array<string>,
dedections map<string, float>,
address struct<street:string, city:string, state:string, zip:int>
);
在hive中执行时出现如下错误:
Specified key was too long; max key length is 767 bytes
查了一圈网上答案,改为
mysql > alter database hive character set latin1;
但有人说这会影响中文插入数据库,目前还不得而知。