[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 ...
随机推荐
- Linux 学习笔记之超详细基础linux命令 Part 5
Linux学习笔记之超详细基础linux命令 by:授客 QQ:1033553122 ---------------------------------接Part 4----------------- ...
- Runtime消息动态解析与转发流程
先上图: 下面根据具体代码看这张图. 一.创建一个Person类, Person.h #import <Foundation/Foundation.h> @interface Person ...
- [iOS] KVC 和 KVO
开发iOS经常会看见KVO和KVC这两个概念,特地了解了一下. 我的新博客wossoneri.com link KVC Key Value Coding KVC是一种用间接方式访问类的属性的机制.比如 ...
- Nodejs 安装 on centos7
本文演示如何在CentOS7上安装Nodejs. 1 准备工作 1.1 浏览器访问安装包下载地址: https://nodejs.org/dist/ 找到需要安装的版本,以8.11.3版本为例,地址为 ...
- Appium学习——安装Android SDK
.下载Android SDK 下载地址:http://tools.android-studio.org/index.php/sdk 百度搜索Android SDK也可以. 下载之后,Android S ...
- scrapy简单分布式爬虫
经过一段时间的折腾,终于整明白scrapy分布式是怎么个搞法了,特记录一点心得. 虽然scrapy能做的事情很多,但是要做到大规模的分布式应用则捉襟见肘.有能人改变了scrapy的队列调度,将起始的网 ...
- 第一章 Hyper-V 2012 R2角色部署
在windows server 2012 R2中,我们可以通过安装hyper-v角色来完成虚拟化底层架构的部署.除了图形界面的安装,也可以使用单独的发行版Hyper-V Server 2012 R ...
- php 安装xdebug进行调试(phpstorm)
一.下载xdebug xdebug官网:https://xdebug.org/download.php 在选择下载哪个版本的xdebug的时候需要注意了,下面有两种方法,让你准确的下载自己环境对应的x ...
- IntelliJ IDEA2018.3 最新破解方法 无需改host
文章转自 https://blog.csdn.net/SmileLvCha/article/details/78936659 刚把idea升级到最新版,发现要重新激活,网上查了有改host的方法可行, ...
- java开发过程问题及解决
1.junit做测试时候报异常: junit.framework.AssertionFailedError: No tests found in com.mq.original.OriginalMqP ...