HIVE数据类型
毕竟HIVE穿着SQL的外壳,肯定支持诸如Mysql这种RDBMS的数据类型,如int,varchar,但是它还具有非常多自有的数据类型,包括复杂的数据类型(数组,Map等)也是支持的!
数字类型,日期类型,String类型,Boolean类型我们都是比较熟悉的,也比较简单,就不讲解了。演示一下复杂数据类型:
Array类型
hive (hive)> create table arraytest (id int,course array)
> row format delimited fields terminated by','
> collection items terminated by':';
row format delimited fields terminated by是指定列与列之间的分隔符,此处为”,”
collection items terminated by是指定集合内元素之间的分隔符,此处为”:”
因此我们要导入到hive中的数据应该是形如:
1,math:chinese
2,english:history
查询HIVE中的数据