mirror of https://github.com/citusdata/citus.git
pg12 revised layout of FunctionCallInfoData
See a9c35cf85c
clang raises a warning due to FunctionCall2InfoData technically being variable sized
This is fine, as the struct is the size we want it to be. So silence the warning
pull/2844/head
parent
bee779e7d4
commit
e5cd298a98
|
@ -3832,6 +3832,41 @@ if test x"$citusac_cv_prog_cc_cflags__Wno_clobbered" = x"yes"; then
|
||||||
CITUS_CFLAGS="$CITUS_CFLAGS -Wno-clobbered"
|
CITUS_CFLAGS="$CITUS_CFLAGS -Wno-clobbered"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-gnu-variable-sized-type-not-at-end" >&5
|
||||||
|
$as_echo_n "checking whether $CC supports -Wno-gnu-variable-sized-type-not-at-end... " >&6; }
|
||||||
|
if ${citusac_cv_prog_cc_cflags__Wno_gnu_variable_sized_type_not_at_end+:} false; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
citusac_save_CFLAGS=$CFLAGS
|
||||||
|
CFLAGS="$citusac_save_CFLAGS -Wno-gnu-variable-sized-type-not-at-end"
|
||||||
|
ac_save_c_werror_flag=$ac_c_werror_flag
|
||||||
|
ac_c_werror_flag=yes
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_compile "$LINENO"; then :
|
||||||
|
citusac_cv_prog_cc_cflags__Wno_gnu_variable_sized_type_not_at_end=yes
|
||||||
|
else
|
||||||
|
citusac_cv_prog_cc_cflags__Wno_gnu_variable_sized_type_not_at_end=no
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
|
ac_c_werror_flag=$ac_save_c_werror_flag
|
||||||
|
CFLAGS="$citusac_save_CFLAGS"
|
||||||
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $citusac_cv_prog_cc_cflags__Wno_gnu_variable_sized_type_not_at_end" >&5
|
||||||
|
$as_echo "$citusac_cv_prog_cc_cflags__Wno_gnu_variable_sized_type_not_at_end" >&6; }
|
||||||
|
if test x"$citusac_cv_prog_cc_cflags__Wno_gnu_variable_sized_type_not_at_end" = x"yes"; then
|
||||||
|
CITUS_CFLAGS="$CITUS_CFLAGS -Wno-gnu-variable-sized-type-not-at-end"
|
||||||
|
fi
|
||||||
|
|
||||||
# And add a few extra warnings
|
# And add a few extra warnings
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wdeclaration-after-statement" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wdeclaration-after-statement" >&5
|
||||||
$as_echo_n "checking whether $CC supports -Wdeclaration-after-statement... " >&6; }
|
$as_echo_n "checking whether $CC supports -Wdeclaration-after-statement... " >&6; }
|
||||||
|
|
|
@ -157,6 +157,7 @@ CITUSAC_PROG_CC_CFLAGS_OPT([-Wno-unused-parameter])
|
||||||
CITUSAC_PROG_CC_CFLAGS_OPT([-Wno-sign-compare])
|
CITUSAC_PROG_CC_CFLAGS_OPT([-Wno-sign-compare])
|
||||||
CITUSAC_PROG_CC_CFLAGS_OPT([-Wno-missing-field-initializers])
|
CITUSAC_PROG_CC_CFLAGS_OPT([-Wno-missing-field-initializers])
|
||||||
CITUSAC_PROG_CC_CFLAGS_OPT([-Wno-clobbered])
|
CITUSAC_PROG_CC_CFLAGS_OPT([-Wno-clobbered])
|
||||||
|
CITUSAC_PROG_CC_CFLAGS_OPT([-Wno-gnu-variable-sized-type-not-at-end])
|
||||||
# And add a few extra warnings
|
# And add a few extra warnings
|
||||||
CITUSAC_PROG_CC_CFLAGS_OPT([-Wdeclaration-after-statement])
|
CITUSAC_PROG_CC_CFLAGS_OPT([-Wdeclaration-after-statement])
|
||||||
CITUSAC_PROG_CC_CFLAGS_OPT([-Wendif-labels])
|
CITUSAC_PROG_CC_CFLAGS_OPT([-Wendif-labels])
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
#include "distributed/multi_physical_planner.h"
|
#include "distributed/multi_physical_planner.h"
|
||||||
#include "distributed/shardinterval_utils.h"
|
#include "distributed/shardinterval_utils.h"
|
||||||
#include "distributed/pg_dist_partition.h"
|
#include "distributed/pg_dist_partition.h"
|
||||||
|
#include "distributed/version_compat.h"
|
||||||
#include "distributed/worker_protocol.h"
|
#include "distributed/worker_protocol.h"
|
||||||
#include "nodes/nodeFuncs.h"
|
#include "nodes/nodeFuncs.h"
|
||||||
#include "nodes/makefuncs.h"
|
#include "nodes/makefuncs.h"
|
||||||
|
@ -138,6 +139,17 @@ typedef struct PendingPruningInstance
|
||||||
Node *continueAt;
|
Node *continueAt;
|
||||||
} PendingPruningInstance;
|
} PendingPruningInstance;
|
||||||
|
|
||||||
|
#if PG_VERSION_NUM >= 120000
|
||||||
|
typedef union \
|
||||||
|
{ \
|
||||||
|
FunctionCallInfoBaseData fcinfo; \
|
||||||
|
/* ensure enough space for nargs args is available */ \
|
||||||
|
char fcinfo_data[SizeForFunctionCallInfo(2)]; \
|
||||||
|
} FunctionCall2InfoData;
|
||||||
|
#else
|
||||||
|
typedef FunctionCallInfoData FunctionCall2InfoData;
|
||||||
|
typedef FunctionCallInfoData *FunctionCallInfo;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Data necessary to perform a single PruneShards().
|
* Data necessary to perform a single PruneShards().
|
||||||
|
@ -161,11 +173,11 @@ typedef struct ClauseWalkerContext
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Information about function calls we need to perform. Re-using the same
|
* Information about function calls we need to perform. Re-using the same
|
||||||
* FunctionCallInfoData, instead of using FunctionCall2Coll, is often
|
* FunctionCall2InfoData, instead of using FunctionCall2Coll, is often
|
||||||
* cheaper.
|
* cheaper.
|
||||||
*/
|
*/
|
||||||
FunctionCallInfoData compareValueFunctionCall;
|
FunctionCall2InfoData compareValueFunctionCall;
|
||||||
FunctionCallInfoData compareIntervalFunctionCall;
|
FunctionCall2InfoData compareIntervalFunctionCall;
|
||||||
} ClauseWalkerContext;
|
} ClauseWalkerContext;
|
||||||
|
|
||||||
static void PrunableExpressions(Node *originalNode, ClauseWalkerContext *context);
|
static void PrunableExpressions(Node *originalNode, ClauseWalkerContext *context);
|
||||||
|
@ -184,9 +196,9 @@ static void AddNewConjuction(ClauseWalkerContext *context, OpExpr *op);
|
||||||
static PruningInstance * CopyPartialPruningInstance(PruningInstance *sourceInstance);
|
static PruningInstance * CopyPartialPruningInstance(PruningInstance *sourceInstance);
|
||||||
static List * ShardArrayToList(ShardInterval **shardArray, int length);
|
static List * ShardArrayToList(ShardInterval **shardArray, int length);
|
||||||
static List * DeepCopyShardIntervalList(List *originalShardIntervalList);
|
static List * DeepCopyShardIntervalList(List *originalShardIntervalList);
|
||||||
static int PerformValueCompare(FunctionCallInfoData *compareFunctionCall, Datum a,
|
static int PerformValueCompare(FunctionCallInfo compareFunctionCall, Datum a,
|
||||||
Datum b);
|
Datum b);
|
||||||
static int PerformCompare(FunctionCallInfoData *compareFunctionCall);
|
static int PerformCompare(FunctionCallInfo compareFunctionCall);
|
||||||
|
|
||||||
static List * PruneOne(DistTableCacheEntry *cacheEntry, ClauseWalkerContext *context,
|
static List * PruneOne(DistTableCacheEntry *cacheEntry, ClauseWalkerContext *context,
|
||||||
PruningInstance *prune);
|
PruningInstance *prune);
|
||||||
|
@ -201,11 +213,11 @@ static bool ExhaustivePruneOne(ShardInterval *curInterval,
|
||||||
PruningInstance *prune);
|
PruningInstance *prune);
|
||||||
static int UpperShardBoundary(Datum partitionColumnValue,
|
static int UpperShardBoundary(Datum partitionColumnValue,
|
||||||
ShardInterval **shardIntervalCache,
|
ShardInterval **shardIntervalCache,
|
||||||
int shardCount, FunctionCallInfoData *compareFunction,
|
int shardCount, FunctionCallInfo compareFunction,
|
||||||
bool includeMin);
|
bool includeMin);
|
||||||
static int LowerShardBoundary(Datum partitionColumnValue,
|
static int LowerShardBoundary(Datum partitionColumnValue,
|
||||||
ShardInterval **shardIntervalCache,
|
ShardInterval **shardIntervalCache,
|
||||||
int shardCount, FunctionCallInfoData *compareFunction,
|
int shardCount, FunctionCallInfo compareFunction,
|
||||||
bool includeMax);
|
bool includeMax);
|
||||||
|
|
||||||
|
|
||||||
|
@ -261,7 +273,8 @@ PruneShards(Oid relationId, Index rangeTableId, List *whereClauseList,
|
||||||
if (cacheEntry->shardIntervalCompareFunction)
|
if (cacheEntry->shardIntervalCompareFunction)
|
||||||
{
|
{
|
||||||
/* initiate function call info once (allows comparators to cache metadata) */
|
/* initiate function call info once (allows comparators to cache metadata) */
|
||||||
InitFunctionCallInfoData(context.compareIntervalFunctionCall,
|
InitFunctionCallInfoData(*(FunctionCallInfo) &
|
||||||
|
context.compareIntervalFunctionCall,
|
||||||
cacheEntry->shardIntervalCompareFunction,
|
cacheEntry->shardIntervalCompareFunction,
|
||||||
2, DEFAULT_COLLATION_OID, NULL, NULL);
|
2, DEFAULT_COLLATION_OID, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
@ -274,7 +287,8 @@ PruneShards(Oid relationId, Index rangeTableId, List *whereClauseList,
|
||||||
if (cacheEntry->shardColumnCompareFunction)
|
if (cacheEntry->shardColumnCompareFunction)
|
||||||
{
|
{
|
||||||
/* initiate function call info once (allows comparators to cache metadata) */
|
/* initiate function call info once (allows comparators to cache metadata) */
|
||||||
InitFunctionCallInfoData(context.compareValueFunctionCall,
|
InitFunctionCallInfoData(*(FunctionCallInfo) &
|
||||||
|
context.compareValueFunctionCall,
|
||||||
cacheEntry->shardColumnCompareFunction,
|
cacheEntry->shardColumnCompareFunction,
|
||||||
2, DEFAULT_COLLATION_OID, NULL, NULL);
|
2, DEFAULT_COLLATION_OID, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
@ -753,7 +767,8 @@ AddPartitionKeyRestrictionToInstance(ClauseWalkerContext *context, OpExpr *opCla
|
||||||
case BTLessStrategyNumber:
|
case BTLessStrategyNumber:
|
||||||
{
|
{
|
||||||
if (!prune->lessConsts ||
|
if (!prune->lessConsts ||
|
||||||
PerformValueCompare(&context->compareValueFunctionCall,
|
PerformValueCompare((FunctionCallInfo) &
|
||||||
|
context->compareValueFunctionCall,
|
||||||
constantClause->constvalue,
|
constantClause->constvalue,
|
||||||
prune->lessConsts->constvalue) < 0)
|
prune->lessConsts->constvalue) < 0)
|
||||||
{
|
{
|
||||||
|
@ -766,7 +781,8 @@ AddPartitionKeyRestrictionToInstance(ClauseWalkerContext *context, OpExpr *opCla
|
||||||
case BTLessEqualStrategyNumber:
|
case BTLessEqualStrategyNumber:
|
||||||
{
|
{
|
||||||
if (!prune->lessEqualConsts ||
|
if (!prune->lessEqualConsts ||
|
||||||
PerformValueCompare(&context->compareValueFunctionCall,
|
PerformValueCompare((FunctionCallInfo) &
|
||||||
|
context->compareValueFunctionCall,
|
||||||
constantClause->constvalue,
|
constantClause->constvalue,
|
||||||
prune->lessEqualConsts->constvalue) < 0)
|
prune->lessEqualConsts->constvalue) < 0)
|
||||||
{
|
{
|
||||||
|
@ -782,7 +798,8 @@ AddPartitionKeyRestrictionToInstance(ClauseWalkerContext *context, OpExpr *opCla
|
||||||
{
|
{
|
||||||
prune->equalConsts = constantClause;
|
prune->equalConsts = constantClause;
|
||||||
}
|
}
|
||||||
else if (PerformValueCompare(&context->compareValueFunctionCall,
|
else if (PerformValueCompare((FunctionCallInfo) &
|
||||||
|
context->compareValueFunctionCall,
|
||||||
constantClause->constvalue,
|
constantClause->constvalue,
|
||||||
prune->equalConsts->constvalue) != 0)
|
prune->equalConsts->constvalue) != 0)
|
||||||
{
|
{
|
||||||
|
@ -796,7 +813,8 @@ AddPartitionKeyRestrictionToInstance(ClauseWalkerContext *context, OpExpr *opCla
|
||||||
case BTGreaterEqualStrategyNumber:
|
case BTGreaterEqualStrategyNumber:
|
||||||
{
|
{
|
||||||
if (!prune->greaterEqualConsts ||
|
if (!prune->greaterEqualConsts ||
|
||||||
PerformValueCompare(&context->compareValueFunctionCall,
|
PerformValueCompare((FunctionCallInfo) &
|
||||||
|
context->compareValueFunctionCall,
|
||||||
constantClause->constvalue,
|
constantClause->constvalue,
|
||||||
prune->greaterEqualConsts->constvalue) > 0
|
prune->greaterEqualConsts->constvalue) > 0
|
||||||
)
|
)
|
||||||
|
@ -810,7 +828,8 @@ AddPartitionKeyRestrictionToInstance(ClauseWalkerContext *context, OpExpr *opCla
|
||||||
case BTGreaterStrategyNumber:
|
case BTGreaterStrategyNumber:
|
||||||
{
|
{
|
||||||
if (!prune->greaterConsts ||
|
if (!prune->greaterConsts ||
|
||||||
PerformValueCompare(&context->compareValueFunctionCall,
|
PerformValueCompare((FunctionCallInfo) &
|
||||||
|
context->compareValueFunctionCall,
|
||||||
constantClause->constvalue,
|
constantClause->constvalue,
|
||||||
prune->greaterConsts->constvalue) > 0)
|
prune->greaterConsts->constvalue) > 0)
|
||||||
{
|
{
|
||||||
|
@ -1133,7 +1152,7 @@ PruneOne(DistTableCacheEntry *cacheEntry, ClauseWalkerContext *context,
|
||||||
* unexpected NULL returns.
|
* unexpected NULL returns.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
PerformCompare(FunctionCallInfoData *compareFunctionCall)
|
PerformCompare(FunctionCallInfo compareFunctionCall)
|
||||||
{
|
{
|
||||||
Datum result = FunctionCallInvoke(compareFunctionCall);
|
Datum result = FunctionCallInvoke(compareFunctionCall);
|
||||||
|
|
||||||
|
@ -1151,12 +1170,10 @@ PerformCompare(FunctionCallInfoData *compareFunctionCall)
|
||||||
* NULL returns.
|
* NULL returns.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
PerformValueCompare(FunctionCallInfoData *compareFunctionCall, Datum a, Datum b)
|
PerformValueCompare(FunctionCallInfo compareFunctionCall, Datum a, Datum b)
|
||||||
{
|
{
|
||||||
compareFunctionCall->arg[0] = a;
|
fcSetArg(compareFunctionCall, 0, a);
|
||||||
compareFunctionCall->argnull[0] = false;
|
fcSetArg(compareFunctionCall, 1, b);
|
||||||
compareFunctionCall->arg[1] = b;
|
|
||||||
compareFunctionCall->argnull[1] = false;
|
|
||||||
|
|
||||||
return PerformCompare(compareFunctionCall);
|
return PerformCompare(compareFunctionCall);
|
||||||
}
|
}
|
||||||
|
@ -1168,7 +1185,7 @@ PerformValueCompare(FunctionCallInfoData *compareFunctionCall, Datum a, Datum b)
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
LowerShardBoundary(Datum partitionColumnValue, ShardInterval **shardIntervalCache,
|
LowerShardBoundary(Datum partitionColumnValue, ShardInterval **shardIntervalCache,
|
||||||
int shardCount, FunctionCallInfoData *compareFunction, bool includeMax)
|
int shardCount, FunctionCallInfo compareFunction, bool includeMax)
|
||||||
{
|
{
|
||||||
int lowerBoundIndex = 0;
|
int lowerBoundIndex = 0;
|
||||||
int upperBoundIndex = shardCount;
|
int upperBoundIndex = shardCount;
|
||||||
|
@ -1176,8 +1193,7 @@ LowerShardBoundary(Datum partitionColumnValue, ShardInterval **shardIntervalCach
|
||||||
Assert(shardCount != 0);
|
Assert(shardCount != 0);
|
||||||
|
|
||||||
/* setup partitionColumnValue argument once */
|
/* setup partitionColumnValue argument once */
|
||||||
compareFunction->arg[0] = partitionColumnValue;
|
fcSetArg(compareFunction, 0, partitionColumnValue);
|
||||||
compareFunction->argnull[0] = false;
|
|
||||||
|
|
||||||
while (lowerBoundIndex < upperBoundIndex)
|
while (lowerBoundIndex < upperBoundIndex)
|
||||||
{
|
{
|
||||||
|
@ -1186,8 +1202,7 @@ LowerShardBoundary(Datum partitionColumnValue, ShardInterval **shardIntervalCach
|
||||||
int minValueComparison = 0;
|
int minValueComparison = 0;
|
||||||
|
|
||||||
/* setup minValue as argument */
|
/* setup minValue as argument */
|
||||||
compareFunction->arg[1] = shardIntervalCache[middleIndex]->minValue;
|
fcSetArg(compareFunction, 1, shardIntervalCache[middleIndex]->minValue);
|
||||||
compareFunction->argnull[1] = false;
|
|
||||||
|
|
||||||
/* execute cmp(partitionValue, lowerBound) */
|
/* execute cmp(partitionValue, lowerBound) */
|
||||||
minValueComparison = PerformCompare(compareFunction);
|
minValueComparison = PerformCompare(compareFunction);
|
||||||
|
@ -1201,8 +1216,7 @@ LowerShardBoundary(Datum partitionColumnValue, ShardInterval **shardIntervalCach
|
||||||
}
|
}
|
||||||
|
|
||||||
/* setup maxValue as argument */
|
/* setup maxValue as argument */
|
||||||
compareFunction->arg[1] = shardIntervalCache[middleIndex]->maxValue;
|
fcSetArg(compareFunction, 1, shardIntervalCache[middleIndex]->maxValue);
|
||||||
compareFunction->argnull[1] = false;
|
|
||||||
|
|
||||||
/* execute cmp(partitionValue, upperBound) */
|
/* execute cmp(partitionValue, upperBound) */
|
||||||
maxValueComparison = PerformCompare(compareFunction);
|
maxValueComparison = PerformCompare(compareFunction);
|
||||||
|
@ -1249,7 +1263,7 @@ LowerShardBoundary(Datum partitionColumnValue, ShardInterval **shardIntervalCach
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
UpperShardBoundary(Datum partitionColumnValue, ShardInterval **shardIntervalCache,
|
UpperShardBoundary(Datum partitionColumnValue, ShardInterval **shardIntervalCache,
|
||||||
int shardCount, FunctionCallInfoData *compareFunction, bool includeMin)
|
int shardCount, FunctionCallInfo compareFunction, bool includeMin)
|
||||||
{
|
{
|
||||||
int lowerBoundIndex = 0;
|
int lowerBoundIndex = 0;
|
||||||
int upperBoundIndex = shardCount;
|
int upperBoundIndex = shardCount;
|
||||||
|
@ -1257,8 +1271,7 @@ UpperShardBoundary(Datum partitionColumnValue, ShardInterval **shardIntervalCach
|
||||||
Assert(shardCount != 0);
|
Assert(shardCount != 0);
|
||||||
|
|
||||||
/* setup partitionColumnValue argument once */
|
/* setup partitionColumnValue argument once */
|
||||||
compareFunction->arg[0] = partitionColumnValue;
|
fcSetArg(compareFunction, 0, partitionColumnValue);
|
||||||
compareFunction->argnull[0] = false;
|
|
||||||
|
|
||||||
while (lowerBoundIndex < upperBoundIndex)
|
while (lowerBoundIndex < upperBoundIndex)
|
||||||
{
|
{
|
||||||
|
@ -1267,8 +1280,7 @@ UpperShardBoundary(Datum partitionColumnValue, ShardInterval **shardIntervalCach
|
||||||
int minValueComparison = 0;
|
int minValueComparison = 0;
|
||||||
|
|
||||||
/* setup minValue as argument */
|
/* setup minValue as argument */
|
||||||
compareFunction->arg[1] = shardIntervalCache[middleIndex]->minValue;
|
fcSetArg(compareFunction, 1, shardIntervalCache[middleIndex]->minValue);
|
||||||
compareFunction->argnull[1] = false;
|
|
||||||
|
|
||||||
/* execute cmp(partitionValue, lowerBound) */
|
/* execute cmp(partitionValue, lowerBound) */
|
||||||
minValueComparison = PerformCompare(compareFunction);
|
minValueComparison = PerformCompare(compareFunction);
|
||||||
|
@ -1283,8 +1295,7 @@ UpperShardBoundary(Datum partitionColumnValue, ShardInterval **shardIntervalCach
|
||||||
}
|
}
|
||||||
|
|
||||||
/* setup maxValue as argument */
|
/* setup maxValue as argument */
|
||||||
compareFunction->arg[1] = shardIntervalCache[middleIndex]->maxValue;
|
fcSetArg(compareFunction, 1, shardIntervalCache[middleIndex]->maxValue);
|
||||||
compareFunction->argnull[1] = false;
|
|
||||||
|
|
||||||
/* execute cmp(partitionValue, upperBound) */
|
/* execute cmp(partitionValue, upperBound) */
|
||||||
maxValueComparison = PerformCompare(compareFunction);
|
maxValueComparison = PerformCompare(compareFunction);
|
||||||
|
@ -1345,7 +1356,8 @@ PruneWithBoundaries(DistTableCacheEntry *cacheEntry, ClauseWalkerContext *contex
|
||||||
int lowerBoundIdx = -1;
|
int lowerBoundIdx = -1;
|
||||||
int upperBoundIdx = -1;
|
int upperBoundIdx = -1;
|
||||||
int curIdx = 0;
|
int curIdx = 0;
|
||||||
FunctionCallInfo compareFunctionCall = &context->compareIntervalFunctionCall;
|
FunctionCallInfo compareFunctionCall = (FunctionCallInfo) &
|
||||||
|
context->compareIntervalFunctionCall;
|
||||||
|
|
||||||
if (prune->greaterEqualConsts)
|
if (prune->greaterEqualConsts)
|
||||||
{
|
{
|
||||||
|
@ -1476,7 +1488,8 @@ ExhaustivePruneOne(ShardInterval *curInterval,
|
||||||
ClauseWalkerContext *context,
|
ClauseWalkerContext *context,
|
||||||
PruningInstance *prune)
|
PruningInstance *prune)
|
||||||
{
|
{
|
||||||
FunctionCallInfo compareFunctionCall = &context->compareIntervalFunctionCall;
|
FunctionCallInfo compareFunctionCall = (FunctionCallInfo) &
|
||||||
|
context->compareIntervalFunctionCall;
|
||||||
Datum compareWith = 0;
|
Datum compareWith = 0;
|
||||||
|
|
||||||
/* NULL boundaries can't be compared to */
|
/* NULL boundaries can't be compared to */
|
||||||
|
|
|
@ -11,11 +11,10 @@
|
||||||
|
|
||||||
#include "catalog/namespace.h"
|
#include "catalog/namespace.h"
|
||||||
#include "distributed/function_utils.h"
|
#include "distributed/function_utils.h"
|
||||||
|
#include "distributed/version_compat.h"
|
||||||
#include "executor/executor.h"
|
#include "executor/executor.h"
|
||||||
#include "utils/builtins.h"
|
#include "utils/builtins.h"
|
||||||
#if (PG_VERSION_NUM >= 100000)
|
|
||||||
#include "utils/regproc.h"
|
#include "utils/regproc.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FunctionOid searches for a function that has the given name and the given
|
* FunctionOid searches for a function that has the given name and the given
|
||||||
|
@ -83,7 +82,7 @@ FunctionOidExtended(const char *schemaName, const char *functionName, int argume
|
||||||
ReturnSetInfo *
|
ReturnSetInfo *
|
||||||
FunctionCallGetTupleStore1(PGFunction function, Oid functionId, Datum argument)
|
FunctionCallGetTupleStore1(PGFunction function, Oid functionId, Datum argument)
|
||||||
{
|
{
|
||||||
FunctionCallInfoData fcinfo;
|
LOCAL_FCINFO(fcinfo, 1);
|
||||||
FmgrInfo flinfo;
|
FmgrInfo flinfo;
|
||||||
ReturnSetInfo *rsinfo = makeNode(ReturnSetInfo);
|
ReturnSetInfo *rsinfo = makeNode(ReturnSetInfo);
|
||||||
EState *estate = CreateExecutorState();
|
EState *estate = CreateExecutorState();
|
||||||
|
@ -91,12 +90,11 @@ FunctionCallGetTupleStore1(PGFunction function, Oid functionId, Datum argument)
|
||||||
rsinfo->allowedModes = SFRM_Materialize;
|
rsinfo->allowedModes = SFRM_Materialize;
|
||||||
|
|
||||||
fmgr_info(functionId, &flinfo);
|
fmgr_info(functionId, &flinfo);
|
||||||
InitFunctionCallInfoData(fcinfo, &flinfo, 1, InvalidOid, NULL, (Node *) rsinfo);
|
InitFunctionCallInfoData(*fcinfo, &flinfo, 1, InvalidOid, NULL, (Node *) rsinfo);
|
||||||
|
|
||||||
fcinfo.arg[0] = argument;
|
fcSetArg(fcinfo, 0, argument);
|
||||||
fcinfo.argnull[0] = false;
|
|
||||||
|
|
||||||
(*function)(&fcinfo);
|
(*function)(fcinfo);
|
||||||
|
|
||||||
return rsinfo;
|
return rsinfo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "access/sysattr.h"
|
#include "access/sysattr.h"
|
||||||
#include "catalog/indexing.h"
|
#include "catalog/indexing.h"
|
||||||
#include "catalog/pg_am.h"
|
#include "catalog/pg_am.h"
|
||||||
|
#include "catalog/pg_enum.h"
|
||||||
#include "catalog/pg_extension.h"
|
#include "catalog/pg_extension.h"
|
||||||
#include "catalog/pg_namespace.h"
|
#include "catalog/pg_namespace.h"
|
||||||
#include "catalog/pg_type.h"
|
#include "catalog/pg_type.h"
|
||||||
|
@ -43,6 +44,7 @@
|
||||||
#include "distributed/pg_dist_placement.h"
|
#include "distributed/pg_dist_placement.h"
|
||||||
#include "distributed/shared_library_init.h"
|
#include "distributed/shared_library_init.h"
|
||||||
#include "distributed/shardinterval_utils.h"
|
#include "distributed/shardinterval_utils.h"
|
||||||
|
#include "distributed/version_compat.h"
|
||||||
#include "distributed/worker_manager.h"
|
#include "distributed/worker_manager.h"
|
||||||
#include "distributed/worker_protocol.h"
|
#include "distributed/worker_protocol.h"
|
||||||
#include "executor/executor.h"
|
#include "executor/executor.h"
|
||||||
|
@ -1259,8 +1261,6 @@ static ShardInterval **
|
||||||
SortShardIntervalArray(ShardInterval **shardIntervalArray, int shardCount,
|
SortShardIntervalArray(ShardInterval **shardIntervalArray, int shardCount,
|
||||||
FmgrInfo *shardIntervalSortCompareFunction)
|
FmgrInfo *shardIntervalSortCompareFunction)
|
||||||
{
|
{
|
||||||
ShardInterval **sortedShardIntervalArray = NULL;
|
|
||||||
|
|
||||||
/* short cut if there are no shard intervals in the array */
|
/* short cut if there are no shard intervals in the array */
|
||||||
if (shardCount == 0)
|
if (shardCount == 0)
|
||||||
{
|
{
|
||||||
|
@ -1272,9 +1272,7 @@ SortShardIntervalArray(ShardInterval **shardIntervalArray, int shardCount,
|
||||||
(qsort_arg_comparator) CompareShardIntervals,
|
(qsort_arg_comparator) CompareShardIntervals,
|
||||||
(void *) shardIntervalSortCompareFunction);
|
(void *) shardIntervalSortCompareFunction);
|
||||||
|
|
||||||
sortedShardIntervalArray = shardIntervalArray;
|
return shardIntervalArray;
|
||||||
|
|
||||||
return sortedShardIntervalArray;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1624,9 +1622,8 @@ AvailableExtensionVersion(void)
|
||||||
{
|
{
|
||||||
ReturnSetInfo *extensionsResultSet = NULL;
|
ReturnSetInfo *extensionsResultSet = NULL;
|
||||||
TupleTableSlot *tupleTableSlot = NULL;
|
TupleTableSlot *tupleTableSlot = NULL;
|
||||||
FunctionCallInfoData *fcinfo = NULL;
|
LOCAL_FCINFO(fcinfo, 0);
|
||||||
FmgrInfo *flinfo = NULL;
|
FmgrInfo flinfo;
|
||||||
int argumentCount = 0;
|
|
||||||
EState *estate = NULL;
|
EState *estate = NULL;
|
||||||
|
|
||||||
bool hasTuple = false;
|
bool hasTuple = false;
|
||||||
|
@ -1641,17 +1638,15 @@ AvailableExtensionVersion(void)
|
||||||
extensionsResultSet->econtext = GetPerTupleExprContext(estate);
|
extensionsResultSet->econtext = GetPerTupleExprContext(estate);
|
||||||
extensionsResultSet->allowedModes = SFRM_Materialize;
|
extensionsResultSet->allowedModes = SFRM_Materialize;
|
||||||
|
|
||||||
fcinfo = palloc0(sizeof(FunctionCallInfoData));
|
fmgr_info(F_PG_AVAILABLE_EXTENSIONS, &flinfo);
|
||||||
flinfo = palloc0(sizeof(FmgrInfo));
|
InitFunctionCallInfoData(*fcinfo, &flinfo, 0, InvalidOid, NULL,
|
||||||
|
|
||||||
fmgr_info(F_PG_AVAILABLE_EXTENSIONS, flinfo);
|
|
||||||
InitFunctionCallInfoData(*fcinfo, flinfo, argumentCount, InvalidOid, NULL,
|
|
||||||
(Node *) extensionsResultSet);
|
(Node *) extensionsResultSet);
|
||||||
|
|
||||||
/* pg_available_extensions returns result set containing all available extensions */
|
/* pg_available_extensions returns result set containing all available extensions */
|
||||||
(*pg_available_extensions)(fcinfo);
|
(*pg_available_extensions)(fcinfo);
|
||||||
|
|
||||||
tupleTableSlot = MakeSingleTupleTableSlot(extensionsResultSet->setDesc);
|
tupleTableSlot = MakeSingleTupleTableSlotCompat(extensionsResultSet->setDesc,
|
||||||
|
&TTSOpsMinimalTuple);
|
||||||
hasTuple = tuplestore_gettupleslot(extensionsResultSet->setResult, goForward, doCopy,
|
hasTuple = tuplestore_gettupleslot(extensionsResultSet->setResult, goForward, doCopy,
|
||||||
tupleTableSlot);
|
tupleTableSlot);
|
||||||
while (hasTuple)
|
while (hasTuple)
|
||||||
|
@ -1992,9 +1987,10 @@ CitusCopyFormatTypeId(void)
|
||||||
if (MetadataCache.copyFormatTypeId == InvalidOid)
|
if (MetadataCache.copyFormatTypeId == InvalidOid)
|
||||||
{
|
{
|
||||||
char *typeName = "citus_copy_format";
|
char *typeName = "citus_copy_format";
|
||||||
MetadataCache.copyFormatTypeId = GetSysCacheOid2(TYPENAMENSP,
|
MetadataCache.copyFormatTypeId = GetSysCacheOid2Compat(TYPENAMENSP,
|
||||||
PointerGetDatum(typeName),
|
Anum_pg_enum_oid,
|
||||||
PG_CATALOG_NAMESPACE);
|
PointerGetDatum(typeName),
|
||||||
|
PG_CATALOG_NAMESPACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return MetadataCache.copyFormatTypeId;
|
return MetadataCache.copyFormatTypeId;
|
||||||
|
@ -2256,7 +2252,11 @@ LookupNodeRoleTypeOid()
|
||||||
return InvalidOid;
|
return InvalidOid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if PG_VERSION_NUM >= 120000
|
||||||
|
nodeRoleTypId = ((Form_pg_type) GETSTRUCT(tup))->oid;
|
||||||
|
#else
|
||||||
nodeRoleTypId = HeapTupleGetOid(tup);
|
nodeRoleTypId = HeapTupleGetOid(tup);
|
||||||
|
#endif
|
||||||
ReleaseSysCache(tup);
|
ReleaseSysCache(tup);
|
||||||
|
|
||||||
return nodeRoleTypId;
|
return nodeRoleTypId;
|
||||||
|
|
|
@ -257,6 +257,11 @@ RangeVarGetRelidInternal(const RangeVar *relation, LOCKMODE lockmode, uint32 fla
|
||||||
#define GetSysCacheOid3Compat GetSysCacheOid3
|
#define GetSysCacheOid3Compat GetSysCacheOid3
|
||||||
#define GetSysCacheOid4Compat GetSysCacheOid4
|
#define GetSysCacheOid4Compat GetSysCacheOid4
|
||||||
|
|
||||||
|
#define fcSetArg(fc, n, argval) \
|
||||||
|
(((fc)->args[n].isnull = false), ((fc)->args[n].value = (argval)))
|
||||||
|
#define fcSetArgNull(fc, n) \
|
||||||
|
(((fc)->args[n].isnull = true), ((fc)->args[n].value = (Datum) 0))
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
File fd;
|
File fd;
|
||||||
|
@ -319,6 +324,15 @@ FileCompatFromFileStart(File fileDesc)
|
||||||
#define GetSysCacheOid4Compat(cacheId, oidcol, key1, key2, key3, key4) \
|
#define GetSysCacheOid4Compat(cacheId, oidcol, key1, key2, key3, key4) \
|
||||||
GetSysCacheOid4(cacheId, key1, key2, key3, key4)
|
GetSysCacheOid4(cacheId, key1, key2, key3, key4)
|
||||||
|
|
||||||
|
#define LOCAL_FCINFO(name, nargs) \
|
||||||
|
FunctionCallInfoData name ## data; \
|
||||||
|
FunctionCallInfoData *name = &name ## data
|
||||||
|
|
||||||
|
#define fcSetArg(fc, n, value) \
|
||||||
|
(((fc)->argnull[n] = false), ((fc)->arg[n] = (value)))
|
||||||
|
#define fcSetArgNull(fc, n) \
|
||||||
|
(((fc)->argnull[n] = true), ((fc)->arg[n] = (Datum) 0))
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
File fd;
|
File fd;
|
||||||
|
|
Loading…
Reference in New Issue