mirror of https://github.com/citusdata/citus.git
generic way of matching fields for Var/Const
parent
2b4072ebe8
commit
4362502bb5
|
@ -791,7 +791,7 @@ GeoOverlapJoin(PlannerInfo *root, Path *originalPath)
|
||||||
MatchVar(NoCapture),
|
MatchVar(NoCapture),
|
||||||
MatchConst(
|
MatchConst(
|
||||||
&match.stdwithinDistanceConst,
|
&match.stdwithinDistanceConst,
|
||||||
MatchConstType(FLOAT8OID))))),
|
MatchConstFields(consttype == FLOAT8OID))))),
|
||||||
/* match inner path in join */
|
/* match inner path in join */
|
||||||
SkipReadThrough(
|
SkipReadThrough(
|
||||||
NoCapture,
|
NoCapture,
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
#define CONCATENATE1(arg1, arg2) CONCATENATE2(arg1, arg2)
|
#define CONCATENATE1(arg1, arg2) CONCATENATE2(arg1, arg2)
|
||||||
#define CONCATENATE2(arg1, arg2) arg1##arg2
|
#define CONCATENATE2(arg1, arg2) arg1##arg2
|
||||||
|
|
||||||
#define FOR_EACH_0(what, index) (void);
|
#define FOR_EACH_0(what, index, x) ;
|
||||||
#define FOR_EACH_1(what, index, x) what((index), x);
|
#define FOR_EACH_1(what, index, x) what((index), x); FOR_EACH_0(what, index+1, __VA_ARGS__);
|
||||||
#define FOR_EACH_2(what, index, x, ...) what((index), x); FOR_EACH_1(what, index+1, __VA_ARGS__);
|
#define FOR_EACH_2(what, index, x, ...) what((index), x); FOR_EACH_1(what, index+1, __VA_ARGS__);
|
||||||
#define FOR_EACH_3(what, index, x, ...) what((index), x); FOR_EACH_2(what, index+1, __VA_ARGS__);
|
#define FOR_EACH_3(what, index, x, ...) what((index), x); FOR_EACH_2(what, index+1, __VA_ARGS__);
|
||||||
#define FOR_EACH_4(what, index, x, ...) what((index), x); FOR_EACH_3(what, index+1, __VA_ARGS__);
|
#define FOR_EACH_4(what, index, x, ...) what((index), x); FOR_EACH_3(what, index+1, __VA_ARGS__);
|
||||||
|
@ -71,7 +71,6 @@
|
||||||
\
|
\
|
||||||
{ \
|
{ \
|
||||||
bool skipped = true; \
|
bool skipped = true; \
|
||||||
int skipCount = 0; \
|
|
||||||
while (skipped) { \
|
while (skipped) { \
|
||||||
switch(pathToMatch->type) \
|
switch(pathToMatch->type) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -87,12 +86,7 @@
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
if (skipped) \
|
|
||||||
{ \
|
|
||||||
skipCount++; \
|
|
||||||
} \
|
|
||||||
} \
|
} \
|
||||||
ereport(DEBUG1, (errmsg("skipped %d read through nodes", skipCount))); \
|
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
matcher; \
|
matcher; \
|
||||||
|
@ -102,7 +96,6 @@
|
||||||
|
|
||||||
#define MatchJoin(capture, joinType, conditionMatcher, innerMatcher, outerMatcher) \
|
#define MatchJoin(capture, joinType, conditionMatcher, innerMatcher, outerMatcher) \
|
||||||
{ \
|
{ \
|
||||||
ereport(DEBUG1, (errmsg("initiate join matcher"))); \
|
|
||||||
{ \
|
{ \
|
||||||
bool m = false; \
|
bool m = false; \
|
||||||
switch (pathToMatch->type) \
|
switch (pathToMatch->type) \
|
||||||
|
@ -196,11 +189,9 @@ do \
|
||||||
MakeStack(Path, pathToMatch, path); \
|
MakeStack(Path, pathToMatch, path); \
|
||||||
InitializeCapture; \
|
InitializeCapture; \
|
||||||
\
|
\
|
||||||
ereport(DEBUG1, (errmsg("initiate matcher DSL"))); \
|
|
||||||
matcher; \
|
matcher; \
|
||||||
\
|
\
|
||||||
VerifyStack(pathToMatch); \
|
VerifyStack(pathToMatch); \
|
||||||
ereport(DEBUG1, (errmsg("pattern matched"))); \
|
|
||||||
matched = true; \
|
matched = true; \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
|
@ -310,6 +301,19 @@ if (matched)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define MatchVarValuesInternal(index, check) \
|
||||||
|
{ \
|
||||||
|
if (!(castNode(Var, clause)->check)) \
|
||||||
|
{ \
|
||||||
|
MatchFailed; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define MatchVarFields(...) \
|
||||||
|
FOR_EACH(MatchVarValuesInternal, __VA_ARGS__);
|
||||||
|
|
||||||
|
|
||||||
#define MatchVar(capture, ...) \
|
#define MatchVar(capture, ...) \
|
||||||
{ \
|
{ \
|
||||||
if (!IsA(clause, Var)) \
|
if (!IsA(clause, Var)) \
|
||||||
|
@ -321,13 +325,19 @@ if (matched)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define MatchConstType(constType) \
|
#define MatchConstValuesInternal(index, check) \
|
||||||
if (!(castNode(Const, clause)->consttype == constType)) \
|
|
||||||
{ \
|
{ \
|
||||||
MatchFailed; \
|
if (!(castNode(Const, clause)->check)) \
|
||||||
|
{ \
|
||||||
|
MatchFailed; \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define MatchConstFields(...) \
|
||||||
|
FOR_EACH(MatchConstValuesInternal, __VA_ARGS__);
|
||||||
|
|
||||||
|
|
||||||
#define MatchConst(capture, ...) \
|
#define MatchConst(capture, ...) \
|
||||||
{ \
|
{ \
|
||||||
if (!IsA(clause, Const)) \
|
if (!IsA(clause, Const)) \
|
||||||
|
|
Loading…
Reference in New Issue