mirror of https://github.com/citusdata/citus.git
Remove 9.5 related node wrappers.
Now that all branches support the extensible node infrastructure, we don't need our wrappers anymore.pull/1470/head
parent
b96ba9b490
commit
dc3997c3b8
|
@ -444,7 +444,7 @@ SerializeMultiPlan(MultiPlan *multiPlan)
|
|||
char *serializedMultiPlan = NULL;
|
||||
Const *multiPlanData = NULL;
|
||||
|
||||
serializedMultiPlan = CitusNodeToString(multiPlan);
|
||||
serializedMultiPlan = nodeToString(multiPlan);
|
||||
|
||||
multiPlanData = makeNode(Const);
|
||||
multiPlanData->consttype = CSTRINGOID;
|
||||
|
@ -472,7 +472,7 @@ DeserializeMultiPlan(Node *node)
|
|||
multiPlanData = (Const *) node;
|
||||
serializedMultiPlan = DatumGetCString(multiPlanData->constvalue);
|
||||
|
||||
multiPlan = (MultiPlan *) CitusStringToNode(serializedMultiPlan);
|
||||
multiPlan = (MultiPlan *) stringToNode(serializedMultiPlan);
|
||||
Assert(CitusIsA(multiPlan, MultiPlan));
|
||||
|
||||
return multiPlan;
|
||||
|
@ -661,14 +661,14 @@ RemoteScanRangeTableEntry(List *columnNameList)
|
|||
|
||||
/*
|
||||
* CheckNodeIsDumpable checks that the passed node can be dumped using
|
||||
* CitusNodeToString(). As this checks is expensive, it's only active when
|
||||
* nodeToString(). As this checks is expensive, it's only active when
|
||||
* assertions are enabled.
|
||||
*/
|
||||
static void
|
||||
CheckNodeIsDumpable(Node *node)
|
||||
{
|
||||
#ifdef USE_ASSERT_CHECKING
|
||||
char *out = CitusNodeToString(node);
|
||||
char *out = nodeToString(node);
|
||||
pfree(out);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -416,14 +416,3 @@ OutDeferredErrorMessage(OUTFUNC_ARGS)
|
|||
WRITE_INT_FIELD(linenumber);
|
||||
WRITE_STRING_FIELD(functionname);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* CitusNodeToString -
|
||||
* returns the ascii representation of the Node as a palloc'd string
|
||||
*/
|
||||
char *
|
||||
CitusNodeToString(const void *obj)
|
||||
{
|
||||
return nodeToString(obj);
|
||||
}
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* citus_read.c
|
||||
* Citus version of postgres' read.c, using a different state variable for
|
||||
* citus_pg_strtok.
|
||||
*
|
||||
* Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
* Portions Copyright (c) 2012-2016, Citus Data, Inc.
|
||||
*
|
||||
* NOTES
|
||||
* Unfortunately we have to copy this file as the state variable for
|
||||
* pg_strtok is not externally accessible. That prevents creating a a
|
||||
* version of stringToNode() that calls CitusNodeRead() instead of
|
||||
* nodeRead(). Luckily these functions seldomly change.
|
||||
*
|
||||
* Keep as closely aligned with the upstream version as possible.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "nodes/pg_list.h"
|
||||
#include "nodes/readfuncs.h"
|
||||
#include "distributed/citus_nodefuncs.h"
|
||||
#include "nodes/value.h"
|
||||
|
||||
|
||||
/*
|
||||
* For 9.6 onwards, we use 9.6's extensible node system, thus there's no need
|
||||
* to copy various routines anymore. In that case, replace these functions
|
||||
* with plain wrappers.
|
||||
*/
|
||||
void *
|
||||
CitusStringToNode(char *str)
|
||||
{
|
||||
return stringToNode(str);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
citus_pg_strtok(int *length)
|
||||
{
|
||||
return pg_strtok(length);
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
CitusNodeRead(char *token, int tok_len)
|
||||
{
|
||||
return nodeRead(token, tok_len);
|
||||
}
|
|
@ -42,7 +42,7 @@ CitusSetTag(Node *node, int tag)
|
|||
#define READ_LOCALS_NO_FIELDS(nodeTypeName) \
|
||||
nodeTypeName *local_node = (nodeTypeName *) CitusSetTag((Node *) node, T_##nodeTypeName)
|
||||
|
||||
/* And a few guys need only the citus_pg_strtok support fields */
|
||||
/* And a few guys need only the pg_strtok support fields */
|
||||
#define READ_TEMP_LOCALS() \
|
||||
char *token; \
|
||||
int length
|
||||
|
@ -54,70 +54,70 @@ CitusSetTag(Node *node, int tag)
|
|||
|
||||
/* Read an integer field (anything written as ":fldname %d") */
|
||||
#define READ_INT_FIELD(fldname) \
|
||||
token = citus_pg_strtok(&length); /* skip :fldname */ \
|
||||
token = citus_pg_strtok(&length); /* get field value */ \
|
||||
token = pg_strtok(&length); /* skip :fldname */ \
|
||||
token = pg_strtok(&length); /* get field value */ \
|
||||
local_node->fldname = atoi(token)
|
||||
|
||||
/* Read an unsigned integer field (anything written as ":fldname %u") */
|
||||
#define READ_UINT_FIELD(fldname) \
|
||||
token = citus_pg_strtok(&length); /* skip :fldname */ \
|
||||
token = citus_pg_strtok(&length); /* get field value */ \
|
||||
token = pg_strtok(&length); /* skip :fldname */ \
|
||||
token = pg_strtok(&length); /* get field value */ \
|
||||
local_node->fldname = atoui(token)
|
||||
|
||||
/* XXX: CITUS Read an uint64 field (anything written as ":fldname %u") */
|
||||
#define READ_UINT64_FIELD(fldname) \
|
||||
token = citus_pg_strtok(&length); /* skip :fldname */ \
|
||||
token = citus_pg_strtok(&length); /* get field value */ \
|
||||
token = pg_strtok(&length); /* skip :fldname */ \
|
||||
token = pg_strtok(&length); /* get field value */ \
|
||||
local_node->fldname = atoull(token)
|
||||
|
||||
/* Read an OID field (don't hard-wire assumption that OID is same as uint) */
|
||||
#define READ_OID_FIELD(fldname) \
|
||||
token = citus_pg_strtok(&length); /* skip :fldname */ \
|
||||
token = citus_pg_strtok(&length); /* get field value */ \
|
||||
token = pg_strtok(&length); /* skip :fldname */ \
|
||||
token = pg_strtok(&length); /* get field value */ \
|
||||
local_node->fldname = atooid(token)
|
||||
|
||||
/* Read a char field (ie, one ascii character) */
|
||||
#define READ_CHAR_FIELD(fldname) \
|
||||
token = citus_pg_strtok(&length); /* skip :fldname */ \
|
||||
token = citus_pg_strtok(&length); /* get field value */ \
|
||||
token = pg_strtok(&length); /* skip :fldname */ \
|
||||
token = pg_strtok(&length); /* get field value */ \
|
||||
local_node->fldname = token[0]
|
||||
|
||||
/* Read an enumerated-type field that was written as an integer code */
|
||||
#define READ_ENUM_FIELD(fldname, enumtype) \
|
||||
token = citus_pg_strtok(&length); /* skip :fldname */ \
|
||||
token = citus_pg_strtok(&length); /* get field value */ \
|
||||
token = pg_strtok(&length); /* skip :fldname */ \
|
||||
token = pg_strtok(&length); /* get field value */ \
|
||||
local_node->fldname = (enumtype) atoi(token)
|
||||
|
||||
/* Read a float field */
|
||||
#define READ_FLOAT_FIELD(fldname) \
|
||||
token = citus_pg_strtok(&length); /* skip :fldname */ \
|
||||
token = citus_pg_strtok(&length); /* get field value */ \
|
||||
token = pg_strtok(&length); /* skip :fldname */ \
|
||||
token = pg_strtok(&length); /* get field value */ \
|
||||
local_node->fldname = atof(token)
|
||||
|
||||
/* Read a boolean field */
|
||||
#define READ_BOOL_FIELD(fldname) \
|
||||
token = citus_pg_strtok(&length); /* skip :fldname */ \
|
||||
token = citus_pg_strtok(&length); /* get field value */ \
|
||||
token = pg_strtok(&length); /* skip :fldname */ \
|
||||
token = pg_strtok(&length); /* get field value */ \
|
||||
local_node->fldname = strtobool(token)
|
||||
|
||||
/* Read a character-string field */
|
||||
#define READ_STRING_FIELD(fldname) \
|
||||
token = citus_pg_strtok(&length); /* skip :fldname */ \
|
||||
token = citus_pg_strtok(&length); /* get field value */ \
|
||||
token = pg_strtok(&length); /* skip :fldname */ \
|
||||
token = pg_strtok(&length); /* get field value */ \
|
||||
local_node->fldname = nullable_string(token, length)
|
||||
|
||||
/* Read a parse location field (and throw away the value, per notes above) */
|
||||
#define READ_LOCATION_FIELD(fldname) \
|
||||
token = citus_pg_strtok(&length); /* skip :fldname */ \
|
||||
token = citus_pg_strtok(&length); /* get field value */ \
|
||||
token = pg_strtok(&length); /* skip :fldname */ \
|
||||
token = pg_strtok(&length); /* get field value */ \
|
||||
(void) token; /* in case not used elsewhere */ \
|
||||
local_node->fldname = -1 /* set field to "unknown" */
|
||||
|
||||
/* Read a Node field XXX: Citus: replaced call to nodeRead with CitusNodeRead */
|
||||
/* Read a Node field */
|
||||
#define READ_NODE_FIELD(fldname) \
|
||||
token = citus_pg_strtok(&length); /* skip :fldname */ \
|
||||
token = pg_strtok(&length); /* skip :fldname */ \
|
||||
(void) token; /* in case not used elsewhere */ \
|
||||
local_node->fldname = CitusNodeRead(NULL, 0)
|
||||
local_node->fldname = nodeRead(NULL, 0)
|
||||
|
||||
/* Routine exit */
|
||||
#define READ_DONE() \
|
||||
|
@ -203,15 +203,15 @@ ReadShardInterval(READFUNC_ARGS)
|
|||
READ_BOOL_FIELD(minValueExists);
|
||||
READ_BOOL_FIELD(maxValueExists);
|
||||
|
||||
token = citus_pg_strtok(&length); /* skip :minValue */
|
||||
token = pg_strtok(&length); /* skip :minValue */
|
||||
if (!local_node->minValueExists)
|
||||
token = citus_pg_strtok(&length); /* skip "<>" */
|
||||
token = pg_strtok(&length); /* skip "<>" */
|
||||
else
|
||||
local_node->minValue = readDatum(local_node->valueByVal);
|
||||
|
||||
token = citus_pg_strtok(&length); /* skip :maxValue */
|
||||
token = pg_strtok(&length); /* skip :maxValue */
|
||||
if (!local_node->minValueExists)
|
||||
token = citus_pg_strtok(&length); /* skip "<>" */
|
||||
token = pg_strtok(&length); /* skip "<>" */
|
||||
else
|
||||
local_node->maxValue = readDatum(local_node->valueByVal);
|
||||
|
||||
|
@ -246,7 +246,7 @@ ReadMapMergeJob(READFUNC_ARGS)
|
|||
for (i = 0; i < arrayLength; ++i)
|
||||
{
|
||||
/* can't use READ_NODE_FIELD, no field names */
|
||||
local_node->sortedShardIntervalArray[i] = CitusNodeRead(NULL, 0);
|
||||
local_node->sortedShardIntervalArray[i] = nodeRead(NULL, 0);
|
||||
}
|
||||
|
||||
READ_NODE_FIELD(mapTaskList);
|
||||
|
@ -336,17 +336,3 @@ ReadUnsupportedCitusNode(READFUNC_ARGS)
|
|||
{
|
||||
ereport(ERROR, (errmsg("not implemented")));
|
||||
}
|
||||
|
||||
|
||||
/* *INDENT-ON* */
|
||||
|
||||
|
||||
/*
|
||||
* For 9.6+ we can just use the, now extensible, parseNodeString(). Before
|
||||
* that citus_readfuncs_$ver.c has a version specific implementation.
|
||||
*/
|
||||
Node *
|
||||
CitusParseNodeString(void)
|
||||
{
|
||||
return parseNodeString();
|
||||
}
|
||||
|
|
|
@ -27,17 +27,6 @@ extern void ExtractRangeTblExtraData(RangeTblEntry *rte, CitusRTEKind *rteKind,
|
|||
List **tableIdList);
|
||||
extern CitusRTEKind GetRangeTblKind(RangeTblEntry *rte);
|
||||
|
||||
/* citus_outfuncs.c */
|
||||
extern char * CitusNodeToString(const void *obj);
|
||||
|
||||
/* citus_read.c */
|
||||
extern void * CitusStringToNode(char *str);
|
||||
extern char * citus_pg_strtok(int *length);
|
||||
extern void * CitusNodeRead(char *token, int tok_len);
|
||||
|
||||
/* citus_readfuncs.c */
|
||||
extern Node * CitusParseNodeString(void);
|
||||
|
||||
extern void RegisterNodes(void);
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue