2013-05-29 44 views
0

我嘗試以下操作:結束語分析功能在其他功能配置單元0.11

select case when ta_end_datetime_berekenen = 'Y' then lead(ta_update_datetime) over (partition by dn_waarde_van, dn_waarde_tot order by ta_update_datetime) else ea_end_datetime end ea_end_datetime, ta_insert_datetime, ta_update_datetime from tmp_wtdh_bestedingsklasse_10_s2_stap2

然而,當我嘗試,我得到以下錯誤:

NoViableAltException([email protected][129:7: (((KW_AS)? identifier) | (KW_AS LPAREN identifier (COMMA identifier)* RPAREN))?])

FAILED: ParseException line 1:175 missing KW_END at 'over' near ')' in selection target line 1:254 cannot recognize input near 'else' 'ea_end_datetime' 'end' in selection target

請問我是正確的假設不可能在另一個函數中包含分析函數?

這是Hive 0.11。

回答

1

不確定這是問題的根源,但似乎您的查詢缺少AS關鍵字(請注意下面第8行的全部大寫AS)。

select 
    case 
     when ta_end_datetime_berekenen = 'Y' 
    then 
     lead(ta_update_datetime) over (partition by dn_waarde_van, dn_waarde_tot order by ta_update_datetime) 
    else 
     ea_end_datetime 
    end AS ea_end_datetime, 
    ta_insert_datetime, 
    ta_update_datetime 
from tmp_wtdh_bestedingsklasse_10_s2_stap2