HAWQ-964. Add New Filter Classes
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/545f8aa0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/545f8aa0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/545f8aa0 Branch: refs/heads/HAWQ-964 Commit: 545f8aa0ab28f2a1112fb43d232e9db2b2cc5a80 Parents: 726be6c Author: Kavinder Dhaliwal <[email protected]> Authored: Mon Sep 19 14:25:08 2016 -0700 Committer: Kavinder Dhaliwal <[email protected]> Committed: Tue Sep 20 09:45:44 2016 -0700 ---------------------------------------------------------------------- .../org/apache/hawq/pxf/api/BasicFilter.java | 37 ++++++++++++++++++++ .../org/apache/hawq/pxf/api/LogicalFilter.java | 30 ++++++++++++++++ .../plugins/hbase/HBaseFilterBuilderTest.java | 16 +++++++++ 3 files changed, 83 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/545f8aa0/pxf/pxf-api/src/main/java/org/apache/hawq/pxf/api/BasicFilter.java ---------------------------------------------------------------------- diff --git a/pxf/pxf-api/src/main/java/org/apache/hawq/pxf/api/BasicFilter.java b/pxf/pxf-api/src/main/java/org/apache/hawq/pxf/api/BasicFilter.java new file mode 100644 index 0000000..a35a9dd --- /dev/null +++ b/pxf/pxf-api/src/main/java/org/apache/hawq/pxf/api/BasicFilter.java @@ -0,0 +1,37 @@ +package org.apache.hawq.pxf.api; + +/** + * Basic filter provided for cases where the target storage system does not provide it own filter + * For example: Hbase storage provides its own filter but for a Writable based record in a + * SequenceFile there is no filter provided and so we need to have a default + */ +public class BasicFilter { + private FilterParser.Operation oper; + private FilterParser.ColumnIndex column; + private FilterParser.Constant constant; + + /** + * Constructs a BasicFilter. + * + * @param oper the parse operation to perform + * @param column the column index + * @param constant the constant object + */ + public BasicFilter(FilterParser.Operation oper, FilterParser.ColumnIndex column, FilterParser.Constant constant) { + this.oper = oper; + this.column = column; + this.constant = constant; + } + + public FilterParser.Operation getOperation() { + return oper; + } + + public FilterParser.ColumnIndex getColumn() { + return column; + } + + public FilterParser.Constant getConstant() { + return constant; + } +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/545f8aa0/pxf/pxf-api/src/main/java/org/apache/hawq/pxf/api/LogicalFilter.java ---------------------------------------------------------------------- diff --git a/pxf/pxf-api/src/main/java/org/apache/hawq/pxf/api/LogicalFilter.java b/pxf/pxf-api/src/main/java/org/apache/hawq/pxf/api/LogicalFilter.java new file mode 100644 index 0000000..d7e570e --- /dev/null +++ b/pxf/pxf-api/src/main/java/org/apache/hawq/pxf/api/LogicalFilter.java @@ -0,0 +1,30 @@ +package org.apache.hawq.pxf.api; + + +import java.util.List; + +public class LogicalFilter { + private FilterParser.LogicalOperation operator; + private List<Object> filterList; + + public LogicalFilter(FilterParser.LogicalOperation operator, List<Object> result) { + this.operator = operator; + this.filterList = result; + } + + public FilterParser.LogicalOperation getOperator() { + return operator; + } + + public void setOperator(FilterParser.LogicalOperation operator) { + this.operator = operator; + } + + public List<Object> getFilterList() { + return filterList; + } + + public void setFilterList(List<Object> filterList) { + this.filterList = filterList; + } +} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/545f8aa0/pxf/pxf-hbase/src/test/java/org/apache/hawq/pxf/plugins/hbase/HBaseFilterBuilderTest.java ---------------------------------------------------------------------- diff --git a/pxf/pxf-hbase/src/test/java/org/apache/hawq/pxf/plugins/hbase/HBaseFilterBuilderTest.java b/pxf/pxf-hbase/src/test/java/org/apache/hawq/pxf/plugins/hbase/HBaseFilterBuilderTest.java new file mode 100644 index 0000000..9bc5474 --- /dev/null +++ b/pxf/pxf-hbase/src/test/java/org/apache/hawq/pxf/plugins/hbase/HBaseFilterBuilderTest.java @@ -0,0 +1,16 @@ +package org.apache.hawq.pxf.plugins.hbase; + +import org.junit.Test; + +import static org.junit.Assert.*; + +public class HBaseFilterBuilderTest { + + @Test + public void parseNOTExpressionIgnored() throws Exception { + String filter = "a1c2o1a1c2o2l0l2"; + HBaseFilterBuilder builder = new HBaseFilterBuilder(null); + assertNull(builder.getFilterObject(filter)); + } + +} \ No newline at end of file
