This is an automated email from the ASF dual-hosted git repository. parthc pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/drill.git
commit 0d5eda83fe34928ff60629e6a4903d43a1d82582 Author: Akihiko Kusanagi <[email protected]> AuthorDate: Wed Nov 4 21:33:06 2015 +0900 DRILL-4020: The not-equal operator returns incorrect results when used on the HBase row key - Added a condition that checks if the filter to the scan specification doesn't have NOT_EQUAL operator - Added testFilterPushDownRowKeyNotEqual() to TestHBaseFilterPushDown This closes #309 --- .../drill/exec/store/hbase/HBaseFilterBuilder.java | 1 + .../apache/drill/hbase/TestHBaseFilterPushDown.java | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseFilterBuilder.java b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseFilterBuilder.java index 8d2e8ff..6e1efe5 100644 --- a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseFilterBuilder.java +++ b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseFilterBuilder.java @@ -61,6 +61,7 @@ public class HBaseFilterBuilder extends AbstractExprVisitor<HBaseScanSpec, Void, * remove it since its effect is also achieved through startRow and stopRow. */ if (parsedSpec.filter instanceof RowFilter && + ((RowFilter)parsedSpec.filter).getOperator() != CompareOp.NOT_EQUAL && ((RowFilter)parsedSpec.filter).getComparator() instanceof BinaryComparator) { parsedSpec.filter = null; } diff --git a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseFilterPushDown.java b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseFilterPushDown.java index 0e14cb1..e70cf08 100644 --- a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseFilterPushDown.java +++ b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseFilterPushDown.java @@ -45,6 +45,24 @@ public class TestHBaseFilterPushDown extends BaseHBaseTest { } @Test + public void testFilterPushDownRowKeyNotEqual() throws Exception { + setColumnWidths(new int[] {8, 38, 38}); + final String sql = "SELECT\n" + + " *\n" + + "FROM\n" + + " hbase.`[TABLE_NAME]` tableName\n" + + "WHERE\n" + + " row_key <> 'b4'"; + + runHBaseSQLVerifyCount(sql, 6); + + final String[] expectedPlan = {".*startRow=, stopRow=, filter=RowFilter \\(NOT_EQUAL, b4\\).*"}; + final String[] excludedPlan ={}; + final String sqlHBase = canonizeHBaseSQL(sql); + PlanTestBase.testPlanMatchingPatterns(sqlHBase, expectedPlan, excludedPlan); + } + + @Test public void testFilterPushDownRowKeyEqualWithItem() throws Exception { setColumnWidths(new int[] {20, 30}); final String sql = "SELECT\n" -- To stop receiving notification emails like this one, please contact [email protected].
