phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sama...@apache.org
Subject phoenix git commit: PHOENIX-4243 Using rowtimestamp column with RVC causes an exception sometimes
Date Fri, 29 Sep 2017 05:37:57 GMT
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.2 fc18cd609 -> acf89db38


PHOENIX-4243 Using rowtimestamp column with RVC causes an exception sometimes


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/acf89db3
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/acf89db3
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/acf89db3

Branch: refs/heads/4.x-HBase-1.2
Commit: acf89db38e5b411484603acfa6211d3aaa185c50
Parents: fc18cd6
Author: Samarth Jain <samarth@apache.org>
Authored: Thu Sep 28 22:37:51 2017 -0700
Committer: Samarth Jain <samarth@apache.org>
Committed: Thu Sep 28 22:37:51 2017 -0700

----------------------------------------------------------------------
 .../apache/phoenix/end2end/UpsertSelectIT.java  | 25 ++++++++++----------
 .../org/apache/phoenix/compile/ScanRanges.java  |  4 ++--
 2 files changed, 14 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/acf89db3/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
index 6bf6be5..55f2dd0 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
@@ -1239,19 +1239,18 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT {
         
         // Verify that the data upserted using the tenant view can now be queried using tenant
view
         try (Connection tenantConn = getTenantConnection(tenantId)) {
-            //TODO: enable after PHOENIX-4243 is fixed    
-//            // Query the base table
-//            PreparedStatement stmt = tenantConn.prepareStatement("SELECT * FROM  " + tenantView
+ " WHERE (PK2, PK3) IN ((?, ?), (?, ?)) ORDER BY KV1");
-//            stmt.setDate(1, upsertedDate);
-//            stmt.setInt(2, 33);
-//            stmt.setDate(3, new Date(upsertedTs));
-//            stmt.setInt(4, 44);
-//            ResultSet rs = stmt.executeQuery();
-//            assertTrue(rs.next());
-//            assertEquals("KV13", rs.getString("KV1"));
-//            assertTrue(rs.next());
-//            assertEquals("KV14", rs.getString("KV1"));
-//            assertFalse(rs.next());
+            // Query the base table
+            PreparedStatement stmt = tenantConn.prepareStatement("SELECT * FROM  " + tenantView
+ " WHERE (PK2, PK3) IN ((?, ?), (?, ?)) ORDER BY KV1");
+            stmt.setDate(1, upsertedDate);
+            stmt.setInt(2, 33);
+            stmt.setDate(3, new Date(upsertedTs));
+            stmt.setInt(4, 44);
+            ResultSet rs = stmt.executeQuery();
+            assertTrue(rs.next());
+            assertEquals("KV13", rs.getString("KV1"));
+            assertTrue(rs.next());
+            assertEquals("KV14", rs.getString("KV1"));
+            assertFalse(rs.next());
             
             //TODO: uncomment the code after PHOENIX-2277 is fixed
 //            // Query using the index on the tenantView

http://git-wip-us.apache.org/repos/asf/phoenix/blob/acf89db3/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java
index 5a1fcb7..a7909fb 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java
@@ -650,8 +650,8 @@ public class ScanRanges {
                     //ranges.set(rowTimestampColPos, sortedRange); //TODO: do I really need
to do this?
                     Field f = schema.getField(rowTimestampColPos);
                     SortOrder order = f.getSortOrder();
-                    KeyRange lowestRange = rowTimestampColRange.get(0);
-                    KeyRange highestRange = rowTimestampColRange.get(rowTimestampColRange.size()
- 1);
+                    KeyRange lowestRange = sortedRange.get(0);
+                    KeyRange highestRange = sortedRange.get(rowTimestampColRange.size() -
1);
                     if (order == SortOrder.DESC) {
                         return getDescTimeRange(lowestRange, highestRange, f);
                     }


Mime
View raw message