提交 35de26e5 编写于 作者: H Heikki Linnakangas

Remove unnecessary GPDB code to transform PathKeys of index paths.

As far as I can tell, GPDB works the same as PostgreSQL with regards to
path keys used for append rels, so I don't see why we'd need to do any
transformation here. Regression tests are passing without it.

This code has been moved around as part of the 9.2 merge, and some other
cleanup, but goes all the way back to 2007 in the old pre-open sourcing
repository. The commit that introduced was a massive commit with message
"Merge of Release-3_1_0_0-alpha1-branch branch down to HEAD", so I lost the
trace of its origin there. I guess it was needed back then, but seems
unnecessary now.
上级 4037f51b
......@@ -193,9 +193,6 @@ static List *network_prefix_quals(Node *leftop, Oid expr_op, Oid opfamily,
static Datum string_to_datum(const char *str, Oid datatype);
static Const *string_to_const(const char *str, Oid datatype);
static void cdb_transform_appendrel_var(PlannerInfo *root,
RelOptInfo *rel,
List **index_pathkeys);
/*
* create_bitmap_scan_path()
......@@ -1011,13 +1008,6 @@ build_index_paths(PlannerInfo *root, RelOptInfo *rel,
index_pathkeys = build_index_pathkeys(root, index,
ForwardScanDirection);
/*
* CDB: For appendrel child, pathkeys contain Var nodes in terms
* of the child's baserel. Transform the pathkey list to refer to
* columns of the appendrel.
*/
cdb_transform_appendrel_var(root, rel, &index_pathkeys);
useful_pathkeys = truncate_useless_pathkeys(root, rel,
index_pathkeys);
orderbyclauses = NIL;
......@@ -4051,50 +4041,3 @@ string_to_const(const char *str, Oid datatype)
return makeConst(datatype, -1, collation, constlen,
conval, false, false);
}
static void
cdb_transform_appendrel_var(PlannerInfo *root, RelOptInfo *rel, List **index_pathkeys)
{
if (index_pathkeys == NULL ||
*index_pathkeys == NULL ||
rel->reloptkind != RELOPT_OTHER_MEMBER_REL)
return;
AppendRelInfo *appinfo = NULL;
RelOptInfo *appendrel = NULL;
ListCell *appcell;
CdbPathLocus notalocus;
/* Find the appendrel of which this baserel is a child. */
foreach(appcell, root->append_rel_list)
{
appinfo = (AppendRelInfo *) lfirst(appcell);
if (appinfo->child_relid == rel->relid)
break;
}
Assert(appinfo);
appendrel = find_base_rel(root, appinfo->parent_relid);
/*
* The pathkey list happens to have the same format as the
* partitioning key of a Hashed locus, so by disguising it we
* can use cdbpathlocus_pull_above_projection() to do the
* transformation.
*/
Assert(rel->cdbpolicy != NULL);
CdbPathLocus_MakeHashed(&notalocus, *index_pathkeys,
/* FIXME: rel or appendrel or other source? */
rel->cdbpolicy->numsegments);
notalocus =
cdbpathlocus_pull_above_projection(root,
notalocus,
rel->relids,
rel->reltargetlist,
appendrel->reltargetlist,
appendrel->relid);
if (CdbPathLocus_IsHashed(notalocus))
*index_pathkeys = truncate_useless_pathkeys(root, appendrel,
notalocus.partkey_h);
else
*index_pathkeys = NULL;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册