Changeset: 0e3855836465 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0e3855836465
Modified Files:
monetdb5/modules/mal/pp_hash.c
monetdb5/modules/mal/pp_hash.h
sql/backends/monet5/rel_pphash.c
Branch: manti
Log Message:
some queries also need need_has_nil for the subsequent hash-columns
diffs (95 lines):
diff --git a/monetdb5/modules/mal/pp_hash.c b/monetdb5/modules/mal/pp_hash.c
--- a/monetdb5/modules/mal/pp_hash.c
+++ b/monetdb5/modules/mal/pp_hash.c
@@ -1237,6 +1237,8 @@ UHASHext(Client cntxt, MalBlkPtr m, MalS
Type *vals = h->vals; \
\
TIMEOUT_LOOP_IDX_DECL(i, cnt, qry_ctx) { \
+ if (need_has_nil) \
+ (void)ATOMIC_OR(&h->has_nil,
is_##Type##_nil(bp[i])); \
bool fnd = 0; \
gid g = 0; \
while (!fnd) { \
@@ -1372,6 +1374,8 @@ UHASHext(Client cntxt, MalBlkPtr m, MalS
Type *vals = h->vals; \
\
TIMEOUT_LOOP_IDX_DECL(i, cnt, qry_ctx) { \
+ if (need_has_nil) \
+ (void)ATOMIC_OR(&h->has_nil,
is_##Type##_nil(bp[i])); \
bool fnd = 0; \
gid g = 0; \
while (!fnd) { \
@@ -1419,6 +1423,8 @@ UHASHext(Client cntxt, MalBlkPtr m, MalS
bool fnd = 0; \
var_t voff = VarHeapVal(bi.base,i,bi.width);
\
void *bpi = voff == 0 ? (void*) ATOMnilptr((bi).type) :
(void *) ((bi).vh->base+voff); \
+ if (need_has_nil) \
+ (void)ATOMIC_OR(&h->has_nil, (voff == 0)); \
gid g = 0; \
while (!fnd) { \
gid k = (gid)combine(gi[i], h->hsh(bpi),
prime)&h->mask; \
@@ -1468,6 +1474,8 @@ UHASHext(Client cntxt, MalBlkPtr m, MalS
bool fnd = 0; \
var_t voff = VarHeapVal(bi.base,i,bi.width);
\
void *bpi = voff == 0 ? (void*)
ATOMnilptr((bi).type) : (void *) ((bi).vh->base+voff); \
+ if (need_has_nil) \
+ (void)ATOMIC_OR(&h->has_nil, (voff ==
0)); \
gid g = 0; \
while (!fnd) { \
gid k = (gid)combine(gi[i],
str_hsh(bpi), prime)&h->mask; \
@@ -1510,6 +1518,8 @@ UHASHext(Client cntxt, MalBlkPtr m, MalS
bool fnd = 0; \
var_t voff = VarHeapVal(bi.base,i,bi.width);
\
void *bpi = voff == 0 ? (void*)
ATOMnilptr((bi).type) : (void *) ((bi).vh->base+voff); \
+ if (need_has_nil) \
+ (void)ATOMIC_OR(&h->has_nil, (voff ==
0)); \
gid g = 0; \
while (!fnd) { \
gid k = (gid)combine(gi[i],
h->hsh(bpi), prime)&h->mask; \
@@ -1570,9 +1580,6 @@ OAHASHbuild(Client ctx, MalBlkPtr m, Mal
/* we only work with shared hashtable in the build phase */
assert(*hashtable && !is_bat_nil(*hashtable));
- /* need_has_nil is only for the first hash column */
- assert(!need_has_nil || (need_has_nil && !parents));
-
b = BATdescriptor(*keys);
u = BATdescriptor(*hashtable);
if (!b || !u) {
diff --git a/monetdb5/modules/mal/pp_hash.h b/monetdb5/modules/mal/pp_hash.h
--- a/monetdb5/modules/mal/pp_hash.h
+++ b/monetdb5/modules/mal/pp_hash.h
@@ -97,8 +97,8 @@ typedef struct hash_table {
fhsh hsh;
flen len;
bool empty;
- ATOMIC_TYPE has_nil; /* whether the hashed column contain a NULL,
defaul: 0, i.e. false */
- ATOMIC_TYPE gid_NULL; /* if has_nil, remember the gid of NULL */
+ ATOMIC_TYPE has_nil; /* if need_has_nil: remember during the
hash-build, whether the hashed column contain a NULL, defaul: 0, i.e. false */
+ ATOMIC_TYPE gid_NULL; /* only for the first hash column: if has_nil,
remember the gid of NULL */
bool perfect; /* fetch/perfect hash */
int vkey; /* vheap is unique, ie hashing on offsets */
diff --git a/sql/backends/monet5/rel_pphash.c b/sql/backends/monet5/rel_pphash.c
--- a/sql/backends/monet5/rel_pphash.c
+++ b/sql/backends/monet5/rel_pphash.c
@@ -394,7 +394,6 @@ rel2bin_oahash_build(backend *be, sql_re
sql_subtype *bt = sql_fetch_localtype(TYPE_bit);
sql_subfunc *and = sql_bind_func(be->mvc, "sys", "and", bt, bt, F_FUNC,
true, true);
- bool first = true;
for (node *n = exps_cmp_hsh->h, *inout = shared_ht->op4.lval->h; n &&
inout; n = n->next, inout = inout->next) {
sql_exp *e = n->data;
stmt *ht = inout->data;
@@ -410,10 +409,9 @@ rel2bin_oahash_build(backend *be, sql_re
}
prnt = perfect ?
stmt_fhash_build_ht(be, ht, key, is_any(e)) :
- stmt_oahash_build_ht(be, ht, key, prnt, is_any(e) &&
first);
+ stmt_oahash_build_ht(be, ht, key, prnt, is_any(e));
if (prnt == NULL)
return NULL;
- first = false;
if (e->alias.label)
ht = stmt_alias(be, ht, e->alias.label,
exp_find_rel_name(e), exp_name(e));
append(l, ht);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]