You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by od...@apache.org on 2016/10/05 18:29:19 UTC

[09/18] incubator-hawq git commit: HAWQ-964. Fix issues where only one filter is present

HAWQ-964. Fix issues where only one filter is present


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/8f73c2b9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/8f73c2b9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/8f73c2b9

Branch: refs/heads/HAWQ-964
Commit: 8f73c2b9295e93be68958b0c6b35a53143e5f7a7
Parents: 93052b9
Author: Kavinder Dhaliwal <ka...@gmail.com>
Authored: Thu Sep 22 11:34:11 2016 -0700
Committer: Kavinder Dhaliwal <ka...@gmail.com>
Committed: Thu Sep 22 11:34:11 2016 -0700

----------------------------------------------------------------------
 .../apache/hawq/pxf/plugins/hive/HiveAccessor.java    |  2 +-
 .../apache/hawq/pxf/plugins/hive/HiveORCAccessor.java | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8f73c2b9/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/HiveAccessor.java
----------------------------------------------------------------------
diff --git a/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/HiveAccessor.java b/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/HiveAccessor.java
index 2f1c26e..b2b3e4b 100644
--- a/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/HiveAccessor.java
+++ b/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/HiveAccessor.java
@@ -276,7 +276,7 @@ public class HiveAccessor extends HdfsSplittableDataAccessor {
                                   Object filter, InputData input) {
         // Let's look first at the filter and escape if there are any OR or NOT ops
         if (!testForUnsupportedOperators(Arrays.asList(filter)))
-            return false;
+            return true;
 
         return testForPartitionEquality(partitionFields, Arrays.asList(filter), input);
     }

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8f73c2b9/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/HiveORCAccessor.java
----------------------------------------------------------------------
diff --git a/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/HiveORCAccessor.java b/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/HiveORCAccessor.java
index 195382a..ab2f96e 100644
--- a/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/HiveORCAccessor.java
+++ b/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/HiveORCAccessor.java
@@ -100,7 +100,19 @@ public class HiveORCAccessor extends HiveAccessor {
         HiveFilterBuilder eval = new HiveFilterBuilder(inputData);
         Object filter = eval.getFilterObject(filterStr);
         SearchArgument.Builder filterBuilder = SearchArgumentFactory.newBuilder();
-        buildExpression(filterBuilder, Arrays.asList(filter));
+
+        /*
+         * If there is only a single filter it will be of type Basic Filter
+         * need special case logic to make sure to still wrap the filter in a
+         * startAnd() & end() block
+         */
+        if (filter instanceof LogicalFilter)
+            buildExpression(filterBuilder, Arrays.asList(filter));
+        else {
+            filterBuilder.startAnd();
+            buildArgument(filterBuilder, filter);
+            filterBuilder.end();
+        }
         SearchArgument sarg = filterBuilder.build();
         jobConf.set(SARG_PUSHDOWN, sarg.toKryo());
     }