Skip to content

Commit

Permalink
Remove now useless hypo_get_qual_for_hash
Browse files Browse the repository at this point in the history
  • Loading branch information
rjuju committed Oct 13, 2018
1 parent 65ead65 commit 392010a
Showing 1 changed file with 5 additions and 85 deletions.
90 changes: 5 additions & 85 deletions hypopg_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ static PartitionBoundSpec *hypo_transformPartitionBound(ParseState *pstate,
hypoTable *parent, PartitionBoundSpec *spec);
static void hypo_set_relation_partition_info(PlannerInfo *root, RelOptInfo *rel,
hypoTable *entry);
static List *hypo_get_qual_for_hash(hypoTable *parent, PartitionBoundSpec *spec);
static List *hypo_get_qual_for_list(hypoTable *parent, PartitionBoundSpec *spec);
static List *hypo_get_qual_for_range(hypoTable *parent, PartitionBoundSpec *spec,
bool for_default);
Expand Down Expand Up @@ -2208,8 +2207,11 @@ hypo_get_qual_from_partbound(hypoTable *parent, PartitionBoundSpec *spec)

case PARTITION_STRATEGY_HASH:
Assert(spec->strategy == PARTITION_STRATEGY_HASH);
//my_qual = hypo_get_qual_for_hash(parent, spec);
/* Do not add the list */
/*
* Do not add the qual for hash partitioning, see comment in
* hypo_injectHypotheticalPartitioning about hash partitioning
* selectivity estimation
*/
break;

case PARTITION_STRATEGY_LIST:
Expand All @@ -2231,88 +2233,6 @@ hypo_get_qual_from_partbound(hypoTable *parent, PartitionBoundSpec *spec)
}


/*
* Returns a CHECK constraint expression to use as a hash partition's
* constraint, given the parent entry and partition bound structure.
*
* Heavily inspired on get_qual_for_hash
*/
static List *
hypo_get_qual_for_hash(hypoTable *parent, PartitionBoundSpec *spec)
{
PartitionKey key = parent->partkey;
FuncExpr *fexpr;
Node *relidConst;
Node *modulusConst;
Node *remainderConst;
List *args;
ListCell *partexprs_item;
int i;

/* Fixed arguments. */
relidConst = (Node *) makeConst(OIDOID,
-1,
InvalidOid,
sizeof(Oid),
ObjectIdGetDatum(parent->oid), //parentid?
false,
true);

modulusConst = (Node *) makeConst(INT4OID,
-1,
InvalidOid,
sizeof(int32),
Int32GetDatum(spec->modulus),
false,
true);

remainderConst = (Node *) makeConst(INT4OID,
-1,
InvalidOid,
sizeof(int32),
Int32GetDatum(spec->remainder),
false,
true);

args = list_make3(relidConst, modulusConst, remainderConst);
partexprs_item = list_head(key->partexprs);

/* Add an argument for each key column. */
for (i = 0; i < key->partnatts; i++)
{
Node *keyCol;

/* Left operand */
if (key->partattrs[i] != 0)
{
keyCol = (Node *) makeVar(1,
key->partattrs[i],
key->parttypid[i],
key->parttypmod[i],
key->parttypcoll[i],
0);
}
else
{
keyCol = (Node *) copyObject(lfirst(partexprs_item));
partexprs_item = lnext(partexprs_item);
}

args = lappend(args, keyCol);
}

fexpr = makeFuncExpr(F_SATISFIES_HASH_PARTITION,
BOOLOID,
args,
InvalidOid,
InvalidOid,
COERCE_EXPLICIT_CALL);

return list_make1(fexpr);
}



/*
* Returns an implicit-AND list of expressions to use as a list partition's
* constraint, given the parent entry and partition bound structure.
Expand Down

0 comments on commit 392010a

Please sign in to comment.