普通数据类型
复杂数据类型
Complex Type Constructors
Constructor Function | Operands | Description |
---|---|---|
map | (key1, value1, key2, value2, ...) | Creates a map with the given key/value pairs. |
struct | (val1, val2, val3, ...) | Creates a struct with the given field values. Struct field names will be col1, col2, .... |
named_struct | (name1, val1, name2, val2, ...) | Creates a struct with the given field names and values. (As of Hive 0.8.0.) |
array | (val1, val2, ...) | Creates an array with the given elements. |
create_union | (tag, val1, val2, ...) | Creates a union type with the value that is being pointed to by the tag parameter. |
Operators on Complex Types
Operator | Operand types | Description |
---|---|---|
A[n] | A is an Array and n is an int | Returns the nth element in the array A. The first element has index 0. For example, if A is an array comprising of ['foo', 'bar'] then A[0] returns 'foo' and A[1] returns 'bar'. |
M[key] | M is a Map<K, V> and key has type K | Returns the value corresponding to the key in the map. For example, if M is a map comprising of {'f' -> 'foo', 'b' -> 'bar', 'all' -> 'foobar'} then M['all'] returns 'foobar'. |
S.x | S is a struct | Returns the x field of S. For example for the struct foobar {int foo, int bar}, foobar.foo returns the integer stored in the foo field of the struct. |