[Spark][Hive]外部文件导入到Hive的例子
外部文件导入到Hive的例子:
[training@localhost ~]$ cd ~
[training@localhost ~]$ pwd
/home/training
[training@localhost ~]$
[training@localhost ~]$ vim customers.txt
[training@localhost ~]$
[training@localhost ~]$ cat customers.txt
001 Ali us
002 Bsb ca
003 Carls mx
[training@localhost ~]$ cd ~
[training@localhost ~]$ pwd
/home/training
[training@localhost ~]$ hive
2017-10-01 06:02:24,782 WARN [main] mapreduce.TableMapReduceUtil:
The hbase-prefix-tree module jar containing PrefixTreeCodec is not present. Continuing without it.
Logging initialized using configuration in file:/etc/hive/conf.dist/hive-log4j.properties
WARNING: Hive CLI is deprecated and migration to Beeline is recommended.
hive>
> show tables '*c*';
OK
Time taken: 3.268 seconds
<<<<<<<<<<< 目前无表
hive>
> CREATE TABLE IF NOT EXISTS customers(
> cust_id string,
> name string,
> country string
> )
> ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';
OK
Time taken: 7.931 seconds
hive>
hive> load data local inpath '/home/training/customers.txt' into table customers;
Loading data to table default.customers
Table default.customers stats: [numFiles=1, totalSize=36]
OK
Time taken: 3.676 seconds
hive> show tables like 'customers';
OK
customers
Time taken: 0.24 seconds, Fetched: 1 row(s)
hive>
hive> show tables '*c*';
OK
customers
Time taken: 0.167 seconds, Fetched: 1 row(s)
hive>
[Spark][Hive]外部文件导入到Hive的例子的更多相关文章
- 将CSV格式或者EXCEL格式的文件导入到HIVE数据仓库中
学习内容:数据导入,要求将CSV格式或者EXCEL格式的文件导入到HIVE数据仓库中: ①hive建表:test1 create table test1 (InvoiceNo String, Stoc ...
- 将CSV文件导入到hive数据库
将csv文件导入hive后出现了所有的字段只显示在新建的表的第一个字段中,后面的字段全是null. 出现这种的原因是hive以行分隔数据,需要修改为按逗号' , ‘ 进行分隔读取, 具体操作如下, ...
- hdfs文件导入到hive(带资源)
前言 hive是基于Hadoop的一个数据仓库工具,用来进行数据提取.转化.加载,这是一种可以存储.查询和分析存储在Hadoop中的大规模数据的机制.hive数据仓库工具能将结构化的数据文件映射为一张 ...
- Apache Spark技术实战之4 -- 利用Spark将json文件导入Cassandra
欢迎转载,转载请注明出处. 概要 本文简要介绍如何使用spark-cassandra-connector将json文件导入到cassandra数据库,这是一个使用spark的综合性示例. 前提条件 假 ...
- hive 下载和导入数据 hive -e
1. 从97导出dim_channel_terminal_flag表数据到txt(数据下载) hive -e 'select * from dim.dim_city' >> dim_cit ...
- Hive 外部表的练习(多表关联查询,以及分组,子查询)
Hive 外部表的练习 hive创建库和表操作 hive加载数据,4种发放 1.数据放在Linux创建表结构 进行加载 2.先定义表结构.将一个查询select语句结果插入到表中 3.数据先放在hdf ...
- Talend 将Oracle中数据导入到hive中,根据系统时间设置hive分区字段
首先,概览下任务图: 流程是,先用tHDFSDelete将hdfs上的文件删除掉,然后将oracle中的机构表中的数据导入到HDFS中:建立hive连接->hive建表->tJava获取系 ...
- 11.把文本文件的数据导入到Hive表中
先在hive里面创建一个表 create table mydb2.t3(id int,name string,age int) row format delimited fields terminat ...
- hive之数据导入导出
hive数据导入导出 一.导入数据4种方式 建表语句 create table test( name string, friends array, children map<string, in ...
随机推荐
- JavaScript非数字(中文)排序
直接上代码: var arr=[ {name:"张散步",age:"23",sports:"篮球",number:"231123& ...
- CentOS7的/tmp目录自动清理规则
CentOS6以下系统(含)使用watchtmp + cron来实现定时清理临时文件的效果,这点在CentOS7发生了变化. 在CentOS7下,系统使用systemd管理易变与临时文件,与之相关的系 ...
- system.transfer.list版本进化
从android5.0开始之后,recovery升级包中不再升级system.img,而是升级system.new.dat+system.transfer.list的这种文件组合,经过android版 ...
- JavaScript大杂烩0 - WEB基础知识
1. 协议小结:HTTP协议与TCP/IP协议 现代Web应用开发的基础是HTTP协议,那么HTTP协议与我们熟知的TCP/IP协议有什么关系呢? 这个要从网络通信模型说起,简单的说,计算机通信就像两 ...
- Excel函数进阶
#笔记:为了方便自己以后查找,以便随时随地能查看.形成系统化学习! 查找引用函数 ------------------包含----------Vlookup函数(if数组).Hlookup函数.loo ...
- 将mssql数据库高版本迁移到低版本
将mssql数据库高版本迁移到低版本 在低版本目标数据库中创建目标空数据库[TargetDb] ,注意新建数据库即可,不要创建任何表 在低版本数据库中,选中[服务器对象=>链接服务器] 右键[新 ...
- ubuntu16.04系统彻底卸载mysql,并源码免编译重装MySQL的步骤
今天的总结 ubuntu上彻底卸载MySQL或重新安装 https://www.jianshu.com/p/974b33873bca #查看是否存在mysql服务 service mysql stat ...
- Linux运维之如何查看目录被哪些进程所占用,lsof命令、fuser命令
之前将一块硬盘挂载到某个目录下,但是现在我想卸载掉这块硬盘,无论如何都umount不了,有些同学可能说需要加上 -f 参数强制卸载,理论上是可以的,但是在我这里依然不起作用,比如: [root@:vg ...
- Linux系统根据端口号来查看其进程并杀死进程
1.首先是查看某个端口号,(以httpd服务为例) 2.查看此端口下进程以及进程号 3.我们使用awk命令过滤出第二列,即进程号 4.杀死进程 报错的这一行表示,要杀死的进程PID为3754,但是没有 ...
- 浅copy与深copy举例
例1: #!/usr/bin/env python import copy d1 = {'x':1,'y':2,'z':[3,4.5]} d2 = d1 d3 = d1.copy() d4 = co ...