zoukankan      html  css  js  c++  java
  • HADOOP-HIVE学习笔记(2) CLI

    REF:https://edu.hellobi.com/course/93/play/lesson/2032

    HIVE CLI

     

     

     

     

     

     你也可以命令行设置mapred.map.tasks=10, 这样起效优先级> hiveconf > .xml文件.

    -e :

    [root@bigdata conf]# hive -e "select * from t2 where id>1" --database hello

    2
    Time taken: 5.922 seconds, Fetched: 1 row(s)

    -S (省略不必要的信息)

    [root@bigdata conf]# hive -S -e "select count(1) from t2" --database hello

    2

     如果不加S的结果是什么呢?

    Logging initialized using configuration in jar:file:/home/admin/Downloads/apache-hive-2.3.7/lib/hive-common-2.3.7.jar!/hive-log4j2.properties Async: true
    OK
    Time taken: 14.445 seconds
    OK
    2
    Time taken: 6.046 seconds, Fetched: 1 row(s)

    -f: 运行文件file

    [root@bigdata conf]# ls
    hive-site.xml t2.hql
    [root@bigdata conf]# cat t2.hql
    use hello;
    select * from t2 where id > 1;

    [root@bigdata conf]# hive -f t2.hql --database hello

    cd ..回到上层目录后,换种方式运行。

    [root@bigdata apache-hive-2.3.7]# hive -f conf/t2.hql --database hello

    Logging initialized using configuration in jar:file:/home/admin/Downloads/apache-hive-2.3.7/lib/hive-common-2.3.7.jar!/hive-log4j2.properties Async: true
    OK
    Time taken: 11.419 seconds
    OK
    Time taken: 0.088 seconds
    OK

    2
    Time taken: 4.364 seconds, Fetched: 1 row(s)

     

     

    视频中:对应的hql是sum()求和。
    [root@bigdata conf]# hive -f hdfs://localhost:9000/user/root/t2.hql

     Hive交互式Shell选项:

     reset:参数重置成hive-site.xml的配置

     add,list,delete是类似的一组。

    !<shell command>:

    pwd:

    hive> !pwd;
    /home/admin/Downloads/apache-hive-2.3.7/conf
    hive> !ls;
    hive> dfs -ls /;
    Found 2 items
    drwx------   - root staff          0 2020-05-15 22:48 /tmp
    drwxr-xr-x   - root staff          0 2020-05-16 15:23 /user

    hive> dfs -ls /user;
    Found 2 items
    drwxr-xr-x   - root staff          0 2020-05-16 15:23 /user/hive
    drwxr-xr-x   - root staff          0 2020-05-16 17:41 /user/root

    add

    hive> add FILE t2.hql;
    Added resources: [t2.hql]

    结果:

    hive> LIST FILE;
    t2.hql
    hive> delete FILE t2.hql;
    hive> list FILE;
    hive> 
  • 相关阅读:
    array with objects sort
    Vue组件之区域滚动
    ajax跨域请求问题总结
    常见contentType
    Sublime Text 3实用快捷键大全
    具有层级关系的扁平化数组转化成树形结构数组
    阿里云地图选择器
    前端解析二进制文件流并下载
    tool.js日常工具方法
    git操作
  • 原文地址:https://www.cnblogs.com/watermarks/p/12901000.html
Copyright © 2011-2022 走看看