Aihua Xu created HIVE-10554:
-------------------------------

             Summary: The examples on windows function doc page are not correct
                 Key: HIVE-10554
                 URL: https://issues.apache.org/jira/browse/HIVE-10554
             Project: Hive
          Issue Type: Bug
          Components: Documentation
            Reporter: Aihua Xu


In the following doc page for windowing functions, 

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+WindowingAndAnalytics

On the bottom of the page, we list two examples: LEAD(a) and LAG(a) for "rows 
between".

{noformat}
LEAD using default 1 row lead and not specifying default value
SELECT a, LEAD(a) OVER (PARTITION BY b ORDER BY C ROWS BETWEEN CURRENT ROW AND 
1 FOLLOWING)
FROM T;
LAG specifying a lag of 3 rows and default value of 0
SELECT a, LAG(a, 3, 0) OVER (PARTITION BY b ORDER BY C ROWS 3 PRECEDING)
FROM T;
{noformat}

Actually LEAD and LAG functions don't support window frames since it's always 
relative to the current row. We can switch to functions like "first_value(), 
count(*)", etc.  




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

Reply via email to