Exemplo n.º 1
0
static PlannedStmt*
get_combiner_plan(ContinuousView *view)
{
	List		*parsetree_list;
	SelectStmt	*selectstmt;
	PlannedStmt *result;

	parsetree_list = pg_parse_query(view->query);
	Assert(list_length(parsetree_list) == 1);

	selectstmt = (SelectStmt *) linitial(parsetree_list);
	selectstmt = TransformSelectStmtForContProcess(view->matrel, selectstmt, NULL, Combiner);
	join_search_hook = get_combiner_join_rel;

	PG_TRY();
	{
		result = get_plan_from_stmt(view->id, (Node *) selectstmt, view->query, true);
		join_search_hook = NULL;
		post_parse_analyze_hook = NULL;
	}
	PG_CATCH();
	{
		/*
		 * These hooks won't be reset if there's an error, so we need to make
		 * sure that they're not set for whatever query is run next in this xact.
		 */
		join_search_hook = NULL;
		post_parse_analyze_hook = NULL;
		PG_RE_THROW();
	}
	PG_END_TRY();

	return result;
}
Exemplo n.º 2
0
static PlannedStmt*
get_worker_plan(ContinuousView *view)
{
	List		*parsetree_list;
	SelectStmt	*selectstmt;

	parsetree_list = pg_parse_query(view->query);
	Assert(list_length(parsetree_list) == 1);

	selectstmt = (SelectStmt *) linitial(parsetree_list);
	selectstmt = TransformSelectStmtForContProcess(view->matrel, selectstmt, NULL, Worker);

	return get_plan_from_stmt(view->id, (Node *) selectstmt, view->query, selectstmt->forCombiner);
}
Exemplo n.º 3
0
static SelectStmt *
get_worker_select_stmt(ContinuousView* view, SelectStmt** viewptr)
{
	List		*parsetree_list;
	SelectStmt	*selectstmt;

	parsetree_list = pg_parse_query(view->query);
	Assert(list_length(parsetree_list) == 1);

	selectstmt = (SelectStmt *) linitial(parsetree_list);
	selectstmt->swStepFactor = view->sw_step_factor;
	selectstmt = TransformSelectStmtForContProcess(view->matrel, selectstmt,
												   viewptr, Worker);

	return selectstmt;
}