Repository: incubator-hawq Updated Branches: refs/heads/master cb6811182 -> 2a0dd7dd3
HAWQ-1169. HAWQ Bridge incorrectly pushes T_NullTest predicates with byte arrays. Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/2a0dd7dd Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/2a0dd7dd Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/2a0dd7dd Branch: refs/heads/master Commit: 2a0dd7dd337348a6571c31313e6914cd8a91c0a6 Parents: cb68111 Author: Oleksandr Diachenko <[email protected]> Authored: Tue Nov 22 16:37:00 2016 -0800 Committer: Oleksandr Diachenko <[email protected]> Committed: Tue Nov 22 16:37:00 2016 -0800 ---------------------------------------------------------------------- src/backend/access/external/pxffilters.c | 13 ++++++++++--- src/backend/access/external/test/pxffilters_test.c | 3 +-- 2 files changed, 11 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/2a0dd7dd/src/backend/access/external/pxffilters.c ---------------------------------------------------------------------- diff --git a/src/backend/access/external/pxffilters.c b/src/backend/access/external/pxffilters.c index 3961b48..6699b84 100644 --- a/src/backend/access/external/pxffilters.c +++ b/src/backend/access/external/pxffilters.c @@ -184,7 +184,6 @@ Oid pxf_supported_types[] = VARCHAROID, BPCHAROID, CHAROID, - BYTEAOID, BOOLOID, DATEOID, TIMESTAMPOID @@ -434,15 +433,23 @@ pxf_serialize_filter_list(List *expressionItems) { elog(DEBUG1, "pxf_serialize_filter_list: node tag %d (T_NullTest)", tag); NullTest *expr = (NullTest *) node; + Var *var = (Var *) expr->arg; + + //TODO: add check for supported operation + if (!supported_filter_type(var->vartype)) + { + elog(DEBUG1, "Query will not be optimized to use filter push-down."); + return NULL; + } /* filter expression for T_NullTest will not have any constant value */ if (expr->nulltesttype == IS_NULL) { - appendStringInfo(resbuf, "%c%d%c%d", PXF_ATTR_CODE, ((Var *) expr->arg)->varattno - 1, PXF_OPERATOR_CODE, PXFOP_IS_NULL); + appendStringInfo(resbuf, "%c%d%c%d", PXF_ATTR_CODE, var->varattno - 1, PXF_OPERATOR_CODE, PXFOP_IS_NULL); } else if (expr->nulltesttype == IS_NOT_NULL) { - appendStringInfo(resbuf, "%c%d%c%d", PXF_ATTR_CODE, ((Var *) expr->arg)->varattno - 1, PXF_OPERATOR_CODE, PXFOP_IS_NOTNULL); + appendStringInfo(resbuf, "%c%d%c%d", PXF_ATTR_CODE, var->varattno - 1, PXF_OPERATOR_CODE, PXFOP_IS_NOTNULL); } else { http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/2a0dd7dd/src/backend/access/external/test/pxffilters_test.c ---------------------------------------------------------------------- diff --git a/src/backend/access/external/test/pxffilters_test.c b/src/backend/access/external/test/pxffilters_test.c index e618563..0e45eee 100644 --- a/src/backend/access/external/test/pxffilters_test.c +++ b/src/backend/access/external/test/pxffilters_test.c @@ -43,7 +43,6 @@ test__supported_filter_type(void **state) VARCHAROID, BPCHAROID, CHAROID, - BYTEAOID, BOOLOID, DATEOID, CIRCLEOID /* unsupported type */ @@ -65,7 +64,7 @@ test__supported_filter_type(void **state) /* go over pxf_supported_types array */ int nargs = sizeof(pxf_supported_types) / sizeof(Oid); - assert_int_equal(nargs, 14); + assert_int_equal(nargs, 13); for (i = 0; i < nargs; ++i) { assert_true(supported_filter_type(pxf_supported_types[i]));
