mirror of https://github.com/citusdata/citus.git
Simplify code and fix include guards in citus_clauses
parent
08384ddc71
commit
0cad3b22cc
|
@ -336,8 +336,8 @@ ExecuteTaskAndStoreResults(QueryDesc *queryDesc, Task *task,
|
|||
DeparseShardQuery(query, task, queryStringInfo);
|
||||
queryString = queryStringInfo->data;
|
||||
|
||||
elog(DEBUG4, "old query: %s", task->queryString);
|
||||
elog(DEBUG4, "new query: %s", queryString);
|
||||
elog(DEBUG4, "query before master evaluation: %s", task->queryString);
|
||||
elog(DEBUG4, "query after master evaluation: %s", queryString);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
#include "optimizer/planmain.h"
|
||||
|
||||
|
||||
typedef struct
|
||||
typedef struct WalkerState
|
||||
{
|
||||
bool containsVar;
|
||||
bool varArgument;
|
||||
|
@ -470,11 +470,9 @@ static bool
|
|||
MasterIrreducibleExpressionWalker(Node *expression, WalkerState *state)
|
||||
{
|
||||
char volatileFlag = 0;
|
||||
WalkerState childState;
|
||||
WalkerState childState = {false, false, false};
|
||||
bool containsDisallowedFunction = false;
|
||||
|
||||
childState.containsVar = childState.varArgument = childState.badCoalesce = false;
|
||||
|
||||
if (expression == NULL)
|
||||
{
|
||||
return false;
|
||||
|
@ -501,33 +499,13 @@ MasterIrreducibleExpressionWalker(Node *expression, WalkerState *state)
|
|||
|
||||
if (IsA(expression, CaseExpr))
|
||||
{
|
||||
CaseExpr *expr = (CaseExpr *) expression;
|
||||
ListCell *temp;
|
||||
|
||||
/*
|
||||
* contain_mutable_functions doesn't know what to do with CaseWhen so we
|
||||
* have to break it out ourselves
|
||||
*/
|
||||
foreach(temp, expr->args)
|
||||
{
|
||||
CaseWhen *when = (CaseWhen *) lfirst(temp);
|
||||
Assert(IsA(when, CaseWhen));
|
||||
|
||||
if (contain_mutable_functions((Node *) when->expr) ||
|
||||
contain_mutable_functions((Node *) when->result))
|
||||
{
|
||||
state->badCoalesce = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (contain_mutable_functions((Node *) expr->defresult))
|
||||
if (contain_mutable_functions(expression))
|
||||
{
|
||||
state->badCoalesce = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
return MasterIrreducibleExpressionWalker((Node *) (expr->arg), state);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsA(expression, Var))
|
||||
|
|
|
@ -101,8 +101,8 @@ ExecuteMasterEvaluableFunctions(Query *query)
|
|||
|
||||
|
||||
/*
|
||||
* Walks the expression, evaluating any STABLE or IMMUTABLE functions so long as they
|
||||
* don't reference Vars.
|
||||
* Walks the expression evaluating any node which invokes a function as long as a Var
|
||||
* doesn't show up in the parameter list.
|
||||
*/
|
||||
static Node *
|
||||
PartiallyEvaluateExpression(Node *expression)
|
||||
|
@ -195,23 +195,11 @@ EvaluateNodeIfReferencesFunction(Node *expression)
|
|||
/* structural equivalence */
|
||||
OpExpr *expr = (OpExpr *) expression;
|
||||
|
||||
/* typemod is always -1? */
|
||||
|
||||
return (Node *) citus_evaluate_expr((Expr *) expr,
|
||||
expr->opresulttype, -1,
|
||||
expr->opcollid);
|
||||
}
|
||||
|
||||
if (IsA(expression, DistinctExpr))
|
||||
{
|
||||
DistinctExpr *expr = (DistinctExpr *) expression;
|
||||
|
||||
return (Node *) citus_evaluate_expr((Expr *) expr,
|
||||
expr->opresulttype,
|
||||
exprTypmod((Node *) expr),
|
||||
expr->opcollid);
|
||||
}
|
||||
|
||||
if (IsA(expression, CoerceViaIO))
|
||||
{
|
||||
CoerceViaIO *expr = (CoerceViaIO *) expression;
|
||||
|
@ -233,7 +221,6 @@ EvaluateNodeIfReferencesFunction(Node *expression)
|
|||
|
||||
if (IsA(expression, ScalarArrayOpExpr))
|
||||
{
|
||||
/* TODO: Test this! */
|
||||
ScalarArrayOpExpr *expr = (ScalarArrayOpExpr *) expression;
|
||||
|
||||
return (Node *) citus_evaluate_expr((Expr *) expr, BOOLOID, -1, InvalidOid);
|
||||
|
@ -241,7 +228,6 @@ EvaluateNodeIfReferencesFunction(Node *expression)
|
|||
|
||||
if (IsA(expression, RowCompareExpr))
|
||||
{
|
||||
/* TODO: Test this! */
|
||||
RowCompareExpr *expr = (RowCompareExpr *) expression;
|
||||
|
||||
return (Node *) citus_evaluate_expr((Expr *) expr, BOOLOID, -1, InvalidOid);
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef CITUS_NODEFUNCS_H
|
||||
#define CITUS_NODEFUNCS_H
|
||||
#ifndef CITUS_CLAUSES_H
|
||||
#define CITUS_CLAUSES_H
|
||||
|
||||
#include "nodes/nodes.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
|
@ -17,4 +17,4 @@
|
|||
extern bool RequiresMasterEvaluation(Query *query);
|
||||
extern void ExecuteMasterEvaluableFunctions(Query *query);
|
||||
|
||||
#endif /* CITUS_NODEFUNCS_H */
|
||||
#endif /* CITUS_CLAUSES_H */
|
||||
|
|
Loading…
Reference in New Issue