BIRT Eclipse - 无法识别“?”附近的输入
BIRT Eclipse - cannot recognize input near '?'
birt 4.6.0
我有以下查询,它在 BIRT 和 DBViizualizer 中都有效:
SELECT t1.keys as SUBSCRIBER_COMPLETE, t1.vals as previous_count, t2.vals as current_count from (
SELECT explode(map('Row Total', SUBSCRIBER_COMPLETE_TOTAL)) as (keys, vals)
FROM my_table
WHERE src_file_dt = '1222') t1,
(
SELECT explode(map('Row Total', SUBSCRIBER_COMPLETE_TOTAL)) as (keys, vals)
FROM my_table
WHERE src_file_dt = '5221') t2
where t1.keys = t2.keys
但是当我对其进行参数化时,出现以下错误
[*org.apache.hive.service.cli.HiveSQLException:Error while compiling statement: FAILED: ParseException line 1:246 cannot recognize input near '?' ')' 't1' in expression specification:17:16
查询类似:
SELECT t1.keys as SUBSCRIBER_COMPLETE, t1.vals as previous_count, t2.vals as current_count from (
SELECT explode(map('Row Total', SUBSCRIBER_COMPLETE_TOTAL)) as (keys, vals)
FROM my_table
WHERE src_file_dt = ?) t1,
(
SELECT explode(map('Row Total', SUBSCRIBER_COMPLETE_TOTAL)) as (keys, vals)
FROM my_table
WHERE src_file_dt = ?) t2
where t1.keys = t2.keys
我什至把它当成一行来试:
SELECT t1.keys as SUBSCRIBER_COMPLETE, t1.vals as previous_count, t2.vals as current_count from (SELECT explode(map('Row Total', SUBSCRIBER_COMPLETE_TOTAL)) as (keys, vals) FROM my_table WHERE src_file_dt = ?) t1, (SELECT explode(map('Row Total', SUBSCRIBER_COMPLETE_TOTAL)) as (keys, vals) FROM my_table WHERE src_file_dt = ?) t2 where t1.keys = t2.keys
我一直无法让它发挥作用。好像是bug in Eclipse/BIRT
我可以通过在数据集的 beforeOpen 脚本中替换查询中的变量来解决这个问题,例如
this.queryText = String(queryText).replace("'prev'", params["PREV_DATE"]);
this.queryText = String(queryText).replace("'curr'", params["CURR_DATE"]);
birt 4.6.0
我有以下查询,它在 BIRT 和 DBViizualizer 中都有效:
SELECT t1.keys as SUBSCRIBER_COMPLETE, t1.vals as previous_count, t2.vals as current_count from (
SELECT explode(map('Row Total', SUBSCRIBER_COMPLETE_TOTAL)) as (keys, vals)
FROM my_table
WHERE src_file_dt = '1222') t1,
(
SELECT explode(map('Row Total', SUBSCRIBER_COMPLETE_TOTAL)) as (keys, vals)
FROM my_table
WHERE src_file_dt = '5221') t2
where t1.keys = t2.keys
但是当我对其进行参数化时,出现以下错误
[*org.apache.hive.service.cli.HiveSQLException:Error while compiling statement: FAILED: ParseException line 1:246 cannot recognize input near '?' ')' 't1' in expression specification:17:16
查询类似:
SELECT t1.keys as SUBSCRIBER_COMPLETE, t1.vals as previous_count, t2.vals as current_count from (
SELECT explode(map('Row Total', SUBSCRIBER_COMPLETE_TOTAL)) as (keys, vals)
FROM my_table
WHERE src_file_dt = ?) t1,
(
SELECT explode(map('Row Total', SUBSCRIBER_COMPLETE_TOTAL)) as (keys, vals)
FROM my_table
WHERE src_file_dt = ?) t2
where t1.keys = t2.keys
我什至把它当成一行来试:
SELECT t1.keys as SUBSCRIBER_COMPLETE, t1.vals as previous_count, t2.vals as current_count from (SELECT explode(map('Row Total', SUBSCRIBER_COMPLETE_TOTAL)) as (keys, vals) FROM my_table WHERE src_file_dt = ?) t1, (SELECT explode(map('Row Total', SUBSCRIBER_COMPLETE_TOTAL)) as (keys, vals) FROM my_table WHERE src_file_dt = ?) t2 where t1.keys = t2.keys
我一直无法让它发挥作用。好像是bug in Eclipse/BIRT
我可以通过在数据集的 beforeOpen 脚本中替换查询中的变量来解决这个问题,例如
this.queryText = String(queryText).replace("'prev'", params["PREV_DATE"]);
this.queryText = String(queryText).replace("'curr'", params["CURR_DATE"]);