Details
-
Bug
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
None
-
Normal
Description
In the case of a table with static columns, if only the static columns have been set for some partitions, a multi-partitions query with an ORDER BY can cause a NPE.
The following unit test can be used to reproduce the problem:
@Test public void testOrderByForInClauseWithNullValue() throws Throwable { createTable("CREATE TABLE %s (a int, b int, c int, s int static, d int, PRIMARY KEY (a, b, c))"); execute("INSERT INTO %s (a, b, c, d) VALUES (1, 1, 1, 1)"); execute("INSERT INTO %s (a, b, c, d) VALUES (1, 1, 2, 1)"); execute("INSERT INTO %s (a, b, c, d) VALUES (2, 2, 1, 1)"); execute("INSERT INTO %s (a, b, c, d) VALUES (2, 2, 2, 1)"); execute("UPDATE %s SET s = 1 WHERE a = 1"); execute("UPDATE %s SET s = 2 WHERE a = 2"); execute("UPDATE %s SET s = 3 WHERE a = 3"); assertRows(execute("SELECT a, b, c, d, s FROM %s WHERE a IN (1, 2, 3) ORDER BY b DESC"), row(2, 2, 2, 1, 2), row(2, 2, 1, 1, 2), row(1, 1, 2, 1, 1), row(1, 1, 1, 1, 1), row(3, null, null, null, 3)); }