zoukankan      html  css  js  c++  java
  • [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 ' ';
    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>

  • 相关阅读:
    内容生成器.计数器及多列
    STT-MTJ(自旋转移矩磁隧道结)模型的Verilog-A语言描述(仅参考)
    将进酒-唐·李白
    三十六计、孙子兵法
    Keil新建工程步骤
    No.6 Verilog 其他论题
    2-4 Numpy+Matplotlib可视化(二)
    2-3 Numpy+Matplotlib可视化(一)
    0-0 列表,元组,字典,集合
    2-2 Numpy-矩阵
  • 原文地址:https://www.cnblogs.com/gaojian/p/7617839.html
Copyright © 2011-2022 走看看