Hive 支持的数据类型
Hive 支持原始数据类型和复杂数据类型, 原始数据类型包含数值型/Boolean/字符串/时间戳,复杂数据类型包含 map/struct/array/union
Hive 支持的原始数据类型
Hive 支持的复杂树类型
说明:
- 对于整数类型数据,默认为int类型,如果需要使用其他整数类型,需要在数据上通过Y/S/L来进行标识。小数的默认类型是double,任意数值类型都可以隐式地转换成更宽的数据类型和文本类型
- 文本类型,string 类型不固定长度数据类型,已经为大家精心准备了大数据的系统学习资料,从Linux-Hadoop-spark-......,需要的小伙伴可以点击理论上最大存储2G。varchar 的长度不超过65535,超过则会被截断。char 用来存储固定长度的数据,最大长度为255。
- 对于复杂数据类型,访问方式也是同数据/map/struct的访问方式一样。
建表示例:create table if not exists db_dev.tb_hive_example(fd1 tinyint,fd2 smallint,fd3 int,fd40 bigint,fd4 float,fd5 double,fd6 decimal,fd7 boolean,fd8 string,fd9 varchar(10),fd10 char(10),fd11 timestamp,fd12 date,fd13 array<string>,fd14 map<string,int>,fd15 struct<id:int,name:string>) row format delimited fields terminated by "|" collection items terminated by "," map keys terminated by "," lines terminated by "\n";show create table tb_hive_example;CREATE TABLE `tb_hive_example`( `fd1` tinyint, `fd2` smallint, `fd3` int, `fd40` bigint, `fd4` float, `fd5` double, `fd6&#