2013-06-04 72 views
0

我有一個關於在Impala上運行的查詢的簡單問題(我正在使用Pentaho報表設計器作爲我的報表工具)。查詢內容爲:Cloudera Impala中的SQL參數查詢

select a.*, b.sentatmosphere, b.sentgeneral, b.sentnetcharge, b.sentnetqual, b.sentservice, b.senttidiness 
from p_country_town_hotel a left outer join p_hotel_rev_agg b on (a.hotel = b.key) 
where a.country = ${Cntry} order by a.City limit 10000   

Pentaho Report設計器失敗。原因是參數,因爲如果我更改where子句,如:a.country = 'Denmark'然後我得到結果(子彈快速準確,這就是爲什麼我們想使用這個)。我知道Pentaho想用${}來編寫參數,但是我還沒有找到有關Impala使用/不使用參數的信息。任何信息,想法,任何東西?

回答

0

您是否嘗試過使用環境變量或配置單元配置變量對HQL進行參數化。你可以試試... ...

select a.*, b.sentatmosphere, b.sentgeneral, b.sentnetcharge, b.sentnetqual, b.sentservice, b.senttidiness from p_country_town_hotel a left outer join p_hotel_rev_agg b on (a.hotel = b.key) 
where a.country = ${env:Cntry} order by a.City limit 10000 

OR

select a.*, b.sentatmosphere, b.sentgeneral, b.sentnetcharge, b.sentnetqual, b.sentservice, b.senttidiness from p_country_town_hotel a left outer join p_hotel_rev_agg b on (a.hotel = b.key) 
where a.country = ${hiveconf:Cntry} order by a.City limit 10000