![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Hive
哇哈哈水有点甜
这个作者很懒,什么都没留下…
展开
-
Hive的DDL数据定义
库操作一、创建数据库:create database [if not exists] database_name[comment database_comment] //库的说明[location hdfs_path] ...原创 2019-06-05 12:35:34 · 366 阅读 · 0 评论 -
Hive常用命令
创建库:create database 库名创建表:create table 表名创建外部表:createexternal table 库名创建表格式:create 【external】 table 【if not exists】库名(字段1 类型1 【comment注释】,字段2 类型2 【comment注释】……)【comment表注释】【分区partitioned by(字段 ...原创 2019-06-04 11:37:03 · 445 阅读 · 0 评论 -
Hive的数据类型
基本数据类型:对于Hive的String类型相当于数据库的varchar类型,该类型是一个可变的字符串,不同于java的string类型(java的string类型是不可变字符串)集合数据类型:Hive中有三种复杂的数据类型array、map、和struct。array和map和jave中的array和map类似,而struct与java中的对象类似,它封装了一个命令字段集合,复杂数据类...原创 2019-06-04 11:38:12 · 408 阅读 · 0 评论 -
Hive自定义UDF函数
写一个类继承UDF,重写evaluate方法打包,将jar包导入虚拟机添加jaradd jar jar包地址(add jar /opt/module/datas/diao.jar;)创建临时函数与开发好的java class关联create temporary function mylower as “全类名”;使用临时函数select ename, mylower(ename) ...原创 2019-06-04 11:38:26 · 162 阅读 · 0 评论 -
Hive中数据的导入与导出的几种方式
一、数据导入(5种方式)向表中装载数据(load在HDFS上表现为剪切)hive> load data [local] inpath ‘/opt/module/datas/student.txt’ [overwrite] into table student [partition (partcol1=val1,…)];(1)load data:表示加载数据(2)local:表示从本...原创 2019-06-04 11:38:38 · 1201 阅读 · 0 评论 -
Hive中的MapJoin如何用Hql语句实现
select /*+ mapjoin(test1)*/ test1.b,test2.a from test1 join test2 on test1.a = test2.a where test1.a like '%'+test2.b+'%'; /+ mapjoin(test1)/ 这里的test1是需要加载进内存的小表,后面跟正常的查询语句hive.mapjoin.smalltable...原创 2019-06-04 10:53:49 · 443 阅读 · 0 评论 -
Hive中insert into和insert overwrite的区别
insert into 和 insert overwrite 都是往表中添加数据区别:insert into:将数据追加到表的末尾insert overwrite:覆盖之前的数据语句:insert into:hive>insert into [table] student select * from stu;(将select * from stu的查询结果追加到student表的...原创 2019-06-04 10:52:35 · 5976 阅读 · 1 评论 -
Hive中分桶表设置桶数但实际却未按桶数进行分文件存储问题解决
问题描述:创建分桶表时按字段id进行分桶,桶数为5,但实际在HDFS上存储却只有一个文件建表语句:create table bucket_test (id bigint comment 'ID', name string comment '名字')comment '分桶表测试'clustered by(id) into 5 bucketsROW FORMAT DELIMITED F...原创 2019-06-03 14:55:59 · 922 阅读 · 0 评论 -
Hive将二级分区表中指定分区的数据导入新表时遇到的问题及解决方案
问题描述:hive原始表old,二级分区分别是month,day,现在要求将指定分区下的所有数据导入一张新表new,new复制old表结构create table new like old;导入数据SQL语句insert overwrite table new partition(month=‘10’,day=‘01’) select * from old where month='10'...原创 2019-06-04 09:55:34 · 2018 阅读 · 0 评论 -
Hive的常见配置
查询后Hive信息显示的配置:显示字段名:<property> <name>hive.cli.print.header</name> <value>true</value></property>显示数据库名: <property> <name>hive.cli.pri...原创 2019-06-04 15:56:00 · 231 阅读 · 0 评论