【十九】hive数据类型

普通数据类型

复杂数据类型

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.

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值