Variables 如何对配置单元中的变量执行算术运算?

Variables 如何对配置单元中的变量执行算术运算?,variables,hadoop,hive,Variables,Hadoop,Hive,我需要调用两个值之间的所有周:201701和201710,它们是2017年的第一周和第十周 我创建了一个变量 set var1 = 201710 ; 现在,我想使用这个变量来获得如下日期: select * from table1 where dates between ${hiveconf:var1} - 10 and ${hiveconf:var1} ; select * from table 1 where dates >= ${hiveconf:var1} 但我想我把语法

我需要调用两个值之间的所有周:201701和201710,它们是2017年的第一周和第十周

我创建了一个变量

set var1 = 201710 ; 
现在,我想使用这个变量来获得如下日期:

select * from table1 where dates between ${hiveconf:var1} - 10 and ${hiveconf:var1} ; 
select * from table 1 where dates >= ${hiveconf:var1}
但我想我把语法搞砸了

但是,我能够处理以下查询:

select * from table1 where dates between ${hiveconf:var1} - 10 and ${hiveconf:var1} ; 
select * from table 1 where dates >= ${hiveconf:var1}

非常感谢

我猜您存储的周数是个位数,没有前面的
0
,例如-

20179
而不是
201709

您的查询在Hive 1.2.1000.2.4.3.3-2上运行良好(1)问题是什么(2)日期的类型/格式是什么?@DuduMarkovitz(1)我无法执行中间查询(2)日期格式是整数错误。。。。。。。。。。。。。。。我没有得到任何结果