Hive之SerDe&Beeline
一.SerDe
SerDe:Serializer and Deserializer 序列化及反序列化,构建在数据存储和执行引擎之间,对两者实现解耦。
Hive通过ROW FORMAT DELIMITED 以及SERDE进行内容的读写。
样板:
row format
:DELIMITED
[FIELDS TERMIINATED BY char [ESCAPED BY char]
[COLLECTION ITEMS TERMINATED BY char]
[MAP KEYS TERMINATED BY char]
[LINES TERMINATED BY char]
:SERDE serde_name [WITH SERDEPROPERTIES (property_name=property_value,property_name=property_value...)]
案例1:
create table zhen(id int, name string,age int)
row format delimited fields terminated by ',' collection items terninated by ',' map keys terminated by ':' lines terminated by '\n' ;
案例2:
create table zhen(id int, name string,age int)
row format serde 'org.apache.hadoop.hive.serde2.RegexSerDe' with serdeproperties("input.regex" = "([^ ])([^ ])([^ ])") // 正则匹配
stored as textfile;
备注:lines 默认按照换行拆分!
二.Beeline
格式化数据表数据,Beeline要和HiveServer2配合使用。服务端启动hiveserver2,客户端通过beeline两种方式连接hive
1.beeline -u jdbc:hive2://localhost:10000/default -n root
2.1.beeline
2.2 !connect jebc:hive2:/localhost:10000/defalut;auth-noSasl root 123
Hive之SerDe&Beeline的更多相关文章
- [Hive_add_10] Hive 的 serde (序列化 & 反序列化) 操作
0. 说明 serde 是序列化和反序列化 serialize & deserialize 是将文件中的字段映射成 Hive 中的列 1. 验证 1.1 openCSVSerde CSV 为逗 ...
- Hive 学习之路(三)—— Hive CLI和Beeline命令行的基本使用
一.Hive CLI 1.1 Help 使用hive -H或者 hive --help命令可以查看所有命令的帮助,显示如下: usage: hive -d,--define <key=value ...
- Hive 系列(三)—— Hive CLI 和 Beeline 命令行的基本使用
一.Hive CLI 1.1 Help 使用 hive -H 或者 hive --help 命令可以查看所有命令的帮助,显示如下: usage: hive -d,--define <key=va ...
- java使用JDBC连接hive(使用beeline与hiveserver2)
首先虚拟机上已经安装好hive. 下面是连接hive需要的操作. 一.配置. 1.查找虚拟机的ip 输入 ifconfig 2.配置文件 (1)配置hadoop目录下的core-site.xml和hd ...
- Hive beeline update
Hive cli vs beeline The primary difference between the two involves how the clients connect to Hive. ...
- beeline 连接hive
HiveServer2是一个能使客户端针对hive执行查询的一种服务,与HiverServer1比较,它能够支持多个客户端的并发请求和授权的:HiveCLI 和 hive –e的方式比较单一,HS2允 ...
- Hadoop Hive概念学习系列之hive三种方式区别和搭建、HiveServer2环境搭建、HWI环境搭建和beeline环境搭建(五)
说在前面的话 以下三种情况,最好是在3台集群里做,比如,master.slave1.slave2的master和slave1都安装了hive,将master作为服务端,将slave1作为服务端. 以 ...
- Hadoop Hive概念学习系列之hive里的扩展接口(CLI、Beeline、JDBC)(十六)
<Spark最佳实战 陈欢>写的这本书,关于此知识点,非常好,在94页. hive里的扩展接口,主要包括CLI(控制命令行接口).Beeline和JDBC等方式访问Hive. CLI和B ...
- Hive详解
1. Hive基本概念 1.1 Hive简介 1.1.1 什么是Hive Hive是基于Hadoop的一个数据仓库工具,可以将结构化的数据文件映射为一张数据库表,并提供类SQL查询功能. 1.1 ...
随机推荐
- [Swift]LeetCode319. 灯泡开关 | Bulb Switcher
There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every ...
- [Swift]LeetCode350. 两个数组的交集 II | Intersection of Two Arrays II
Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1,2,2,1 ...
- [Swift]LeetCode381. O(1) 时间插入、删除和获取随机元素 - 允许重复 | Insert Delete GetRandom O(1) - Duplicates allowed
Design a data structure that supports all following operations in averageO(1) time. Note: Duplicate ...
- [Swift]LeetCode801. 使序列递增的最小交换次数 | Minimum Swaps To Make Sequences Increasing
We have two integer sequences A and B of the same non-zero length. We are allowed to swap elements A ...
- Shell获取时间,日期,上月,当月,下月
#当前日期 $ date +%F #当前时间$ date +"%F %H:%M:%S" #昨日$ date -d yesterday +%F #上一个月 $ date -d &qu ...
- python判断两个文件是否相同
此方法相当于 Linux 系统下的diff,或者是 git 下的 checkout 官方解释请看: https://docs.python.org/2/library/difflib.html #!/ ...
- Python内置函数(45)——object
英文文档: class objectReturn a new featureless object. object is a base for all classes. It has the meth ...
- Python内置函数(65)——type
英文文档: class type(object) class type(name, bases, dict) With one argument, return the type of an obje ...
- 【Docker】(6)---Dockerfile文件
springboot项目打包镜像中的Dockerfile文件 在讲Dockerfile文件之前应该先讲下maven的一个插件叫:dockerfile-maven-plugin.他们是组合一起用的 一. ...
- vue踩坑--TypeError: __WEBPACK_IMPORTED_MODULE_1_vuex__.a.store is not a constructor
今天在使用vuex的时候遇到这么个问题,虽然后来解决了,是首字母大写的原因,但我还是不知道为什么.这里先记录下来. 这是vuex/store.js import Vue from 'vue' impo ...