hive的数据类型篇
hive的内置数据类型可分为两大类:
1.基础数据类型
2.复杂数据类型
基础类型有:
tinyint,smallint,int,bigint,boolean,float,double,string,binary,timestamp,decimal,char,varchar,date。
数据类型表
| 归属类型 | 数据类型 | 数据长度 |
|---|---|---|
| Numeric Types(数字类型) | tinyint | 1byte,-128~127 |
| Numeric Types(数字类型) | smallint | 2byte,-32768~32767 |
| Numeric Types(数字类型) | int/integer | 4byte,-2147483648 ~ 2147483647 |
| Numeric Types(数字类型) | bigint | 8byte,-9223372036854775808 ~ 9223372036854775807 |
| Numeric Types(数字类型) | float | 4byte单精度 |
| Numeric Types(数字类型) | decimal | 在hive 0.11.0中引入,精度38位。在hive0.13.0中引入了用户自定义精度和规模 |
| Numeric Types(数字类型) | numeric | same as decimal |
| Numeric Types(数字类型) | double | 8byte单精度 |
| Date/Time Types(时间类型) | timestamp | 从hive0.8.0开始使用 |
| Date/Time Types(时间类型) | date | 从hive0.12.0开始使用 |
| Date/Time Types(时间类型) | interval | 从hive0.12.0开始使用 |
| String Types(字符串类型) | string | 从hive0.8.0开始使用 |
| String Types(字符串类型) | char | 从Hive0.8.3开始支持 |
| String Types( |

本文介绍了Hive的复杂数据类型,包括Array、Map和Structs的使用。讲解了如何创建包含复杂类型的表,以及如何查询和操作这些数据。特别提到了explode和lateral view关键字在查询中的应用,以及collect_set函数在去重汇总数据方面的功能。
最低0.47元/天 解锁文章
421

被折叠的 条评论
为什么被折叠?



