zoukankan      html  css  js  c++  java
  • hive 一次性命令

    1、用hive查询,而不进入hive cli,查询后的值可以保存到文件中

    #使用参数-e
    [hadoop@bigdata-senior01 ~]$ hive -e "select * from busdata.weather_count"
    
    OK
    1990    900
    1991    887
    1992    909
    1993    923
    1994    873
    1995    866
    1996    987
    1997    961
    1998    853
    1999    914
    2000    927
    Time taken: 3.221 seconds, Fetched: 11 row(s)
    #加上静默开关-S,过滤ok和tim taken
    [hadoop@bigdata-senior01 ~]$ hive -S -e "select * from busdata.weather_count"
    1990    900
    1991    887
    1992    909
    1993    923
    1994    873
    1995    866
    1996    987
    1997    961
    1998    853
    1999    914
    2000    927
    #结果导入到本地文件中
    [hadoop@bigdata-senior01 ~]$ hive -S -e "select * from busdata.weather_count" > weather_max.txt

    2、查找某个配置属性

    [hadoop@bigdata-senior01 ~]$ hive -S -e "set" | grep warehouse
    hive.metastore.warehouse.dir=/hive/warehouse

    3、执行外部脚本

    [hadoop@bigdata-senior01 ~]$ cat weather_query.hql
    select * from busdata.weather_count;
    select * from busdata.weather_max;
    
    [hadoop@bigdata-senior01 ~]$ hive -f /home/hadoop/weather_query.hql
    #静默执行,然后结果导入文件
    [hadoop@bigdata-senior01 ~]$ hive -S -f /home/hadoop/weather_query.hql >weather_mix.txt
  • 相关阅读:
    leetcode 70 Climbing Stairs
    leetcode 203 Remove Linked List Elements
    【HMM】
    【设计总结】
    【docker】导出导入容器
    【设计工具】样机图
    【设计细节】apple sound
    【产品分析】盒马生鲜 套路
    【喂到嘴经济】这个词有点意思
    【需求分类】KANO模型
  • 原文地址:https://www.cnblogs.com/asker009/p/10520313.html
Copyright © 2011-2022 走看看