Github user wengyanqing commented on a diff in the pull request:
https://github.com/apache/incubator-hawq/pull/1347#discussion_r175015247
--- Diff: contrib/vexecutor/tuplebatch.c ---
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+#include "postgres.h"
+#include "tuplebatch.h"
+
+static size_t vtypeSize(vheader *vh);
+static size_t tbSerializationSize(TupleBatch tb);
+
+#define TBGETVALUEPTR(tb,type,colid,rowid) (&(((type
*)tb->datagroup[colid])->data[rowid]))
+#define TBGETISNULLPTR(tb,colid,rowid)
(&((tb->datagroup[colid])->isnull[rowid]))
+
+TupleBatch tbGenerate(int colnum,int batchsize)
+{
+ Assert(colnum > 0 && batchsize > 0);
+ TupleBatch tb = palloc0(sizeof(TupleBatchData));
+ if(!tb)
+ {
+ elog(FATAL,"TupleBatch Allocation failed");
+ return NULL;
+ }
+
+ tb->ncols = colnum;
+ tb->batchsize = batchsize;
+
+ tb->skip = palloc0(sizeof(bool) * tb->batchsize);
+ tb->datagroup = palloc0(sizeof(struct vtypeheader*) * tb->ncols);
+
+ return tb;
+}
+
+void tbDestory(TupleBatch* tb){
--- End diff --
tbDestory -> tbDestroy ?
---