外部文件导入到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的例子的更多相关文章

  1. 将CSV格式或者EXCEL格式的文件导入到HIVE数据仓库中

    学习内容:数据导入,要求将CSV格式或者EXCEL格式的文件导入到HIVE数据仓库中: ①hive建表:test1 create table test1 (InvoiceNo String, Stoc ...

  2. 将CSV文件导入到hive数据库

    将csv文件导入hive后出现了所有的字段只显示在新建的表的第一个字段中,后面的字段全是null. 出现这种的原因是hive以行分隔数据,需要修改为按逗号'  ,  ‘ 进行分隔读取, 具体操作如下, ...

  3. hdfs文件导入到hive(带资源)

    前言 hive是基于Hadoop的一个数据仓库工具,用来进行数据提取.转化.加载,这是一种可以存储.查询和分析存储在Hadoop中的大规模数据的机制.hive数据仓库工具能将结构化的数据文件映射为一张 ...

  4. Apache Spark技术实战之4 -- 利用Spark将json文件导入Cassandra

    欢迎转载,转载请注明出处. 概要 本文简要介绍如何使用spark-cassandra-connector将json文件导入到cassandra数据库,这是一个使用spark的综合性示例. 前提条件 假 ...

  5. hive 下载和导入数据 hive -e

    1. 从97导出dim_channel_terminal_flag表数据到txt(数据下载) hive -e 'select * from dim.dim_city' >> dim_cit ...

  6. Hive 外部表的练习(多表关联查询,以及分组,子查询)

    Hive 外部表的练习 hive创建库和表操作 hive加载数据,4种发放 1.数据放在Linux创建表结构 进行加载 2.先定义表结构.将一个查询select语句结果插入到表中 3.数据先放在hdf ...

  7. Talend 将Oracle中数据导入到hive中,根据系统时间设置hive分区字段

    首先,概览下任务图: 流程是,先用tHDFSDelete将hdfs上的文件删除掉,然后将oracle中的机构表中的数据导入到HDFS中:建立hive连接->hive建表->tJava获取系 ...

  8. 11.把文本文件的数据导入到Hive表中

    先在hive里面创建一个表 create table mydb2.t3(id int,name string,age int) row format delimited fields terminat ...

  9. hive之数据导入导出

    hive数据导入导出 一.导入数据4种方式 建表语句 create table test( name string, friends array, children map<string, in ...

随机推荐

  1. loadrunner 脚本开发-int型变量和字符串的相互转换

    脚本开发-int型变量和字符串的相互转换 by:授客 QQ:1033553122 字符串转化为int型变量 Action2() { int j = 0; j = atoi("12345&qu ...

  2. android.support不统一的问题

    今天supprt28遇到的问题,由于28还是预览版,还存在一些bug 都是因为如果程序内出现不同的,support或者其他外部引用库的多个版本,Gradle在进行合并的时候会使用本地持有的,最高版本的 ...

  3. 聊聊HTTP gzip压缩与常见的Android网络框架

    版权声明: 欢迎转载,但请保留文章原始出处 作者:GavinCT 出处:http://www.cnblogs.com/ct2011/p/5835990.html 进入主题之前,我们先来看一下客户端与服 ...

  4. Java并发编程(二)同步

    在多线程的应用中,两个或者两个以上的线程需要共享对同一个数据的存取.如果两个线程存取相同的对象,并且每一个线程都调用了修改该对象的方法,这种情况通常成为竞争条件.  竞争条件最容易理解的例子就是:比如 ...

  5. String全面解析

    前言 public class Test { public static void main(String[] args) { String a = "abc"; String b ...

  6. [20170617]vim中调用sqlplus.txt

    [20170617]vim中调用sqlplus.txt --//以前写过一篇emacs下调用sqlplus的文章,一直想学emacs,受限制自己掌握vim,对学习它没有兴趣,原链接如下:--//htt ...

  7. web service && WCF 学习小结

    Web Service和WCF技术都提供了应用程序与应用程序之间的通信.它们都是基于soap消息在客户端和服务端之间进行通信,由于soap消息是一种xml格式,因此传输的数据格式为XML.每次客户端向 ...

  8. January 02nd, 2018 Week 01st Tuesday

    I dream my painting, and then I paint my dream. 我梦见我的画,然后我画我的梦. It was a long time after I had a goo ...

  9. 小程序布局中class='container'的bug

    display:flex失效,并增加其他额外属性,暂时记录,还未查询是何原因导致,更改calss则无此问题.

  10. easyui的datebox控件如何只要年月不要日谢谢知道的说一下

    例子2015-01 格式easyui-datebox 加上 data-options="formatter:myformatter,parser:myparser"function ...