Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hive 数据参数在配置单元中未按预期工作_Hive - Fatal编程技术网

Hive 数据参数在配置单元中未按预期工作

Hive 数据参数在配置单元中未按预期工作,hive,Hive,我正在将数据参数传递给配置单元脚本,但它不起作用 SET yrmonth=concat(substr(to_date(${hiveconf:runningdate}),1,4),substr(to_date(${hiveconf:runningdate}),6,2)); SET fom=TRUNC(${hiveconf:runningdate},'MONTH'); SET lom=LAST_DAY(${hiveconf:runningdate}); USE cust_db; SELECT s

我正在将数据参数传递给配置单元脚本,但它不起作用

SET yrmonth=concat(substr(to_date(${hiveconf:runningdate}),1,4),substr(to_date(${hiveconf:runningdate}),6,2));
SET fom=TRUNC(${hiveconf:runningdate},'MONTH');
SET lom=LAST_DAY(${hiveconf:runningdate});

USE cust_db;

SELECT saleid,podid,pname
    FROM product 
    WHERE productln_yrmo=${hiveconf:yrmonth};
--productln\u yrmo为int列

SELECT cid,cname,cloc
    FROM customer 
    WHERE customer_createddt >='${hiveconf:fom}' 
    AND customer_createddt <='${hiveconf:lom}'
    AND cloc = 'AUS';

从您的查询中,“customer_createddt”似乎是日期类型,因为您使用了“=”运算符来获取“fom”和“lom”之间的值范围。我猜日期范围的词典比较工作得很好。但是,不确定何时使用“customer\u createddt”列上的分区创建表DDL。
因此,请给出一个到目前为止的试播字符串(也请发布您的表DDL以更清晰)

选择cid、cname、cloc
来自客户
其中customer_createddt>=CAST(${hiveconf:fom}作为日期)

而customer_createddt在您的查询中,“customer_createddt”似乎是日期类型,因为您使用了“=”运算符来获取“fom”和“lom”之间的值范围。我猜日期范围的词典比较工作得很好。但是,不确定何时使用“customer\u createddt”列上的分区创建表DDL。
因此,请给出一个到目前为止的试播字符串(也请发布您的表DDL以更清晰)

选择cid、cname、cloc
来自客户
其中customer_createddt>=CAST(${hiveconf:fom}作为日期)

欢迎来到Stack Overflow。为了让社区能够帮助您,您需要首先指定您的确切问题以及您对此的具体问题。请尽快帮助我。欢迎使用Stack Overflow。为了让社区能够帮助您,您需要首先明确说明您的具体问题以及您对此的具体问题。您能尽快帮助我吗。
hive -hiveconf runningdate='2016-05-18' -f cust.hql
SELECT cid,cname,cloc
    FROM customer 
    WHERE customer_createddt >=CAST(${hiveconf:fom} AS DATE) 
    AND customer_createddt <=CAST(${hiveconf:lom} AS DATE)
    AND cloc = 'AUS';