zoukankan      html  css  js  c++  java
  • Hive数据提取

    Hive是基于Hadoop的ETL工具和数据仓库。

    结构化数据

    结构化数据就像RDBMS

    hive> create table structured_table(id int, name string)
        > row format delimited
        > fields terminated by ','
        > location '/yandufeng/structured_table';
    OK
    Time taken: 0.209 seconds
    hive> load data local inpath '/home/hive/test2.txt' into table structured_table;
    Loading data to table default.structured_table
    Table default.structured_table stats: [numFiles=1, totalSize=23]
    OK
    Time taken: 0.831 seconds
    hive> select * from structured_table;
    OK
    1    hello
    2    name
    3    world
    Time taken: 0.106 seconds, Fetched: 3 row(s)

    半结构化的数据,例如:json,xml

    hive> 
        > create table json_table(str string);
    OK
    Time taken: 0.229 seconds
    hive> load data local inpath '/home/hive/json_table.json' into table json_table;
    Loading data to table default.json_table
    Table default.json_table stats: [numFiles=1, totalSize=26]
    OK
    Time taken: 1.523 seconds
    hive> select get_json_object(str, '$.a') from json_table;
    OK
    2
    Time taken: 0.168 seconds, Fetched: 1 row(s)
    hive> select get_json_object(str, '$.a'), get_json_object(str, '$.b') from json_table;
    OK
    2    blah
    Time taken: 0.084 seconds, Fetched: 1 row(s)

     什么时候使用Hive

    • 当需要强大的统计方法的时候
    • 当要处理结构化或者半结构化数据
    • 当需要基于Hadoop的数据仓库
    • 可以于Hbase结合

    Hive用在什么地方

    • 作为ETL工具和数据仓库
    • 提供HQL进行数据查询
    • 为特定的需求,用自定义的map和reduce脚本
  • 相关阅读:
    nohup
    wonder vscode plugins
    myhome vscode plugins
    virtural machine eth1
    单片机电子时钟的设计(期末课程设计)
    解决Eclipse中更改HTML页面后,浏览器查看页面无变化
    ASP.NET 中的 Session对象
    windows下mysql数据库导入导出
    TP5.1分表,partition分表实例,根据自增主键水平分表
    PHP操作mysql数据库分表的方法
  • 原文地址:https://www.cnblogs.com/yandufeng/p/6433622.html
Copyright © 2011-2022 走看看