Changeset: b622ab7302b9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b622ab7302b9
Modified Files:
sql/storage/bat/bat_storage.c
Branch: iso
Log Message:
merged with jul2021
diffs (82 lines):
diff --git a/monetdb5/modules/mal/mkey.c b/monetdb5/modules/mal/mkey.c
--- a/monetdb5/modules/mal/mkey.c
+++ b/monetdb5/modules/mal/mkey.c
@@ -324,7 +324,7 @@ MKEYrotate_xor_hash(Client cntxt, MalBlk
static str
MKEYbulk_rotate_xor_hash(bat *res, const bat *hid, const int *nbits, const bat
*bid)
{
- BAT *hb, *b, *bn;
+ BAT *hb, *b, *ob = NULL, *bn;
int lbit = *nbits;
int rbit = (int) sizeof(lng) * 8 - lbit;
ulng *restrict r;
@@ -345,12 +345,23 @@ MKEYbulk_rotate_xor_hash(bat *res, const
throw(MAL, "mkey.rotate_xor_hash",
OPERATION_FAILED ": input bats are not aligned");
}
+ ob = b;
+ if (b && (b->ttype == TYPE_msk || mask_cand(b))) {
+ b = BATunmask(b);
+ if (!b) {
+ BBPunfix(hb->batCacheid);
+ BBPunfix(ob->batCacheid);
+ throw(MAL, "mkey.rotate_xor_hash", SQLSTATE(HY013)
MAL_MALLOC_FAIL);
+ }
+ }
n = BATcount(b);
bn = COLnew(b->hseqbase, TYPE_lng, n, TRANSIENT);
if (bn == NULL) {
BBPunfix(hb->batCacheid);
+ if (b != ob)
+ BBPunfix(ob->batCacheid);
BBPunfix(b->batCacheid);
throw(MAL, "mkey.rotate_xor_hash", SQLSTATE(HY013)
MAL_MALLOC_FAIL);
}
@@ -429,6 +440,8 @@ MKEYbulk_rotate_xor_hash(bat *res, const
bn->tnil = false;
BBPkeepref(*res = bn->batCacheid);
+ if (b != ob)
+ BBPunfix(ob->batCacheid);
BBPunfix(b->batCacheid);
BBPunfix(hb->batCacheid);
return MAL_SUCCEED;
diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -926,21 +926,21 @@ cs_update_bat( sql_trans *tr, column_sto
}
/* When we go to smaller grained update structures we should check for
concurrent updates on this column ! */
/* currently only one update delta is possible */
- if (!otids->tsorted || complex_cand(otids) /* make sure we have simple
dense or oids */) {
- BAT *sorted, *order;
- if (BATsort(&sorted, &order, NULL, otids, NULL, NULL, false,
false, false) != GDK_SUCCEED) {
+ if (!is_new && !cs->cleared) {
+ if (!otids->tsorted || complex_cand(otids) /* make sure we have
simple dense or oids */) {
+ BAT *sorted, *order;
+ if (BATsort(&sorted, &order, NULL, otids, NULL, NULL,
false, false, false) != GDK_SUCCEED) {
+ if (otids != tids)
+ bat_destroy(otids);
+ return LOG_ERR;
+ }
if (otids != tids)
bat_destroy(otids);
- return LOG_ERR;
+ otids = sorted;
+ oupdates = BATproject(order, oupdates);
+ bat_destroy(order);
}
- if (otids != tids)
- bat_destroy(otids);
- otids = sorted;
- oupdates = BATproject(order, oupdates);
- bat_destroy(order);
- }
- assert(otids->tsorted);
- if (!is_new && !cs->cleared) {
+ assert(otids->tsorted);
BAT *ui = NULL, *uv = NULL;
/* handle updates on just inserted bits */
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list