hive DDL
启动hadoop
/apps/hadoop/sbin/start-all.sh
开启MySQL库,用于存放hive的元数据
sudo service mysql start
启动hive
hive
在/data/hive3下下载数据库数据
mkdir /data/hive3
cd data/hive3
wget http://192.168.1.100:60000/allfiles/hive3/buyer_log
wget http://192.168.1.100:60000/allfiles/hive3/buyer_favorite
在hive中创建数据库并以'\t'为分隔符
create table buyer_log(id string,buyer_id string,dt string,ip string,opt_type string) row format delimited fields terminated by '\t' stored as textfile;
将/data/hive3下的数据导入到hive中
load data local inpath '/data/hive3/buyer_log' into table buyer_log;
load data local inpath '/data/hive3/buyer_favorite' into table buyer_favorite;
普通查询
select * from buyer_log limit 10;
别名查询
select b.id,b.ip from buyer_log b limit 10;
限定查询
select buyer_id from buyer_log where opt_type=1 limit 10;
两表或多表联合查询
select l.dt,f.goods_id from buyer_log l,buyer_favorite f where l.buyer_id=f.buyer_id limit 10;
多表插入
create table buyer_log1 like buyer_log;
create table buyer_log2 like buyer_log;
from buyer_log insert overwrite table buyer_log1 select *
insert overwrite table buyer_log2 select *;
多目录输出文件
from buyer_log
insert overwrite local directory '/data/hive3/out' select *;
insert overwrite local directory '/data/hive3/out1' select *;
使用本地shell脚本调用hive查询语句
#!/bin/bash
cd /apps/hive/sbin;
hive -e 'show tables;'
chmod +x sh1
./sh1
hive查询语句
一. 为什么hive是数据仓库 hive局限于hdfs, 不能进行记录级别的增删改 hive底层的mapreduce启动耗时很长, 无法做到传统数据库的秒查, 只适合离线分析 hive不支持事务, 无 ...
Hive通过查询语句向表中插入数据注意事项
最近在学习使用Hive(版本0.13.1)的过程中,发现了一些坑,它们或许是Hive提倡的比关系数据库更加自由的体现(同时引来一些问题),或许是一些bug.总而言之,这些都需要使用Hive的开发人员额 ...
Hive通过查询语句向表中插入数据过程中发现的坑
前言 近期在学习使用Hive(版本号0.13.1)的过程中,发现了一些坑,它们也许是Hive提倡的比关系数据库更加自由的体现(同一时候引来一些问题).也许是一些bug.总而言之,这些都须要使用Hive ...
Spark入门实战系列--5.Hive(上)--Hive介绍及部署
[注]该系列文章以及使用到安装包/测试数据 可以在获取 .Hive介绍 1.1 Hive介绍 月开源的一个数据仓库框架,提供了类似于SQL语法的HQ ...
Spark入门实战系列--5.Hive(下)--Hive实战
[注]该系列文章以及使用到安装包/测试数据 可以在获取 1.Hive操作演示 1.1 内部表 1.1.1 创建表并加载数据 第一步 启动HDFS ...
hadoop笔记之Hive入门(Hive的体系结构)
Hive入门(二) Hive入门(二) Hive的体系结构 ○ Hive的元数据 Hive将元数据存储在数据库中(metastore),支持mysql.derby.oracle等数据库,Hive默认是 ...
Hive 官方手册翻译 -- Hive DDL(数据定义语言)
Hive DDL(数据定义语言) Confluence Administrator创建, Janaki Lahorani修改于 2018年9月19日 原文链接 https://cwiki.apache ...
hive的学习入门(飞进数据仓库的小蜜蜂)
前言 hive是构建在Hadoop上的数据仓库平台,其设计目标是:使Hadoop上的数据操作与传统的SQL结合,让熟悉sql的开发人员能够轻松的像Hadoop平台迁移. Hive是Facebook的信 ...
hive操作语句使用详解
#创建表人信息表 person(String name,int age) hive> create table person(name STRING,age INT)ROW FORMAT DE ...
随机推荐
Codeforces Beta Round #8
A题,小小的模拟题,没看懂题意啊. #include #include #include #include ...
java学习面向对象之父子构造函数初始化
在之前讲到java面向对象继承的时候,我们只讲到了两个比较重要的知识点,一个是父子类当中有同名的成员变量,这个时候,我们引入了super这个关键字来区分这两个同名成员变量,除此之外,我们还讲到了父子同 ...
wpf异常:指定的 Visual 不是此 Visual 的上级问题处理解析
WPF在画线的时候,调用Control0.TransformToAncestor(Control1).Transform(new System.Windows.Point(0, 0))方法转换坐标的时 ...
Filezilla server配置FTP服务器中的各种问题与解决方法
转至;https://www.jb51.net/article/122171.htm 安装文件以及补丁下载 公司很多资料需要通过ftp上传,那么就需要配置一个FTP服务器,找了一台Windows服务器 ...
Sql语句中两个比较迷糊的概念:“连接查询” 与 “外键约束”
Sql语句中两个比较迷糊的概念:“连接查询” 与 “外键约束 Sql 中的连接查询:就是为了避免笛卡尔积,因为涉及到多表查询的化,不使用连接查询,会先将多个互相乘,求出笛卡尔积,然后在在里面查询符合的 ...
[翻译] ios-image-filters
ios-image-filters https://github.com/esilverberg/ios-image-filters photoshop-style filter interface ...
Python开发【模块】:time、datatime
时间模块 时间相关的操作,时间有三种表示方式: 时间戳 1970年1月1日之后的秒,即:time.time() 格式化的字符串 2014-11-11 11:11, ...
Hibernate3.3.2_ID生成策略
1,xml生成id generator:常用四个:native.identity.sequence.uuid. Annotation: 1,@GeneratedValue: a)自定义ID b)AUT ...
sama5d36 OUT0-OUT3 对应关系 带光模块的系统
ARM-IO9 PA8 OUT0 ARM-IO10 PA1 OUT1 ARM-IO11 PA3 OUT2 ARM-IO12 PA9 OUT3
NodeJS NPM HTTPS
npm config set registry http://registry.npmjs.org/