Oid colloid = PG_GET_COLLATION();
AttrNumber attno;
Datum value;
- Datum matches;
+ bool matches;
FmgrInfo *finfo;
uint32 hashValue;
BloomFilter *filter;
Assert(filter);
+ /*
+ * Assume all scan keys match. We'll be searching for a scan key eliminating
+ * the page range (we can stop on the first such key).
+ */
matches = true;
for (keyno = 0; keyno < nkeys; keyno++)
case BloomEqualStrategyNumber:
/*
- * In the equality case (WHERE col = someval), we want to
- * return the current page range if the minimum value in the
- * range <= scan key, and the maximum value >= scan key.
+ * We want to return the current page range if the bloom filter
+ * seems to contain the value.
*/
finfo = bloom_get_procinfo(bdesc, attno, PROCNUM_HASH);
default:
/* shouldn't happen */
elog(ERROR, "invalid strategy number %d", key->sk_strategy);
- matches = 0;
+ matches = false;
break;
}
break;
}
- PG_RETURN_DATUM(matches);
+ PG_RETURN_BOOL(matches);
}
/*
for (keyno = 0; keyno < nkeys; keyno++)
{
- Datum matches;
+ bool matches;
ScanKey key = keys[keyno];
/* NULL keys are handled and filtered-out in bringetbitmap */
finfo = minmax_multi_get_strategy_procinfo(bdesc, attno, subtype,
key->sk_strategy);
/* first value from the array */
- matches = FunctionCall2Coll(finfo, colloid, minval, value);
+ matches = DatumGetBool(FunctionCall2Coll(finfo, colloid, minval, value));
break;
case BTEqualStrategyNumber:
finfo = minmax_multi_get_strategy_procinfo(bdesc, attno, subtype,
key->sk_strategy);
/* last value from the array */
- matches = FunctionCall2Coll(finfo, colloid, maxval, value);
+ matches = DatumGetBool(FunctionCall2Coll(finfo, colloid, maxval, value));
break;
default:
/* shouldn't happen */
elog(ERROR, "invalid strategy number %d", key->sk_strategy);
- matches = 0;
+ matches = false;
break;
}
/* the range has to match all the scan keys */
- matching &= DatumGetBool(matches);
+ matching &= matches;
/* once we find a non-matching key, we're done */
if (!matching)
* have we found a range matching all scan keys? if yes, we're done
*/
if (matching)
- PG_RETURN_DATUM(BoolGetDatum(true));
+ PG_RETURN_BOOL(true);
}
/*
for (keyno = 0; keyno < nkeys; keyno++)
{
- Datum matches;
+ bool matches;
ScanKey key = keys[keyno];
/* we've already dealt with NULL keys at the beginning */
finfo = minmax_multi_get_strategy_procinfo(bdesc, attno, subtype,
key->sk_strategy);
- matches = FunctionCall2Coll(finfo, colloid, val, value);
+ matches = DatumGetBool(FunctionCall2Coll(finfo, colloid, val, value));
break;
default:
/* shouldn't happen */
elog(ERROR, "invalid strategy number %d", key->sk_strategy);
- matches = 0;
+ matches = false;
break;
}
/* the range has to match all the scan keys */
- matching &= DatumGetBool(matches);
+ matching &= matches;
/* once we find a non-matching key, we're done */
if (!matching)
/* have we found a range matching all scan keys? if yes, we're done */
if (matching)
- PG_RETURN_DATUM(BoolGetDatum(true));
+ PG_RETURN_BOOL(true);
}
- PG_RETURN_DATUM(BoolGetDatum(false));
+ PG_RETURN_BOOL(false);
}
/*