[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>
相关文章
- 安全之路 —— 通过映像劫持实现文件自启动
- iconv 文件编码相互转换
- Linux常用命令-文件操作 网络命令 性能命令
- 【240行拿下】基于C语言 实现通讯录管理系统 带文件保存及读取功能
- 【Spark】ScalaIDE运行spark,A master URL must be set in your configuration
- tomcat的文件路径 servelet的配置 以及maven中的WEB-INF的路径
- IDEA SVN提交设置忽略文件
- Django 4.x File文件上传使用示例和配置方法
- 无法打开锁文件 /var/lib/dpkg/lock-frontend - open
- NSIS如何对一整个目录文件夹(包括子文件夹和其中的文件)压缩
- Spring Boot—04文件上传
- [spark][python]Spark map 处理
- 《C#零基础入门之百识百例》(九十二)本地数据交互 -- 文件概述 -- File类介绍和使用
- Yii2.0源码分析之——控制器文件分析(Controller.php)创建动作、执行动作
- C#-获取文件夹下的所有文件
- Git操作之 - 文件模式修改