phoenix-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [phoenix] comnetwork commented on a change in pull request #444: PHOENIX-5148
Date Fri, 15 Mar 2019 03:08:21 GMT
comnetwork commented on a change in pull request #444: PHOENIX-5148
URL: https://github.com/apache/phoenix/pull/444#discussion_r265831803
 
 

 ##########
 File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/SortMergeJoinMoreIT.java
 ##########
 @@ -423,7 +424,7 @@ public void testBug2894() throws Exception {
                         "         ) L\n" +
                         "     ON L.BUCKET = E.BUCKET AND L.TIMESTAMP = E.TIMESTAMP\n" +
                         " ) C\n" +
-                        " GROUP BY C.BUCKET, C.TIMESTAMP";
+                        " GROUP BY C.BUCKET, C.TIMESTAMP ORDER BY C.BUCKET, C.TIMESTAMP";
 
 Review comment:
   I added the order by here mainly for:
   1.Make the query result stable,because the original sql is only have  group by clause,
and the group by is not `orderPreserving` before this patch, so must add a additional `SORTED
BY [E.TIMESTAMP, E.BUCKET]`, but after this patch, the group by is  `orderPreserving`, so
the query result is not same as without this patch.
   2. To test if the GroupBy and OrderBy could both be optimized, from the explain we can
see the 
   `GROUP BY C.BUCKET, C.TIMESTAMP` is  `orderPreserving` and `ORDER BY C.BUCKET, C.TIMESTAMP`
is compiled out.
   
   If I do not add the order by, the explain assertion and query result assertion is same
as the order by is added. 
   
   Another curious problem  is that  why the order of query result is reversed after this
patch:
   
   the query result before this patch is :
                   assertEquals("5SEC", rs.getString(1));
                   assertEquals(1462993520000000000L, rs.getLong(2));
                   assertTrue(rs.next());
                   assertEquals("5SEC", rs.getString(1));
                   assertEquals(1462993515000000000L, rs.getLong(2));
                   assertTrue(rs.next());
                   assertEquals("5SEC", rs.getString(1));
                   assertEquals(1462993510000000000L, rs.getLong(2));
                   assertTrue(rs.next());
                   assertEquals("5SEC", rs.getString(1));
                   assertEquals(1462993505000000000L, rs.getLong(2));
                   assertTrue(rs.next());
                   assertEquals("5SEC", rs.getString(1));
                   assertEquals(1462993490000000000L, rs.getLong(2));
                   assertTrue(rs.next());
                   assertEquals("5SEC", rs.getString(1));
                   assertEquals(1462993485000000000L, rs.getLong(2));
                   assertTrue(rs.next());
                   assertEquals("5SEC", rs.getString(1));
                   assertEquals(1462993480000000000L, rs.getLong(2));
                   assertTrue(rs.next());
                   assertEquals("5SEC", rs.getString(1));
                   assertEquals(1462993475000000000L, rs.getLong(2));
                   assertTrue(rs.next());
                   assertEquals("5SEC", rs.getString(1));
                   assertEquals(1462993470000000000L, rs.getLong(2));
                   assertTrue(rs.next());
                   assertEquals("5SEC", rs.getString(1));
                   assertEquals(1462993430000000000L, rs.getLong(2));
   
   the query result after this patch is :
                  assertEquals("5SEC", rs.getString(1));
                   assertEquals(1462993430000000000L, rs.getLong(2));
                   assertTrue(rs.next());
                   assertEquals("5SEC", rs.getString(1));
                   assertEquals(1462993470000000000L, rs.getLong(2));
                   assertTrue(rs.next());
                   assertEquals("5SEC", rs.getString(1));
                   assertEquals(1462993475000000000L, rs.getLong(2));
                   assertTrue(rs.next());
                   assertEquals("5SEC", rs.getString(1));
                   assertEquals(1462993480000000000L, rs.getLong(2));
                   assertTrue(rs.next());
                   assertEquals("5SEC", rs.getString(1));
                   assertEquals(1462993485000000000L, rs.getLong(2));
                   assertTrue(rs.next());
                   assertEquals("5SEC", rs.getString(1));
                   assertEquals(1462993490000000000L, rs.getLong(2));
                   assertTrue(rs.next());
                   assertEquals("5SEC", rs.getString(1));
                   assertEquals(1462993505000000000L, rs.getLong(2));
                   assertTrue(rs.next());
                   assertEquals("5SEC", rs.getString(1));
                   assertEquals(1462993510000000000L, rs.getLong(2));
                   assertTrue(rs.next());
                   assertEquals("5SEC", rs.getString(1));
                   assertEquals(1462993515000000000L, rs.getLong(2));
                   assertTrue(rs.next());
                   assertEquals("5SEC", rs.getString(1));
                   assertEquals(1462993520000000000L, rs.getLong(2));
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message