Krisztian Kasa created HIVE-23101:
-------------------------------------

             Summary: Fix topnkey_grouping_sets
                 Key: HIVE-23101
                 URL: https://issues.apache.org/jira/browse/HIVE-23101
             Project: Hive
          Issue Type: Sub-task
            Reporter: Krisztian Kasa
            Assignee: Krisztian Kasa
             Fix For: 4.0.0


Test *topnkey_grouping_sets* fails intermittently.

Queries which project 2 columns but order by only one of them can have more 
than one good result set:
{code}
CREATE TABLE t_test_grouping_sets(
  a int,
  b int,
  c int
);

INSERT INTO t_test_grouping_sets VALUES
(NULL, NULL, NULL),
(5, 2, 3),
(10, 11, 12),
(NULL, NULL, NULL),
(NULL, NULL, NULL),
(6, 2, 1),
(7, 8, 4), (7, 8, 4), (7, 8, 4),
(5, 1, 2), (5, 1, 2), (5, 1, 2),
(NULL, NULL, NULL);

SELECT a, b FROM t_test_grouping_sets GROUP BY GROUPING SETS ((a, b), (a), (b), 
()) ORDER BY a LIMIT 10;
{code}
{code}
5       NULL
5       2
5       1
6       2
6       NULL
7       8
7       NULL
10      NULL
10      11
NULL    1
{code}
{code}
5       NULL
5       2
5       1
6       2
6       NULL
7       8
7       NULL
10      NULL
10      11
NULL    NULL
{code}
Since we don't order by *b* both result sets are valid.




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to