Hive 0.13 数据类型
来源:互联网 发布:哪个会计从业软件好 编辑:程序博客网 时间:2024/06/06 04:19
hive支持的数据类型路下
数值类型 Numeric Types
TINYINT
(1字节,数据范围:-128
to127
)SMALLINT
(2字节,数据范围:-32,768
to32,767
)INT
(4字节,数据范围:-2,147,483,648
to2,147,483,647
)BIGINT
(8字节,数据范围:-9,223,372,036,854,775,808
to9,223,372,036,854,775,807
)FLOAT
(4字节, 单精度浮点数)DOUBLE
(8字节,双精度浮点数)DECIMAL
- Introduced in Hive 0.11.0 with a precision of 38 digits
- Hive 0.13.0 introduced user definable precision and scale
日期/时间类型 Date/Time Types
TIMESTAMP
(Hive 0.8.0以上支持)DATE
(Hive 0.12.0以上支持)
字符串类型 String Types
STRING
VARCHAR
(Hive 0.12.0以上支持)CHAR
(Hive 0.13.0以上支持)
Misc Types
BOOLEAN
BINARY
(Hive 0.8.0以上支持)
复合类型 Complex Types
- arrays:
ARRAY<data_type>
- maps:
MAP<primitive_type, data_type>
- structs:
STRUCT<col_name : data_type [COMMENT col_comment], ...>
- union:
UNIONTYPE<data_type, data_type, ...>
(Hive 0.7.0以上支持)
列类型 Column Types
Integral Types (TINYINT
, SMALLINT
, INT
, BIGINT
)
数值类型默认是int,如果数值超出int的范围,就会被解释为bigint。
数值后面加上后缀表示:
Type
Postfix
Example
TINYINT
Y
100Y
SMALLINT
S
100S
BIGINT
L
100L
Strings
字符串可以用单引号(')或双引号(“)。Hive在字符串中使用C-Style的转义。
Varchar
Varchar types 创建的长度是 ( 1 到 65355), 在字符串中容许使用最大数量的字符. 如果string类型转换成varchar类型, 长度超过了最大值,将会被截断。 字符长度是由字符串所包含的数量决定.
Char
最大固定长度255.
Timestamps
支持传统的unix时间戳,可选的纳秒级精度。
支持的转换:
- 整型数值类型:解读为以秒为单位的UNIX时间戳
- 浮动点数值类型:解读为以秒和小数精度为单位的UNIX时间戳
- 字符串:JDBC兼容的java.sql.Timestamp格式“YYYY-MM-DD HH:MM:SS.fffffffff”(9位小数位精度)
所有现有datetime的UDF(月,日,年,小时,等)可以工作于TIMESTAMP数据类型。
Dates
日期值描述一个特定的年/月/日的{ { YYYY - MM - DD } }.
例, DATE '2013-01-01'. Date 类型没有时间.
Date 类型支持的范围是是 0000-01-01 to 9999-12-31, 依赖于原始的Java支持的日期类型.
转换 Dates
Date类型能和 Timestamp, String互相转换.
Valid casts to/from Date type
Result
cast(date as date)
Same date value
cast(timestamp as date)
The year/month/day of the timestamp is determined, based on the local timezone, and returned as a date value.
cast(string as date)
If the string is in the form 'YYYY-MM-DD', then a date value corresponding to that year/month/day is returned. If the string value does not match this formate, then NULL is returned.
cast(date as timestamp)
A timestamp value is generated corresponding to midnight of the year/month/day of the date value, based on the local timezone.
cast(date as string)
The year/month/day represented by the Date is formatted as a string in the form 'YYYY-MM-DD'.
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Types
- Hive 0.13 数据类型
- hive数据类型
- hive数据类型
- hive 数据类型
- hive 数据类型
- Hive数据类型
- Hive数据类型
- Hive数据类型
- Hive数据类型
- hive数据类型
- Hive数据类型
- Hive数据类型
- Hive数据类型
- hive数据类型
- Hive学习之Hive数据类型
- hive学习 hive中的数据类型
- Hive学习之Hive数据类型
- hive数据类型和文件格式
- 常用排序算法小结(附Java实现)
- <mvc:annotation-driven />注解的理解
- Linux 信号signal处理机制
- Oracle数据库设计字段类型选择错误的隐患
- 从零开始学android<Intent进阶.四十一.>
- Hive 0.13 数据类型
- tar命令的详细解释
- hibernate中inverse=true的使用
- 字符串转换成整数
- addslashes与mysql_real_escape_string的区别
- Handler sendMessage 与 obtainMessage (sendToTarget)比较
- Stick
- Python习题
- ORACLE自动断开数据库连接解决办法