Frans Drijver created HIVE-4663:
-----------------------------------
Summary: 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: 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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira