Repository: incubator-hawq
Updated Branches:
  refs/heads/HAWQ-1103 [created] 2497b6f32


HAWQ-1103. Draft implementation without taking care of different charsets.


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

Branch: refs/heads/HAWQ-1103
Commit: b318fa0e7d038084ded2bc99c6e631aa26700b21
Parents: 7f3658d
Author: Oleksandr Diachenko <odiache...@pivotal.io>
Authored: Thu Oct 13 16:00:03 2016 -0700
Committer: Oleksandr Diachenko <odiache...@pivotal.io>
Committed: Thu Oct 13 16:00:03 2016 -0700

----------------------------------------------------------------------
 src/backend/access/external/pxffilters.c | 25 +++++++++++++++----------
 src/include/access/pxffilters.h          |  9 ++++++---
 2 files changed, 21 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/b318fa0e/src/backend/access/external/pxffilters.c
----------------------------------------------------------------------
diff --git a/src/backend/access/external/pxffilters.c 
b/src/backend/access/external/pxffilters.c
index 56aea55..ded9f9a 100644
--- a/src/backend/access/external/pxffilters.c
+++ b/src/backend/access/external/pxffilters.c
@@ -369,14 +369,18 @@ pxf_serialize_filter_list(List *expressionItems)
                                        PxfOperatorCode o = filter->op;
                                        if (pxfoperand_is_attr(l) && 
pxfoperand_is_const(r))
                                        {
-                                               appendStringInfo(resbuf, 
"%c%d%c%s",
+                                               appendStringInfo(resbuf, 
"%c%d%c%d%c%d%c%s",
                                                                                
                 PXF_ATTR_CODE, l.attnum - 1, /* Java attrs are 0-based */
-                                                                               
                 PXF_CONST_CODE, (r.conststr)->data);
+                                                                               
                 PXF_CONST_CODE, r.consttype,
+                                                                               
                 PXF_LENGTH_TO_READ, strlen(r.conststr->data),
+                                                                               
                 PXF_CONST_DATA, (r.conststr)->data);
                                        }
                                        else if (pxfoperand_is_const(l) && 
pxfoperand_is_attr(r))
                                        {
-                                               appendStringInfo(resbuf, 
"%c%s%c%d",
-                                                                               
                 PXF_CONST_CODE, (l.conststr)->data,
+                                               appendStringInfo(resbuf, 
"%c%d%c%d%c%s%c%d",
+                                                                               
                 PXF_CONST_CODE, l.consttype,
+                                                                               
                 PXF_LENGTH_TO_READ, strlen(l.conststr->data),
+                                                                               
                 PXF_CONST_DATA, (l.conststr)->data,
                                                                                
                 PXF_ATTR_CODE, r.attnum - 1); /* Java attrs are 0-based */
                                        }
                                        else
@@ -468,6 +472,7 @@ opexpr_to_pxffilter(OpExpr *expr, PxfFilterDesc *filter)
        {
                filter->l.opcode = PXF_ATTR_CODE;
                filter->l.attnum = ((Var *) leftop)->varattno;
+               filter->l.consttype = InvalidOid;
                if (filter->l.attnum <= InvalidAttrNumber)
                        return false; /* system attr not supported */
 
@@ -476,6 +481,7 @@ opexpr_to_pxffilter(OpExpr *expr, PxfFilterDesc *filter)
                filter->r.conststr = makeStringInfo();
                initStringInfo(filter->r.conststr);
                const_to_str((Const *)rightop, filter->r.conststr);
+               filter->r.consttype = ((Const *)rightop)->consttype;
        }
        else if (IsA(leftop, Const) && IsA(rightop, Var))
        {
@@ -484,9 +490,11 @@ opexpr_to_pxffilter(OpExpr *expr, PxfFilterDesc *filter)
                filter->l.conststr = makeStringInfo();
                initStringInfo(filter->l.conststr);
                const_to_str((Const *)leftop, filter->l.conststr);
+               filter->l.consttype = ((Const *)leftop)->consttype;
 
                filter->r.opcode = PXF_ATTR_CODE;
                filter->r.attnum = ((Var *) rightop)->varattno;
+               filter->r.consttype = InvalidOid;
                if (filter->r.attnum <= InvalidAttrNumber)
                        return false; /* system attr not supported */
        }
@@ -632,9 +640,6 @@ const_to_str(Const *constval, StringInfo buf)
                case FLOAT4OID:
                case FLOAT8OID:
                case NUMERICOID:
-                       appendStringInfo(buf, "%s", extval);
-                       break;
-
                case TEXTOID:
                case VARCHAROID:
                case BPCHAROID:
@@ -642,14 +647,14 @@ const_to_str(Const *constval, StringInfo buf)
                case BYTEAOID:
                case DATEOID:
                case TIMESTAMPOID:
-                       appendStringInfo(buf, "\\\"%s\\\"", extval);
+                       appendStringInfo(buf, "%s", extval);
                        break;
 
                case BOOLOID:
                        if (strcmp(extval, "t") == 0)
-                               appendStringInfo(buf, "\"true\"");
+                               appendStringInfo(buf, "true");
                        else
-                               appendStringInfo(buf, "\"false\"");
+                               appendStringInfo(buf, "false");
                        break;
 
                default:

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/b318fa0e/src/include/access/pxffilters.h
----------------------------------------------------------------------
diff --git a/src/include/access/pxffilters.h b/src/include/access/pxffilters.h
index 894337b..5f5ae4e 100644
--- a/src/include/access/pxffilters.h
+++ b/src/include/access/pxffilters.h
@@ -53,9 +53,11 @@ typedef enum PxfOperatorCode
  * by a code that will describe the operator type in the final serialized
  * string that gets pushed down.
  */
-#define PXF_ATTR_CODE          'a'
-#define PXF_CONST_CODE         'c'
-#define PXF_OPERATOR_CODE      'o'
+#define PXF_ATTR_CODE                          'a'
+#define PXF_CONST_CODE                         'c'
+#define PXF_LENGTH_TO_READ                     's'
+#define PXF_CONST_DATA                         'd'
+#define PXF_OPERATOR_CODE                      'o'
 #define PXF_LOGICAL_OPERATOR_CODE      'l'
 
 /*
@@ -68,6 +70,7 @@ typedef struct PxfOperand
        char            opcode;         /* PXF_ATTR_CODE or PXF_CONST_CODE*/
        AttrNumber      attnum;         /* used when opcode is PXF_ATTR_CODE */
        StringInfo      conststr;       /* used when opcode is PXF_CONST_CODE */
+       Oid             consttype;      /* used when opcode is PXF_CONST_CODE */
 
 } PxfOperand;
 

Reply via email to