You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ra...@apache.org on 2014/10/20 17:53:55 UTC
git commit: PHOENIX-1314 Assertion tripped for skip scan with two
unit tests-addendum(Rajeshbabu)
Repository: phoenix
Updated Branches:
refs/heads/master 91004269a -> ea6b05386
PHOENIX-1314 Assertion tripped for skip scan with two unit tests-addendum(Rajeshbabu)
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/ea6b0538
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/ea6b0538
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/ea6b0538
Branch: refs/heads/master
Commit: ea6b05386493380b7cd2de9a54185a62b608b801
Parents: 9100426
Author: Rajeshbabu Chintaguntla <ra...@apache.org>
Authored: Mon Oct 20 15:53:34 2014 +0000
Committer: Rajeshbabu Chintaguntla <ra...@apache.org>
Committed: Mon Oct 20 15:53:34 2014 +0000
----------------------------------------------------------------------
.../phoenix/end2end/index/MutableIndexIT.java | 81 ++++++++++++++++++++
.../apache/phoenix/filter/SkipScanFilter.java | 7 +-
2 files changed, 86 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/ea6b0538/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java
index 75b6c4e..429f96c 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java
@@ -1249,4 +1249,85 @@ public class MutableIndexIT extends BaseMutableIndexIT {
}
}
+ @Test
+ public void testSkipScanFilterWhenTableHasMultipleColumnFamilies() throws Exception {
+ Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+ Connection conn = DriverManager.getConnection(getUrl(), props);
+ conn.setAutoCommit(false);
+ try {
+ createTestTable();
+ populateTestTable();
+ String upsert = "UPSERT INTO " + DATA_TABLE_FULL_NAME
+ + " VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+ PreparedStatement stmt = conn.prepareStatement(upsert);
+ stmt.setString(1, "varchar4");
+ stmt.setString(2, "char1");
+ stmt.setInt(3, 1);
+ stmt.setLong(4, 1L);
+ stmt.setBigDecimal(5, new BigDecimal("1.1"));
+ stmt.setString(6, "varchar_a");
+ stmt.setString(7, "chara");
+ stmt.setInt(8, 2);
+ stmt.setLong(9, 2L);
+ stmt.setBigDecimal(10, new BigDecimal("2.1"));
+ stmt.setString(11, "varchar_b");
+ stmt.setString(12, "charb");
+ stmt.setInt(13, 3);
+ stmt.setLong(14, 3L);
+ stmt.setBigDecimal(15, new BigDecimal("3.1"));
+ stmt.setDate(16, null);
+ stmt.executeUpdate();
+
+ stmt.setString(1, "varchar5");
+ stmt.setString(2, "char2");
+ stmt.setInt(3, 2);
+ stmt.setLong(4, 2L);
+ stmt.setBigDecimal(5, new BigDecimal("2.2"));
+ stmt.setString(6, "varchar_a");
+ stmt.setString(7, "chara");
+ stmt.setInt(8, 3);
+ stmt.setLong(9, 3L);
+ stmt.setBigDecimal(10, new BigDecimal("3.2"));
+ stmt.setString(11, "varchar_b");
+ stmt.setString(12, "charb");
+ stmt.setInt(13, 4);
+ stmt.setLong(14, 4L);
+ stmt.setBigDecimal(15, new BigDecimal("4.2"));
+ stmt.setDate(16, null);
+ stmt.executeUpdate();
+
+ stmt.setString(1, "varchar6");
+ stmt.setString(2, "char3");
+ stmt.setInt(3, 3);
+ stmt.setLong(4, 3L);
+ stmt.setBigDecimal(5, new BigDecimal("3.3"));
+ stmt.setString(6, "varchar_a");
+ stmt.setString(7, "chara");
+ stmt.setInt(8, 4);
+ stmt.setLong(9, 4L);
+ stmt.setBigDecimal(10, new BigDecimal("4.3"));
+ stmt.setString(11, "varchar_b");
+ stmt.setString(12, "charb");
+ stmt.setInt(13, 5);
+ stmt.setLong(14, 5L);
+ stmt.setBigDecimal(15, new BigDecimal("5.3"));
+ stmt.setDate(16, null);
+ stmt.executeUpdate();
+ conn.commit();
+ String query = "SELECT char_col1, int_col1, long_col2 from " + DATA_TABLE_FULL_NAME + " where varchar_pk in ('varchar3','varchar6')";
+ ResultSet rs = conn.createStatement().executeQuery(query);
+ assertTrue(rs.next());
+ assertEquals("chara", rs.getString(1));
+ assertEquals(4, rs.getInt(2));
+ assertEquals(5L, rs.getLong(3));
+ assertTrue(rs.next());
+ assertEquals("chara", rs.getString(1));
+ assertEquals(4, rs.getInt(2));
+ assertEquals(5L, rs.getLong(3));
+ assertFalse(rs.next());
+
+ } finally {
+ conn.close();
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/phoenix/blob/ea6b0538/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java b/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java
index bdfafb3..df5a2af 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/filter/SkipScanFilter.java
@@ -151,8 +151,11 @@ public class SkipScanFilter extends FilterBase implements Writable {
}
Cell previousCellHint = nextCellHintMap.put(family, nextCellHint);
// we should either have no previous hint, or the next hint should always come after the previous hint
- assert previousCellHint == null || KeyValue.COMPARATOR.compare(nextCellHint, previousCellHint) > 0
- : "next hint must come after previous hint (prev=" + previousCellHint + ", next=" + nextCellHint + ", kv=" + kv + ")";
+ assert previousCellHint == null
+ || Bytes.compareTo(nextCellHint.getRowArray(), nextCellHint.getRowOffset(),
+ nextCellHint.getRowLength(), previousCellHint.getRowArray(), previousCellHint
+ .getRowOffset(), previousCellHint.getRowLength()) > 0 : "next hint must come after previous hint (prev="
+ + previousCellHint + ", next=" + nextCellHint + ", kv=" + kv + ")";
}
@Override