Karthik Shivanna created HIVE-20230:
---------------------------------------

             Summary: Hive - 
                 Key: HIVE-20230
                 URL: https://issues.apache.org/jira/browse/HIVE-20230
             Project: Hive
          Issue Type: Bug
          Components: Hive
    Affects Versions: 1.2.1
            Reporter: Karthik Shivanna


Hive Queries giving same results for different requirements

Below is how to replicate the scenario: The result set should be as below.

But on hive, it gives the same result for both the queries

 

CREATE TABLE TEST_RANGE ( a int, b int) INSERT INTO TEST_RANGE VALUES(1, 1); 
INSERT INTO TEST_RANGE VALUES(2, 5); INSERT INTO TEST_RANGE VALUES(3, 3); 
INSERT INTO TEST_RANGE VALUES(4, 5); INSERT INTO TEST_RANGE VALUES(5, 4); 
INSERT INTO TEST_RANGE VALUES(6, 11);

 

SELECT a, b, sum(b) OVER (ORDER BY a ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) 
FROM test_range ORDER BY a;

1;1;6 2;5;9 3;3;13 4;5;12 5;4;20 6;11;15

SELECT a, b, sum(b) OVER (ORDER BY a ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) 
FROM test_range ORDER BY a;

 

1;1; 2;5;1 3;3;5 4;5;3 5;4;5 6;11;4



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to