Changeset: b58b19a11e87 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b58b19a11e87
Modified Files:
clients/Tests/exports.stable.out
gdk/gdk.h
gdk/gdk_batop.c
sql/storage/bat/bat_storage.c
Branch: Jul2021
Log Message:
Fix interface of new functions, and use at least one of them.
diffs (90 lines):
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -181,7 +181,7 @@ BAT *BATproject2(BAT *restrict l, BAT *r
BAT *BATprojectchain(BAT **bats);
gdk_return BATrangejoin(BAT **r1p, BAT **r2p, BAT *l, BAT *rl, BAT *rh, BAT
*sl, BAT *sr, bool li, bool hi, bool anti, bool symmetric, BUN estimate)
__attribute__((__warn_unused_result__));
gdk_return BATreplace(BAT *b, BAT *p, BAT *n, bool force)
__attribute__((__warn_unused_result__));
-gdk_return BATreplacepos(BAT *b, const oid *positions, BAT *n, bool force)
__attribute__((__warn_unused_result__));
+gdk_return BATreplacepos(BAT *b, const oid *positions, BAT *n, bool autoincr,
bool force) __attribute__((__warn_unused_result__));
gdk_return BATroles(BAT *b, const char *tnme);
BAT *BATsample(BAT *b, BUN n);
BAT *BATsample_with_seed(BAT *b, BUN n, uint64_t seed);
@@ -205,7 +205,7 @@ void BATundo(BAT *b);
BAT *BATunique(BAT *b, BAT *s);
BAT *BATunmask(BAT *b);
gdk_return BATupdate(BAT *b, BAT *p, BAT *n, bool force)
__attribute__((__warn_unused_result__));
-gdk_return BATupdatepos(BAT *b, const oid *positions, BAT *n, bool force)
__attribute__((__warn_unused_result__));
+gdk_return BATupdatepos(BAT *b, const oid *positions, BAT *n, bool autoincr,
bool force) __attribute__((__warn_unused_result__));
BBPrec *BBP[N_BBPINIT];
gdk_return BBPaddfarm(const char *dirname, uint32_t rolemask, bool logerror);
void BBPclear(bat bid);
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1091,9 +1091,9 @@ gdk_export gdk_return BATreplace(BAT *b,
__attribute__((__warn_unused_result__));
gdk_export gdk_return BATupdate(BAT *b, BAT *p, BAT *n, bool force)
__attribute__((__warn_unused_result__));
-gdk_export gdk_return BATreplacepos(BAT *b, const oid *positions, BAT *n, bool
force)
+gdk_export gdk_return BATreplacepos(BAT *b, const oid *positions, BAT *n, bool
autoincr, bool force)
__attribute__((__warn_unused_result__));
-gdk_export gdk_return BATupdatepos(BAT *b, const oid *positions, BAT *n, bool
force)
+gdk_export gdk_return BATupdatepos(BAT *b, const oid *positions, BAT *n, bool
autoincr, bool force)
__attribute__((__warn_unused_result__));
/* Functions to perform a binary search on a sorted BAT.
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -1158,7 +1158,7 @@ BATappend_or_update(BAT *b, BAT *p, cons
lng t0 = GDKusec();
oid pos = oid_nil;
- if (b == NULL || b->ttype == TYPE_void || p == NULL || n == NULL) {
+ if (b == NULL || b->ttype == TYPE_void || n == NULL) {
return GDK_SUCCEED;
}
/* either p or positions */
@@ -1696,17 +1696,17 @@ BATupdate(BAT *b, BAT *p, BAT *n, bool f
/* like BATreplace, but the positions are given by an array of oid values */
gdk_return
-BATreplacepos(BAT *b, const oid *positions, BAT *n, bool force)
+BATreplacepos(BAT *b, const oid *positions, BAT *n, bool autoincr, bool force)
{
- return BATappend_or_update(b, NULL, positions, n, false, false, force);
+ return BATappend_or_update(b, NULL, positions, n, false, autoincr,
force);
}
/* like BATreplace, but the positions are given by an array of oid
* values, and they may specify locations beyond the end of b */
gdk_return
-BATupdatepos(BAT *b, const oid *positions, BAT *n, bool force)
+BATupdatepos(BAT *b, const oid *positions, BAT *n, bool autoincr, bool force)
{
- return BATappend_or_update(b, NULL, positions, n, true, false, force);
+ return BATappend_or_update(b, NULL, positions, n, true, autoincr,
force);
}
/*
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
@@ -1513,14 +1513,8 @@ delta_append_bat(sql_trans *tr, sql_delt
if (BATappend(b, oi, NULL, true) != GDK_SUCCEED)
err = 1;
} else if (!offsets) {
- BUN cnt = BATcount(oi);
- BATiter oii = bat_iterator(oi);
- for (BUN i=0;i<cnt; i++, offset++) {
- void *v = BUNtail(oii, i);
- if (BUNreplace(b, offset, v, true) != GDK_SUCCEED)
- err = 1;
- }
- bat_iterator_end(&oii);
+ if (BATreplacepos(b, &offset, oi, true, true) != GDK_SUCCEED)
+ err = 1;
} else if ((BATtdense(offsets) && offsets->tseqbase ==
(b->hseqbase+BATcount(b)))) {
if (BATappend(b, oi, NULL, true) != GDK_SUCCEED)
err = 1;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list