hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shiv...@apache.org
Subject incubator-hawq git commit: HAWQ-779. support more pxf filter pushdwon
Date Wed, 06 Jul 2016 18:26:12 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master 87d37f08e -> 1a17238d3


HAWQ-779. support more pxf filter pushdwon


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

Branch: refs/heads/master
Commit: 1a17238d34cf66cdc52ea257bcdfdd0bdb497054
Parents: 87d37f0
Author: Shivram Mani <shivram.mani@gmail.com>
Authored: Wed Jul 6 11:26:07 2016 -0700
Committer: Shivram Mani <shivram.mani@gmail.com>
Committed: Wed Jul 6 11:26:07 2016 -0700

----------------------------------------------------------------------
 .../org/apache/hawq/pxf/api/FilterParser.java   |  4 +-
 .../apache/hawq/pxf/api/FilterParserTest.java   |  8 ++++
 .../pxf/plugins/hbase/HBaseFilterBuilder.java   |  2 +
 src/backend/access/external/pxffilters.c        | 48 +++++++++++++++++++-
 src/backend/optimizer/plan/createplan.c         |  2 +-
 src/include/access/pxffilters.h                 |  3 +-
 6 files changed, 62 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1a17238d/pxf/pxf-api/src/main/java/org/apache/hawq/pxf/api/FilterParser.java
----------------------------------------------------------------------
diff --git a/pxf/pxf-api/src/main/java/org/apache/hawq/pxf/api/FilterParser.java b/pxf/pxf-api/src/main/java/org/apache/hawq/pxf/api/FilterParser.java
index ae96d22..00fbf2b 100644
--- a/pxf/pxf-api/src/main/java/org/apache/hawq/pxf/api/FilterParser.java
+++ b/pxf/pxf-api/src/main/java/org/apache/hawq/pxf/api/FilterParser.java
@@ -61,7 +61,8 @@ public class FilterParser {
         HDOP_GE,
         HDOP_EQ,
         HDOP_NE,
-        HDOP_AND
+        HDOP_AND,
+        HDOP_LIKE
     }
 
     /**
@@ -392,6 +393,7 @@ public class FilterParser {
         operatorTranslationMap.put(5, Operation.HDOP_EQ);
         operatorTranslationMap.put(6, Operation.HDOP_NE);
         operatorTranslationMap.put(7, Operation.HDOP_AND);
+        operatorTranslationMap.put(8, Operation.HDOP_LIKE);
         return operatorTranslationMap;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1a17238d/pxf/pxf-api/src/test/java/org/apache/hawq/pxf/api/FilterParserTest.java
----------------------------------------------------------------------
diff --git a/pxf/pxf-api/src/test/java/org/apache/hawq/pxf/api/FilterParserTest.java b/pxf/pxf-api/src/test/java/org/apache/hawq/pxf/api/FilterParserTest.java
index 0308f7f..fdde9f0 100644
--- a/pxf/pxf-api/src/test/java/org/apache/hawq/pxf/api/FilterParserTest.java
+++ b/pxf/pxf-api/src/test/java/org/apache/hawq/pxf/api/FilterParserTest.java
@@ -215,6 +215,10 @@ public class FilterParserTest {
         filter = "a1c2o7";
         op = Operation.HDOP_AND;
         runParseOneOperation("this filter was build from HDOP_AND", filter, op);
+
+        filter = "a1c2o8";
+        op = Operation.HDOP_LIKE;
+        runParseOneOperation("this filter was build from HDOP_LIKE", filter, op);
     }
 
     @Test
@@ -247,6 +251,10 @@ public class FilterParserTest {
         filter = "c2a1o7";
         op = Operation.HDOP_AND;
         runParseOneOperation("this filter was build from HDOP_AND using reverse!", filter,
op);
+
+        filter = "c2a1o8";
+        op = Operation.HDOP_LIKE;
+        runParseOneOperation("this filter was build from HDOP_LIKE using reverse!", filter,
op);
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1a17238d/pxf/pxf-hbase/src/main/java/org/apache/hawq/pxf/plugins/hbase/HBaseFilterBuilder.java
----------------------------------------------------------------------
diff --git a/pxf/pxf-hbase/src/main/java/org/apache/hawq/pxf/plugins/hbase/HBaseFilterBuilder.java
b/pxf/pxf-hbase/src/main/java/org/apache/hawq/pxf/plugins/hbase/HBaseFilterBuilder.java
index 6dc271e..8dc932c 100644
--- a/pxf/pxf-hbase/src/main/java/org/apache/hawq/pxf/plugins/hbase/HBaseFilterBuilder.java
+++ b/pxf/pxf-hbase/src/main/java/org/apache/hawq/pxf/plugins/hbase/HBaseFilterBuilder.java
@@ -275,6 +275,8 @@ public class HBaseFilterBuilder implements FilterParser.FilterBuilder
{
                 startKey = Bytes.toBytes(key);
                 endKey = Bytes.add(Bytes.toBytes(key), zeroByte);
                 break;
+            default:
+                throw new Exception("unsupported operation for filtering " + op);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1a17238d/src/backend/access/external/pxffilters.c
----------------------------------------------------------------------
diff --git a/src/backend/access/external/pxffilters.c b/src/backend/access/external/pxffilters.c
index f219738..a08c82f 100644
--- a/src/backend/access/external/pxffilters.c
+++ b/src/backend/access/external/pxffilters.c
@@ -78,6 +78,7 @@ dbop_pxfop_map pxf_supported_opr[] =
 	{665 /* text_le */, PXFOP_LE},
 	{667 /* text_ge */, PXFOP_GE},
 	{531 /* textlt  */, PXFOP_NE},
