创建测试表,来测试看看测试结果:

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 区别的更多相关文章

  1. 【原创】大叔问题定位分享(22)hive同时执行多个insert overwrite table只有1个可以执行

    hive 2.1 一 问题 最近有一个场景,要向一个表的多个分区写数据,为了缩短执行时间,采用并发的方式,多个sql同时执行,分别写不同的分区,同时开启动态分区: set hive.exec.dyna ...

  2. hive INSERT OVERWRITE table could not be cleaned up.

    create table maats.account_channel ROW FORMAT DELIMITED FIELDS TERMINATED BY '^' STORED AS TEXTFILE ...

  3. Hive-insert into table 与 insert overwrite table 区别

    区分insert into 和 insert overowrite: 0. 命令格式 INSERT OVERWRITE|INTO TABLE tablename [PARTITION (partcol ...

  4. (转)Lua的table库函数insert、remove、concat、sort详细介绍

    原帖链接:http://www.jb51.net/article/64711.htm#comments 有增注标识的地方为额外注释,非原帖内容. 函数列表:(增注:只能用于数组!) table.ins ...

  5. Lua的table库函数insert、remove、concat、sort详细介绍(转载)

    函数列表: table.insert(table,[ pos,] value) table.remove(table[, pos]) table.concat(table[, sep[, i[, j] ...

  6. insert into linksvr or insert into from linksvr

    通过链接服务器将实例A上的数据写入实例B,通常有以下两种方式--方案1:在实例A上执行insert into LinkForB.B..TableB select * from TableA--方案2: ...

  7. 使用batch insert解决MySQL的insert吞吐量问题

    最近使用了一个非常简单易用的方法解决了业务上的一个insert吞吐量的问题,在此总结一下. 首先我们明确一下,insert吞吐量其实并不是指的IPS(insert per second),而是指的RP ...

  8. 【转载】alter table move 和 alter table shrink space的区别

    move 和shrink 的共同点1.收缩段2.消除部分行迁移3.消除空间碎片4.使数据更紧密 shrink 语法:  alter table TABLE_NAME shrink space [com ...

  9. mysql 数据库插入语句之insert into,replace into ,insert ignore

    近期才发现mysql的插入语句竟然有如此多的使用方法,这里拿来分享一下. ①关于insert into : insert into table_name values(); insert into t ...

随机推荐

  1. LNMP详解

    目录 Nginx配置    1 PHP解析    1 Mysql操作    3 服务安装    3 连接测试    3 数据配置    3 Blogs建立    4   LNMP 环境 Mysql:1 ...

  2. 笔记:Maven 项目基本配置

    Maven 的基本设置包含项目基本信息和项目信息,基本信息主要用于设置当前包的归属项目.当前项目等,配置文件结构如下: <project xmlns="http://maven.apa ...

  3. WebPack的安装

    一.前提因为webpack是一个基于node的项目,所以首先需要确保你的电脑里面已经安装了node.js,以及npm.在这里我使用的版本是:node:v5.8.0 ,npm:3.7.3,若是版本问题, ...

  4. 【Python】excel读写操作 xlrd & xlwt

    xlrd ■ xlrd xlrd模块用于读取excel文件内容 基本用法: workbook = xlrd.open_workbook('文件路径') workbook.sheet_names() # ...

  5. docker环境下使用xdebug进行断点调试

    最近把本地环境切换成了docker的环境,便于快速运行和开发,确实比较给力,但是也遇到了问题,以前的本地xdebug断点调试都用不了,弄了几个小时终于搞定了 docker还是坑多,绕,下面把docke ...

  6. System V IPC 之共享内存

    IPC 是进程间通信(Interprocess Communication)的缩写,通常指允许用户态进程执行系列操作的一组机制: 通过信号量与其他进程进行同步 向其他进程发送消息或者从其他进程接收消息 ...

  7. [BZOJ 4417][Shoi2013]超级跳马

    4417: [Shoi2013]超级跳马 Time Limit: 10 Sec  Memory Limit: 256 MBSubmit: 379  Solved: 230[Submit][Status ...

  8. Java基础学习(二)

    软件设计原则: 为了提高软件的开发效率,降低软件开发成本,一个优良的软件系统应该具有以下特点: 1,可重用性:遵循DRY原则,减少软件中的重复代码. 2,可拓展性:当软件需要升级增加新的功能,能够在现 ...

  9. java之静态属性和静态方法

    前言 静态属性和方法必须用static修饰符 静态属性和非静态属性的区别: 1.在内存中存放位置不同   所有带static修饰符的属性或者方法都存放在内存中的方法区  而非静态属性存放在内存中的堆区 ...

  10. 构造函数与析构函数(construction undergoing)

    构造函数和析构函数 一.构造函数: 1.普通构造函数:在对象被创建时利用特定的值构造对象,将对象初始化到一个特定的状态. 特性:构造函数的函数名和类名相同:没有返回值:在对象被创建时被自动调用:如果有 ...