Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/backend/optimizer/plan/planner.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ standard_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
* PARALLEL RETRIEVE CURSOR is not supported by ORCA yet.
*/
if (optimizer &&
!parse->usePostgresPlanner &&
GP_ROLE_DISPATCH == Gp_role &&
IS_QUERY_DISPATCHER() &&
(cursorOptions & CURSOR_OPT_PARALLEL_RETRIEVE) == 0)
Expand Down
2 changes: 2 additions & 0 deletions src/backend/parser/analyze.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ transformStmt(ParseState *pstate, Node *parseTree)
if (pstate->p_hasDynamicFunction)
result->hasDynamicFunctions = true;

result->usePostgresPlanner = pstate->usePostgresPlanner;

return result;
}

Expand Down
2 changes: 2 additions & 0 deletions src/backend/parser/parse_clause.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,8 @@ transformRangeFunction(ParseState *pstate, RangeFunction *r)

/* Now we set our special attribute in the rte. */
rte->forceDistRandom = true;
/* Orca doesn't support gp_dist_random */
pstate->usePostgresPlanner = true;

return rte;
}
Expand Down
4 changes: 4 additions & 0 deletions src/backend/parser/parse_func.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,10 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
errmsg("OVER specified, but %s is not a window function nor an aggregate function",
NameListToString(funcname)),
parser_errposition(pstate, location)));

/* Orca supports only the any exec location */
if (func_exec_location(funcid) != PROEXECLOCATION_ANY)
pstate->usePostgresPlanner = true;
}
else if (fdresult == FUNCDETAIL_AGGREGATE)
{
Expand Down
4 changes: 4 additions & 0 deletions src/backend/parser/parse_relation.c
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,10 @@ parserOpenTable(ParseState *pstate, const RangeVar *relation,
}
}

/* Orca doesn't support queries on master-only tables */
if (rel->rd_cdbpolicy == NULL)
pstate->usePostgresPlanner = true;

cancel_parser_errposition_callback(&pcbstate);
return rel;
}
Expand Down
1 change: 1 addition & 0 deletions src/include/nodes/parsenodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ typedef struct Query
*/
ParentStmtType parentStmtType;
bool expandMatViews; /* force expansion of materialized views during rewrite to treat as views */
bool usePostgresPlanner; /* don't try to plan the query using Orca */
} Query;

/****************************************************************************
Expand Down
2 changes: 2 additions & 0 deletions src/include/parser/parse_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ struct ParseState
ParseParamRefHook p_paramref_hook;
CoerceParamHook p_coerce_param_hook;
void *p_ref_hook_state; /* common passthrough link for above */
bool usePostgresPlanner; /* parse analysis found out that Orca
doesn't support the query */
};

/*
Expand Down
Loading