+	{1209 /* textlike  */, PXFOP_LIKE},
 
 	/* int2 to int4 */
 	{Int24EqualOperator /* int24eq */, PXFOP_EQ},
@@ -125,7 +126,48 @@ dbop_pxfop_map pxf_supported_opr[] =
 	{1871 /* int82gt */, PXFOP_GT},
 	{1872 /* int82le */, PXFOP_LE},
 	{1873 /* int82ge */, PXFOP_GE},
-	{1869 /* int82ne */, PXFOP_NE}
+	{1869 /* int82ne */, PXFOP_NE},
+
+	/**************FLOAT****************/
+	/* float4 */
+	{Float4EqualOperator  /* float4eq */, PXFOP_EQ},
+	{622  /* float4lt */, PXFOP_LT},
+	{623 /* float4gt */, PXFOP_GT},
+	{624 /* float4le */, PXFOP_LE},
+	{625 /* float4ge */, PXFOP_GE},
+	{621 /* float4ne */, PXFOP_NE},
+
+	/* float8 */
+	{Float8EqualOperator  /* float8eq */, PXFOP_EQ},
+	{672  /* float8lt */, PXFOP_LT},
+	{674 /* float8gt */, PXFOP_GT},
+	{673 /* float8le */, PXFOP_LE},
+	{675 /* float8ge */, PXFOP_GE},
+	{671 /* float8ne */, PXFOP_NE},
+
+	/* float48 */
+	{1120  /* float48eq */, PXFOP_EQ},
+	{1122  /* float48lt */, PXFOP_LT},
+	{1123 /* float48gt */, PXFOP_GT},
+	{1124 /* float48le */, PXFOP_LE},
+	{1125 /* float48ge */, PXFOP_GE},
+	{1121 /* float48ne */, PXFOP_NE},
+
+	/* float84 */
+	{1130  /* float84eq */, PXFOP_EQ},
+	{1132  /* float84lt */, PXFOP_LT},
+	{1133 /* float84gt */, PXFOP_GT},
+	{1134 /* float84le */, PXFOP_LE},
+	{1135 /* float84ge */, PXFOP_GE},
+	{1131 /* float84ne */, PXFOP_NE},
+
+	/**********DATE************/
+	{DateEqualOperator  /* eq */, PXFOP_EQ},
+	{1095  /* date_lt */, PXFOP_LT},
+	{1097 /* date_gt */, PXFOP_GT},
+	{1096 /* date_le */, PXFOP_LE},
+	{1098 /* date_ge */, PXFOP_GE},
+	{1094 /* date_ne */, PXFOP_NE}
 
 };
 
@@ -142,7 +184,8 @@ Oid pxf_supported_types[] =
 	BPCHAROID,
 	CHAROID,
 	BYTEAOID,
-	BOOLOID
+	BOOLOID,
+	DATEOID
 };
 
 /*
@@ -513,6 +556,7 @@ const_to_str(Const *constval, StringInfo buf)
 		case BPCHAROID:
 		case CHAROID:
 		case BYTEAOID:
+		case DATEOID:
 			appendStringInfo(buf, "\\\"%s\\\"", extval);
 			break;
 

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1a17238d/src/backend/optimizer/plan/createplan.c
----------------------------------------------------------------------
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
index b5a5cea..65359bc 100644
--- a/src/backend/optimizer/plan/createplan.c
+++ b/src/backend/optimizer/plan/createplan.c
@@ -1146,7 +1146,7 @@ static char** create_pxf_plan(char **segdb_file_map, RelOptInfo *rel,
int total_
 	Relation relation = RelationIdGetRelation(planner_rt_fetch(scan_relid, ctx->root)->relid);
 	segdb_work_map = map_hddata_2gp_segments(uri_str, 
 											 total_segs, segs_participating,
-											 relation, NULL);
+											 relation, ctx->root->parse->jointree->quals);
 	Assert(segdb_work_map != NULL);
 	RelationClose(relation);
 	

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1a17238d/src/include/access/pxffilters.h
----------------------------------------------------------------------
diff --git a/src/include/access/pxffilters.h b/src/include/access/pxffilters.h
index 358cd8b..31481b5 100644
--- a/src/include/access/pxffilters.h
+++ b/src/include/access/pxffilters.h
@@ -44,7 +44,8 @@ typedef enum PxfOperatorCode
 	PXFOP_GE,
 	PXFOP_EQ,
 	PXFOP_NE,
-	PXFOP_AND
+	PXFOP_AND,
+	PXFOP_LIKE
 
 } PxfOperatorCode;
 


Mime
View raw message