Changeset: 15ce2d14b095 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/15ce2d14b095
Modified Files:
gdk/gdk_bat.c
monetdb5/modules/atoms/sha256.c
sql/backends/monet5/rel_bin.c
sql/include/sql_catalog.h
sql/storage/store.c
Branch: nilmask
Log Message:
pass correct pointer down SHA256 from string command
improve nil handling in gdk (gdk_bat.c sofar)
diffs (156 lines):
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -1280,7 +1280,7 @@ BUNappendmulti(BAT *b, const void *value
if (bi.maxpos != BUN_NONE)
maxvalp = BUNtvar(bi,
bi.maxpos);
}
- if (atomcmp(t, atomnil) != 0) {
+ if (!atomnil || atomcmp(t, atomnil) != 0) {
if (p == 0) {
bi.minpos = bi.maxpos = 0;
minvalp = maxvalp = t;
@@ -1331,7 +1331,7 @@ BUNappendmulti(BAT *b, const void *value
if (b->thash) {
HASHappend_locked(b, p, t);
}
- if (atomcmp(t, atomnil) != 0) {
+ if (!atomnil || atomcmp(t, atomnil) != 0) {
if (p == 0) {
bi.minpos = bi.maxpos = 0;
minvalp = maxvalp = t;
@@ -1537,8 +1537,8 @@ BUNinplacemulti(BAT *b, const oid *posit
const void *t = b->ttype && b->tvheap ?
((const void **) values)[i] :
(const void *) ((const char *) values + (i <<
b->tshift));
- const bool isnil = ATOMlinear(b->ttype) &&
- ATOMcmp(b->ttype, t, ATOMnilptr(b->ttype)) == 0;
+ const void *atomnil = ATOMnilptr(b->ttype);
+ const bool isnil = atomnil && ATOMcmp(b->ttype, t, atomnil) ==
0;
/* retrieve old value, but if this comes from the
* logger, we need to deal with offsets that point
@@ -1561,8 +1561,8 @@ BUNinplacemulti(BAT *b, const oid *posit
if (ATOMcmp(b->ttype, val, t) == 0)
continue; /* nothing to do */
if (!isnil &&
- b->tnil &&
- ATOMcmp(b->ttype, val, ATOMnilptr(b->ttype)) == 0) {
+ b->tnil && atomnil &&
+ ATOMcmp(b->ttype, val, atomnil) == 0) {
/* if old value is nil and new value
* isn't, we're not sure anymore about
* the nil property, so we must clear
@@ -1770,8 +1770,8 @@ BUNinplacemulti(BAT *b, const oid *posit
BATkey(b, false);
} else if (!b->tkey && (b->tnokey[0] == p || b->tnokey[1] == p))
b->tnokey[0] = b->tnokey[1] = 0;
- if (b->tnonil && ATOMstorage(b->ttype) != TYPE_msk)
- b->tnonil = t && ATOMcmp(b->ttype, t,
ATOMnilptr(b->ttype)) != 0;
+ if (b->tnonil && (ATOMstorage(b->ttype) != TYPE_msk ||
!atomnil))
+ b->tnonil = t && ATOMcmp(b->ttype, t, atomnil) != 0;
MT_lock_unset(&b->theaplock);
}
BUN nunique = b->thash ? b->thash->nunique : 0;
@@ -2843,7 +2843,7 @@ BATassertProps(BAT *b)
BATloop(b, p, q) {
valp = BUNtail(bi, p);
- bool isnil = cmpf(valp, nilp) == 0;
+ bool isnil = nilp && cmpf(valp, nilp) == 0;
assert(b->ttype != TYPE_flt ||
!isinf(*(flt*)valp));
assert(b->ttype != TYPE_dbl ||
!isinf(*(dbl*)valp));
if (maxval && !isnil) {
@@ -2926,7 +2926,7 @@ BATassertProps(BAT *b)
BUN hb;
BUN prb;
valp = BUNtail(bi, p);
- bool isnil = cmpf(valp, nilp) == 0;
+ bool isnil = nilp && cmpf(valp, nilp) == 0;
assert(b->ttype != TYPE_flt ||
!isinf(*(flt*)valp));
assert(b->ttype != TYPE_dbl ||
!isinf(*(dbl*)valp));
if (maxval && !isnil) {
diff --git a/monetdb5/modules/atoms/sha256.c b/monetdb5/modules/atoms/sha256.c
--- a/monetdb5/modules/atoms/sha256.c
+++ b/monetdb5/modules/atoms/sha256.c
@@ -137,10 +137,10 @@ SHA256hash(const void *L)
}
static str
-SHA256_fromstr(sha256 *ret, str *s)
+SHA256_fromstr(sha256 **ret, str *s)
{
size_t len = sizeof(sha256);
- if (SHA256fromString(*s, &len, (void **) &ret, false) < 0)
+ if (SHA256fromString(*s, &len, (void **) ret, false) < 0)
throw(MAL, "calc.sha256", GDK_EXCEPTION);
return MAL_SUCCEED;
}
diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -1731,6 +1731,10 @@ stmt_col(backend *be, sql_column *c, stm
{
stmt *sc = stmt_bat(be, c, RDONLY, part);
+ if (c->null && c->nullmask) {
+ assert(0);
+ }
+
if (isTable(c->t) && c->t->access != TABLE_READONLY &&
(!isNew(c) || !isNew(c->t) /* alter */) &&
(c->t->persistence == SQL_PERSIST || c->t->s) /*&&
!c->t->commit_action*/) {
diff --git a/sql/include/sql_catalog.h b/sql/include/sql_catalog.h
--- a/sql/include/sql_catalog.h
+++ b/sql/include/sql_catalog.h
@@ -619,6 +619,7 @@ typedef struct sql_column {
sql_subtype type;
int colnr;
bit null;
+ bit nullmask;
char *def;
char unique; /* 0 NOT UNIQUE, 1 SUB_UNIQUE, 2 UNIQUE */
int drop_action; /* only used for alter statements */
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -566,6 +566,7 @@ load_column(sql_trans *tr, sql_table *t,
if (!strNil(def))
c->def =_STRDUP(def);
c->null = *(bit*)store->table_api.table_fetch_value(rt_cols,
find_sql_column(columns, "null"));
+ c->nullmask = (c->null && !ATOMnilptr(c->type.type->localtype));
c->colnr = *(int*)store->table_api.table_fetch_value(rt_cols,
find_sql_column(columns, "number"));
c->unique = 0;
c->storage_type = NULL;
@@ -2952,6 +2953,7 @@ column_dup(sql_trans *tr, sql_column *oc
if (oc->def)
c->def =_STRDUP(oc->def);
c->null = oc->null;
+ c->nullmask = oc->nullmask;
c->colnr = oc->colnr;
c->unique = oc->unique;
c->t = t;
@@ -3591,6 +3593,7 @@ sql_trans_copy_column( sql_trans *tr, sq
if (c->def)
col->def =_STRDUP(c->def);
col->null = c->null;
+ col->nullmask = c->nullmask;
col->colnr = c->colnr;
col->unique = c->unique;
col->t = t;
@@ -5924,6 +5927,7 @@ create_sql_column_with_id(sql_allocator
col->type = *tpe;
col->def = NULL;
col->null = 1;
+ col->nullmask = (col->null && !ATOMnilptr(col->type.type->localtype));
col->colnr = table_next_column_nr(t);
col->t = t;
col->unique = 0;
@@ -6233,6 +6237,7 @@ sql_trans_alter_null(sql_trans *tr, sql_
if ((res = new_column(tr, col, &dup)))
return res;
dup->null = isnull;
+ dup->nullmask = (dup->null &&
!ATOMnilptr(dup->type.type->localtype));
/* disallow concurrent updates on the column if not null is set
*/
/* this dependency is needed for merge tables */
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]