标签:
Hive supports primitive and complex data types, as described below. See Hive Data Types for additional information.
Hive支持原生和复杂数据类型。
原生数据类型
The Types are organized in the following hierarchy (where the parent is a super type of all the children instances):
数据类型层次关系:
Primitive Type |
Number |
DOUBLE |
FLOAT |
BIGINT |
INT |
SMALLINT |
TINYINT |
STRING |
BOOLEAN |
This type hierarchy defines how the types are implicitly converted in the query language. Implicit conversion is allowed for types from child to an ancestor. So when a query expression expects type1 and the data is of type2, type2 is implicitly converted to type1 if type1 is an ancestor of type2 in the type hierarchy. Note that the type hierarchy allows the implicit conversion of STRING to DOUBLE.
在SQL中可进行类型转换,但是只能是子数据类型转换成祖先数据类型。另外,字符串类型也可以转为Double类型
Explicit type conversion can be done using the cast operator as shown in the #Built In Functions section below.
复杂数据类型
Complex Types can be built up from primitive types and other composite types using:
复杂数据类型支持:Structs,Maps,Arrays 三种。并且可以嵌套使用。
Using the primitive types and the constructs for creating complex types, types with arbitrary levels of nesting can be created. For example, a type User may comprise of the following fields:
https://cwiki.apache.org/confluence/display/Hive/Tutorial
[Hive-Tutorial] Type System 数据类型
标签:
原文地址:http://www.cnblogs.com/xiejin/p/4243767.html