zoukankan
html css js c++ java
hive使用小技巧如何往Hive SQL中传入参数
很多SQL需要重复执行,可能是每天执行一次,而需要修改的只是SQL中的日期字段,这种情况下可以使用 参数代入
使用的方式
$
hive
-d key1=value1 -d key2=value -d key3=value3 ...
复制代码
例子-1:
hive -d shell_date_1='20120425' -d shell_date_2='20120426'
hive> set shell_date_1;
shell_date_1=20120425
hive> set shell_date_2;
shell_date_2=20120426
hive> explain select * from dual where user_id = ${shell_date_1};
复制代码
这里面的 shell_date_1 会替换为 20120425
例子-2:
hive -d shell_date_1='20120425' -d shell_date_2='20120426' \
-e "explain select * from dual where user_id = ${shell_date_1}"
复制代码
例子-3:
vim hive.sql
复制代码
内容为:
explain select * from dual where user_id = ${shell_date_1}
hive -d shell_date_1='20120425' -f hive.sql
复制代码
查看全文
相关阅读:
启动Docker容器
Docker 删除容器
11.18数据库认证
10.17权限认证
9.16角色认证
8.13数据库认证
6.11Realm简介
5.8认证流程分析
4.7固定信息认证
20张图表达程序员的心酸
原文地址:https://www.cnblogs.com/java20130722/p/3206939.html
最新文章
C# 中的新增功能
js清除非数字输入
数据库关系图
C#语言规范
gitHub网站上常见英语翻译2
gitHub网站上常见英语翻译
重构工具中的英文翻译
程序代码表现形式感悟
如何开启开源之旅(一)
springboot
热门文章
Interrupt distribution scheme for a computer bus
HTML DOM getAttribute() 方法
Docker 数据卷容器
Docker 数据卷
Docker配置文件
Docker的私有仓库
Docker Hub
介绍Docker仓库
终止Docker容器
守护态运行Docker容器
Copyright © 2011-2022 走看看