hive中的复合数据类型

  • Array

array中的数据为相同类型,例如,假如array A中元素['a','b','c'],则A[1]的值为'b'

数据结构如下:
zhangsan beijing,shanghai,tianjin,hangzhou
wangwu shanghai,chengdu,wuhan,haerbin create table complex_array(name string,work_locations array<string>) row format delimited fields terminated by '\t' collection items terminated by ','; load data local inpath '/home/work/data/test1.txt' into table complex_array;
  • Map

可以通过["指定key名称"]访问

1,zhangsan,唱歌:非常喜欢-跳舞:喜欢-游泳:一般般
2,lisi,打游戏:非常喜欢-篮球:不喜欢 create table complex_map(id int,name string,hobby map<string,string>)
row format delimited
fields terminated by ','
collection items terminated by '-'
map keys terminated by ':'; load data local inpath '/root/hivedata/complex_map.txt' into table complex_map; 以普通字符串映射:
create table complex_map_s(id int,name string,hobby string)
row format delimited
fields terminated by ',';
  • Struct

集合元素可以类型不一样

例如c的类型为STRUCT{a INT; b INT},我们可以通过c.a来访问域a

1,zhou:30
2,yan:30
3,chen:20
4,li:80 create table complex_struct(id int, info struct<name:STRING, age:INT>)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
COLLECTION ITEMS TERMINATED BY ':'; load data local inpath '/home/work/data/test3.txt' into table complex_struct; select info.age from complex_struct;

  

hive的复合数据类型的更多相关文章

  1. ElasticSearch入门 第六篇:复合数据类型——数组,对象和嵌套

    这是ElasticSearch 2.4 版本系列的第六篇: ElasticSearch入门 第一篇:Windows下安装ElasticSearch ElasticSearch入门 第二篇:集群配置 E ...

  2. [日常] Go语言圣经--复合数据类型,数组习题

    go语言圣经-复合数据类型 1.以不同的方式组合基本类型可以构造出来的复合数据类型 2.四种类型——数组.slice.map和结构体 3.数组是由同构的元素组成——每个数组元素都是完全相同的类型——结 ...

  3. 【Oracle】Oracle中复合数据类型

    1,常见的操作数据库的技术有那些 jdbc     使用java 访问数据库的技术    PLSQL  (procedure  过程化sql) 在数据库内部操作数据的技术    proc/c++    ...

  4. hive与hbase数据类型对应关系

    hive与hbase数据类型对应关系 当hbase中double,int 类型以byte方式存储时,用字符串取出来必然是乱码. 在hivd与hbase整合时也遇到这个问题:做法是:#b 1.加#b C ...

  5. Go语言入门篇-复合数据类型

    复合数据类型 主要讨论四种类型——数组.slice.map和结构体 数组和结构体聚合类型   --数组和结构体都是有固定内存大小的数据结构 --数组:由同构的元素组成——每个数组元素都是完全相同的类型 ...

  6. C/C++知识总结 五 复合数据类型 壹(数组、字符串与string、结构)

    C/C++复合数据类型 壹(数组.结构) 数组 数组的意义.定义与创建 一.二维数组应用 字符数组与字符串处理函数 数组与指针---关系密切 数组的意义与定义创建 意义:反映数据间的特点(通过把同一类 ...

  7. Verilog缺少一个复合数据类型,如C语言中的结构体

    https://mp.weixin.qq.com/s/_9UsgUQv-MfLe8nS938cfQ Verilog中的数据类型(Data Type)是分散的,缺少一个复合数据类型:把多个wire, r ...

  8. Chisel3 - 复合数据类型

    https://mp.weixin.qq.com/s/rXYqiZKuBpAYL8R94zxgRA   Chisel允许用户根据需要,把基本数据类型组合成为复合数据类型使用.如C语言里面的结构体,这样 ...

  9. Hive中的数据类型以及案例实操

    @ 目录 基本数据类型 集合数据类型 案例实操 基本数据类型 对于Hive的String类型相当于数据库的varchar类型,该类型是一个可变的字符串,不过它不能声明其中最多能存储多少个字符,理论上它 ...

随机推荐

  1. leetcode-161周赛-5249-移除无效的括号

    题目描述: 自己的提交:O(N) class Solution: def minRemoveToMakeValid(self, s: str) -> str: #from collections ...

  2. php重定向说明

    302  临时重定向 header("location:http://api.com/headline?" . http_build_query($_REQUEST)); 301  ...

  3. 同源策略 - JSONP - CORS

    1.  Jquery 对象可以通过 .index() 进行取出自当前元素在父级元素中存放的索引: 2. 浏览器的同源策略 -- Ajax 在访问非本网站的时候,在数据返回的时候,会被浏览器拦截 - 后 ...

  4. Thymeleaf 模板布局三种区别

  5. AutoCAD2016安装破解教程

    AutoCAD2016安装破解教程.本人亲自实验,破解成功,有效.以64位为例. 工具/原料   笔记本电脑 AutoCAD2016安装包 AutoCAD2016注册机(xf-adsk2016_x64 ...

  6. Spellchecker inspection helps locate typos and misspelling in your code, comments and literals, and fix them in one click

    Pycharm设置 Pycharm总是很多的拼写检查波拉线 Spellchecker inspection helps locate typos and misspelling in your cod ...

  7. Django+telnetlib实现webtelnet

    说明 基于 python3.7 + django 2.2.3 实现的 django-webtelnet.有兴趣的同学可以在此基础上稍作修改集成到自己的堡垒机中. 项目地址:https://github ...

  8. 16. Jmeter-监听器

    jmeter-监听器介绍与使用 察看结果树 Summary Report 聚合报告 Backend Listener Aggregate Graph 断言结果 Comparison Assertion ...

  9. centos安装vbox addition

    在centos下安装vbox addition需要下载当前内核的头文件 yum install kernel-devel 但是下载了头文件后,仍然失败,原来是下载的头文件与当前的内核版本不对应, 于是 ...

  10. [已解决]报错JSONDecodeError

    报错: 解决: