hive

作者: 已不再更新_转移到qiita | 来源:发表于2018-07-18 11:49 被阅读9次

    Hive

    The Apache Hive data warehouse software facilitates reading, writing, and managing large datasets residing in distributed storage using SQL. Structure can be projected onto data already in storage. A command line tool and JDBC driver are provided to connect users to Hive.

    进入hive

    hive
    hive --service cli
    hive -S #静默模式 不打印输出信息
    

    hive命令

    show databases;
    use <dbname>; -- 连接数据库
    show tables;
    show functions; --显示内置函数
    
    desc <tbl>;     -- 显示表结构
    dfs -ls <dir>;   -- 在hive里显示hdfs的目录
    
    create table person 
    (id int,
    name string,
    married boolean,
    salary double);
    
    desc  person;
    ------------------------------
    create table student 
    ( id int,
      name string,
      grade array<float>);
    
    ------------------------------
    create table student
    ( id int,
      name string,
      grade map<string, float>);
    ------------------------------
    create table student
    ( id int,
      info struct<name: string, age:int, gender: string>
    );
    

    hive执行shell命令

    !pwd;
    !ls;
    ! cat /proc/cpuinfo;
    

    HQL 查询

    select * from tbl; --不会转换为 MapReduce
    select title from tbl; -- 转换为 MapReduce
    

    相关文章

      网友评论

          本文标题:hive

          本文链接:https://www.haomeiwen.com/subject/yycopftx.html