Change Null-safe equal operator from cross join to hash join (#2156)

* Change Null-safe equal operator from cross join to hash join
ISSUE-2136

This commit change the join method from cross join to hash join when the equal operator is Null-safe '<=>'.
It will improve the speed of query which has the Null-safe equal operator.
The finds_nulls field is used to save if there is Null-safe operator.
The finds_nulls[i] is true means that the i-th equal operator is Null-safe.
The equal function in hash table will return true, if both val and loc are NULL when finds_nulls[i] is true.
This commit is contained in:
EmmyMiao87
2019-11-08 12:43:48 +08:00
committed by Mingyu Chen
parent af79485eb2
commit 42395d2455
11 changed files with 96 additions and 62 deletions

View File

@ -148,7 +148,8 @@ Status AggregationNode::prepare(RuntimeState* state) {
// TODO: how many buckets?
_hash_tbl.reset(new HashTable(
_build_expr_ctxs, _probe_expr_ctxs, 1, true, id(), mem_tracker(), 1024));
_build_expr_ctxs, _probe_expr_ctxs, 1, true,
vector<bool>(_build_expr_ctxs.size(), false), id(), mem_tracker(), 1024));
if (_probe_expr_ctxs.empty()) {
// create single output tuple now; we need to output something