[ 
https://issues.apache.org/jira/browse/HIVE-4663?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Navis updated HIVE-4663:
------------------------
    Component/s: PTF-Windowing

> Needlessly adding analytical windowing columns to my select
> -----------------------------------------------------------
>
>                 Key: HIVE-4663
>                 URL: https://issues.apache.org/jira/browse/HIVE-4663
>             Project: Hive
>          Issue Type: Bug
>          Components: PTF-Windowing, SQL
>    Affects Versions: 0.11.0
>            Reporter: Frans Drijver
>
> Forgive the rather cryptic title, but I was unsure what the best summary 
> would be. The situation is as follows:
> If I have query in which I do both a select of a 'normal' column and an 
> analytical function, as so:
> {quote}
> select distinct 
> kastr.DELOGCE
> , lag(kastr.DEWNKNR) over ( partition by kastr.DEKTRNR order by 
> kastr.DETRADT, kastr.DEVPDNR )
> from RTAVP_DRKASTR kastr
> ;
> {quote}
> I get the following error:
> {quote}
> FAILED: SemanticException Failed to breakup Windowing invocations into 
> Groups. At least 1 group must only depend on input columns. Also check for 
> circular dependencies.
> Underlying error: org.apache.hadoop.hive.ql.parse.SemanticException: Line 
> 3:41 Expression not in GROUP BY key 'DEKTRNR'
> {quote}
> The way around is to also put the analytical windowing columns in my select, 
> as such:
> {quote}
> select distinct 
> kastr.DELOGCE
> , lag(kastr.DEWNKNR) over ( partition by kastr.DEKTRNR order by 
> kastr.DETRADT, kastr.DEVPDNR )
> , kastr.DEKTRNR
> , kastr.DEWNKNR
> , kastr.DETRADT
> , kastr.DEVPDNR
> from RTAVP_DRKASTR kastr
> ;
> {quote}
> Obviously this is generally unwanted behaviour, as it can widen the select 
> significantly



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to