Hive:insert into table 与 insert overwrite table 区别
创建测试表,来测试看看测试结果:
create table test(name string,pwd string,createdate string)row format delimited fields terminated by ',';
第一步:使用insert into 插入数据到表中:
insert into test(name,pwd,createdate)values('name1','pwd1','2017-06-20 14:14:09');
insert into test(name,pwd,createdate)values('name1','pwd1','2017-06-20 14:14:09');
insert into test(name,pwd,createdate)values('name2','pwd2','2017-06-20 14:14:09');
insert into test(name,pwd,createdate)values('name2','pwd2','2017-06-20 14:14:09');
0: jdbc:hive2://10.78.152.52:21066/> select * from test;
+------------+-----------+----------------------+--+
| test.name | test.pwd | test.createdate |
+------------+-----------+----------------------+--+
| name1 | pwd1 | 2017-06-20 14:14:09 |
| name1 | pwd1 | 2017-06-20 14:14:09 |
| name2 | pwd2 | 2017-06-20 14:14:09 |
| name2 | pwd2 | 2017-06-20 14:14:09 |
+------------+-----------+----------------------+--+
第二步:不清理以上插入的记录,直接执行insert overwirte,并查询分析结果:
insert overwrite table test select 'name1' as name,'pwd1' as pwd,'2017-06-20 14:14:09' as createdate;
insert overwrite table test select 'name2' as name,'pwd2' as pwd,'2017-06-20 14:14:09' as createdate;
insert overwrite table test select 'name2' as name,'pwd2' as pwd,'2017-06-20 14:14:09' as createdate;
insert overwrite table test select 'name3' as name,'pwd3' as pwd,'2017-06-20 14:14:09' as createdate;
0: jdbc:hive2://10.78.152.62:21066/> select * from test;
+------------+-----------+----------------------+--+
| test.name | test.pwd | test.createdate |
+------------+-----------+----------------------+--+
| name3 | pwd3 | 2017-06-20 14:14:09 |
+------------+-----------+----------------------+--+
第三步:不清理上边步骤执行后的结果,接着执行以下sql语句,并查询结果:
insert overwrite table test select 'name2' as name,'pwd2' as pwd,'2017-06-20 14:14:09' as createdate;
0: jdbc:hive2://10.78.152.62:21066/> select * from test;
+------------+-----------+----------------------+--+
| test.name | test.pwd | test.createdate |
+------------+-----------+----------------------+--+
| name2 | pwd2 | 2017-06-20 14:14:09 |
+------------+-----------+----------------------+--+
Hive:insert into table 与 insert overwrite table 区别的更多相关文章
- 【原创】大叔问题定位分享(22)hive同时执行多个insert overwrite table只有1个可以执行
hive 2.1 一 问题 最近有一个场景,要向一个表的多个分区写数据,为了缩短执行时间,采用并发的方式,多个sql同时执行,分别写不同的分区,同时开启动态分区: set hive.exec.dyna ...
- hive INSERT OVERWRITE table could not be cleaned up.
create table maats.account_channel ROW FORMAT DELIMITED FIELDS TERMINATED BY '^' STORED AS TEXTFILE ...
- Hive-insert into table 与 insert overwrite table 区别
区分insert into 和 insert overowrite: 0. 命令格式 INSERT OVERWRITE|INTO TABLE tablename [PARTITION (partcol ...
- (转)Lua的table库函数insert、remove、concat、sort详细介绍
原帖链接:http://www.jb51.net/article/64711.htm#comments 有增注标识的地方为额外注释,非原帖内容. 函数列表:(增注:只能用于数组!) table.ins ...
- Lua的table库函数insert、remove、concat、sort详细介绍(转载)
函数列表: table.insert(table,[ pos,] value) table.remove(table[, pos]) table.concat(table[, sep[, i[, j] ...
- insert into linksvr or insert into from linksvr
通过链接服务器将实例A上的数据写入实例B,通常有以下两种方式--方案1:在实例A上执行insert into LinkForB.B..TableB select * from TableA--方案2: ...
- 使用batch insert解决MySQL的insert吞吐量问题
最近使用了一个非常简单易用的方法解决了业务上的一个insert吞吐量的问题,在此总结一下. 首先我们明确一下,insert吞吐量其实并不是指的IPS(insert per second),而是指的RP ...
- 【转载】alter table move 和 alter table shrink space的区别
move 和shrink 的共同点1.收缩段2.消除部分行迁移3.消除空间碎片4.使数据更紧密 shrink 语法: alter table TABLE_NAME shrink space [com ...
- mysql 数据库插入语句之insert into,replace into ,insert ignore
近期才发现mysql的插入语句竟然有如此多的使用方法,这里拿来分享一下. ①关于insert into : insert into table_name values(); insert into t ...
随机推荐
- 【阿里聚安全·安全周刊】500万台Android设备受感染|YouTube封杀枪支组装视频
本周的七个关键词: 500万Android 设备受感染丨 黑客将矛头指向无线传输协议 丨 YouTube封杀枪支视频 丨 AMD将发布补丁 丨 Gooligan Android 僵尸网络 丨 N ...
- 使用angular-ui-router替代ng-router
angular框架自身提供的ng-route在一定程度上满足了我们的需求,但是他只针对于单视图,比如点击一个link跳转到另一个视图,但是在实际业务中,需要一个状态对应的视图中还包含其他的视图,或者一 ...
- java 10 中 var关键字用法
引用:https://mp.weixin.qq.com/s/n1tcJ0CywSi0j-YycGPwxg what java10引入了局部变量折断 var用于声明局部变量. 如var user=new ...
- [bzoj1601]灌水_kruskal
灌水 bzoj-1601 题目大意:给你n块地,将两块地之间连通有代价$P_{i,j}$,单独在一块地打井需要代价$C_i$,问将所有的井都有水的代价是多少. 注释:1<=n<=300. ...
- PHP 相对完整的分页
效果链接http://love.bjxxw.com/oejiaoyou/pubu/zhaopian.php php 分页 <?php /* * * * 说明 吉海波 2015/9/17 * $p ...
- String s=new String("abc")创建了几个对象?
String str=new String("abc"); 紧接着这段代码之后的往往是这个问题,那就是这行代码究竟创建了几个String对象呢? 答案应该是1个或者2个. 1个 ...
- ThreadLocal 原理和使用场景分析
ThreadLocal 不知道大家有没有用过,但至少听说过,今天主要记录一下 ThreadLocal 的原理和使用场景. 使用场景 直接定位到 ThreadLocal 的源码,可以看到源码注释中有很清 ...
- C语言程序设计(基础)- 第7周作业(新)
要求一(25经验值) 完成PTA中题目集名为<usth-C语言基础-第七周作业>和<usth-C语言基础-12周PTA作业>中的所有题目. 注意1:<usth-C语言基础 ...
- HDFS之HA机制
- Java作业-集合
1. 本周学习总结 2. 书面作业 1. ArrayList代码分析 1.1 解释ArrayList的contains源代码 public boolean contains(Object o) { r ...