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
hive 一次性命令的更多相关文章
- 分区表,桶表,外部表,以及hive一些命令行小工具
hive中的表与hdfs中的文件通过metastore关联起来的.Hive的数据模型:内部表,分区表,外部表,桶表受控表(managed table):包括内部表,分区表,桶表 内部表: 我们删除表的 ...
- [Spark][Hive]Hive的命令行客户端启动:
[Spark][Hive]Hive的命令行客户端启动: [training@localhost Desktop]$ chkconfig | grep hive hive-metastore 0:off ...
- Hive Shell 命令详解
Hive服务介绍 Hive默认提供的cli(shell)服务,如果需要启动其他服务,那么需要service参数来启动其他服务,比如thrift服务.metastore服务等.可以通过命令hive -- ...
- Hive shell 命令
Hive shell 命令. 连接 hive shell 直接输入 hive 1.显示表 hive> show tables; OK test Time taken: 0.17 seconds, ...
- 【原创】官方文档-hive 启动命令
[一起学Hive]之十六-Hive的WEB页面接口-HWI Apache Hive 管网 hive metrics hive常用命令整理 Hive学习之HiveServer2服务端配置与启动 启动hi ...
- Hive 常用命令和语句
示例数据库为 db_hive 1. 创建表 create-table.sql create table if not exists db_hive.tb_user ( id int, username ...
- 1.10-1.11 hive交互式命令讲解
一.hive 交互式命令参数 #帮助 [root@hadoop-senior hive-0.13.1]# bin/hive -h Missing argument for option: h usag ...
- Hive之命令
Hive之命令 说明:此博客只记录了一些常见的hql,create/select/insert/update/delete这些基础操作是没有记录的. 一.时间级 select day -- 时间 ,d ...
- Hive常用命令
本位为转载,原地址为:http://www.cnblogs.com/BlueBreeze/p/4232421.html #创建新表 hive> CREATE TABLE t_hive (a in ...
随机推荐
- (treap)[bzoj3224][洛谷3369][cogs1829]Tyvj 1728 普通平衡树
Description 您需要写一种数据结构(可参考题目标题),来维护一些数,其中需要提供以下操作:1. 插入x数2. 删除x数(若有多个相同的数,因只删除一个)3. 查询x数的排名(若有多个相同的数 ...
- log4net始终占用日志文件的问题
在appender 下面加 <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
- toString()方法简单分析
问题描述 今天在使用spotbugs代码走查时发现这样一个问题,如下, String[] myArray=new String[] {"1","2"," ...
- Qt-QMl-自定义自己想要的TabView
上效果图 上实现源码,这里的代码都是来自Qt官方源码修改其中某一行内容 /* 作者:张建伟 时间:2018年4月8日 简述:自定义TabView,主要实现Tab和实现内容重叠,不在占用独立空间 该文件 ...
- JUC——原子类操作(三)
原子类操作 既然强调了并发访问,那么就必须考虑操作系统位数:32位操作系统还是64位操作系统,对于long型数据类型而言,是64位的.但是如果现在项目运行在32位系统上,则long型数据会占用32位空 ...
- nginx main函数
源代码: int ngx_cdecl main(int argc, char *const *argv) { ngx_int_t i; ngx_log_t *log; ngx_cycle_t *cyc ...
- 75.[LeetCode] Sort Colors
Given an array with n objects colored red, white or blue, sort them in-place so that objects of the ...
- Windows和Linux系统如何退出python命令行
python命令行是新手学习python过程中必须要学的一个工具,下面我们来看一下怎么退出python命令行. 第一种方式: 使用python提供的exit()函数,linux平台和windows平台 ...
- 基于 Agent 的模型入门:Python 实现隔离仿真
2005 年诺贝尔经济学奖得主托马斯·谢林(Thomas Schelling)在上世纪 70 年代就纽约的人种居住分布得出了著名的 Schelling segregation model,这是一个 A ...
- Scrum立会报告+燃尽图 05
此作业要求参见:[https://edu.cnblogs.com/campus/nenu/2018fall/homework/2195] 一.小组介绍 组长:王一可 组员:范靖旋,王硕,赵佳璐,范洪达 ...