Changeset: e41a45943665 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e41a45943665
Modified Files:
monetdb5/modules/mal/tablet.c
sql/backends/monet5/rel_bin.c
sql/common/sql_types.c
sql/storage/bat/bat_storage.c
Branch: nilmask
Log Message:
merged with default
diffs (288 lines):
diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -48,7 +48,12 @@ jobs:
ref: ${{ github.ref }}
- name: install pymonetdb cryptography
- run: pip3 install pymonetdb cryptography
+ run: pip3 install --user --upgrade pymonetdb cryptography
+ if: runner.os != 'macOS'
+
+ - name: install pymonetdb cryptography
+ run: pip3 install --user --break-system-packages --upgrade pymonetdb
cryptography
+ if: runner.os == 'macOS'
- name: make MonetDB on linux
run: |
@@ -83,7 +88,23 @@ jobs:
-DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison \
-DCMAKE_SUMMARY=ON
make install -j3
- if: runner.os == 'macOS'
+ if: runner.os == 'macOS' && runner.arch == 'x64'
+
+ - name: make MonetDB on macos
+ run: |
+ mkdir build
+ cd build
+ cmake .. \
+ -DCMAKE_INSTALL_PREFIX=$HOME/MDB \
+ -DPY3INTEGRATION=OFF \
+ -DRINTEGRATION=OFF \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DASSERT=OFF \
+ -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \
+ -DBISON_EXECUTABLE=/opt/homebrew/opt/bison/bin/bison \
+ -DCMAKE_SUMMARY=ON
+ make install -j3
+ if: runner.os == 'macOS' && runner.arch == 'arm64'
- name: choco packages
run: |
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -4065,6 +4065,33 @@ BBPsync(int cnt, bat *restrict subcommit
if (lock)
MT_lock_set(&GDKswapLock(bid));
}
+ if (subcommit) {
+ /* move any tail/theap files we find for this bat that
+ * are in the BACKUP directory to the SUBCOMMIT
+ * directory */
+ char fname[16]; /* plenty big enough */
+ if (snprintf(fname, sizeof(fname), "%o", i) < 16) {
+ /* the snprintf never fails, any of the
+ * below may fail */
+ if (GDKmove(0, BAKDIR, fname, "tail", SUBDIR,
fname, "tail", false) == GDK_SUCCEED)
+ TRC_DEBUG(BAT_, "moved %s.tail from %s
to %s\n",
+ fname, BAKDIR, SUBDIR);
+ if (GDKmove(0, BAKDIR, fname, "tail1", SUBDIR,
fname, "tail1", false) == GDK_SUCCEED)
+ TRC_DEBUG(BAT_, "moved %s.tail1 from %s
to %s\n",
+ fname, BAKDIR, SUBDIR);
+ if (GDKmove(0, BAKDIR, fname, "tail2", SUBDIR,
fname, "tail2", false) == GDK_SUCCEED)
+ TRC_DEBUG(BAT_, "moved %s.tail2 from %s
to %s\n",
+ fname, BAKDIR, SUBDIR);
+#if SIZEOF_VAR_T == 8
+ if (GDKmove(0, BAKDIR, fname, "tail4", SUBDIR,
fname, "tail4", false) == GDK_SUCCEED)
+ TRC_DEBUG(BAT_, "moved %s.tail4 from %s
to %s\n",
+ fname, BAKDIR, SUBDIR);
+#endif
+ if (GDKmove(0, BAKDIR, fname, "theap", SUBDIR,
fname, "theap", false) == GDK_SUCCEED)
+ TRC_DEBUG(BAT_, "moved %s.theap from %s
to %s\n",
+ fname, BAKDIR, SUBDIR);
+ }
+ }
BAT *b = dirty_bat(&i, subcommit != NULL);
if (i <= 0)
ret = GDK_FAIL;
diff --git a/monetdb5/modules/mal/tablet.c b/monetdb5/modules/mal/tablet.c
--- a/monetdb5/modules/mal/tablet.c
+++ b/monetdb5/modules/mal/tablet.c
@@ -1958,8 +1958,7 @@ SQLload_file(Client cntxt, Tablet *as, b
return BUN_NONE;
}
-/* return the latest reject table, to be on the safe side we should
- * actually create copies within a critical section. Ignored for now. */
+/* return the latest reject table */
str
COPYrejects(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
@@ -1971,10 +1970,27 @@ COPYrejects(Client cntxt, MalBlkPtr mb,
create_rejects_table(cntxt);
if (cntxt->error_row == NULL)
throw(MAL, "sql.rejects", "No reject table available");
- BBPretain(*row = cntxt->error_row->batCacheid);
- BBPretain(*fld = cntxt->error_fld->batCacheid);
- BBPretain(*msg = cntxt->error_msg->batCacheid);
- BBPretain(*inp = cntxt->error_input->batCacheid);
+ MT_lock_set(&errorlock);
+ BAT *bn1 = COLcopy(cntxt->error_row, cntxt->error_row->ttype, true,
TRANSIENT);
+ BAT *bn2 = COLcopy(cntxt->error_fld, cntxt->error_fld->ttype, true,
TRANSIENT);
+ BAT *bn3 = COLcopy(cntxt->error_msg, cntxt->error_msg->ttype, true,
TRANSIENT);
+ BAT *bn4 = COLcopy(cntxt->error_input, cntxt->error_input->ttype, true,
TRANSIENT);
+ MT_lock_unset(&errorlock);
+ if (bn1 == NULL || bn2 == NULL || bn3 == NULL || bn4 == NULL) {
+ BBPreclaim(bn1);
+ BBPreclaim(bn2);
+ BBPreclaim(bn3);
+ BBPreclaim(bn4);
+ throw(MAL, "sql.rejects", GDK_EXCEPTION);
+ }
+ *row = bn1->batCacheid;
+ *fld = bn2->batCacheid;
+ *msg = bn3->batCacheid;
+ *inp = bn4->batCacheid;
+ BBPkeepref(bn1);
+ BBPkeepref(bn2);
+ BBPkeepref(bn3);
+ BBPkeepref(bn4);
(void) mb;
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
@@ -1518,8 +1518,13 @@ exp_bin(backend *be, sql_exp *e, stmt *l
}
if (!l)
return NULL;
- s = stmt_convert(be, l, (!push&&l->nrcols==0)?NULL:sel, from,
to);
- } break;
+ if (from->type->eclass == EC_SEC && to->type->eclass == EC_SEC)
{
+ // trivial conversion because EC_SEC is always in
milliseconds
+ s = l;
+ } else {
+ s = stmt_convert(be, l, (!push&&l->nrcols==0)?NULL:sel,
from, to);
+ }
+ } break;
case e_func: {
node *en;
list *l = sa_list(sql->sa), *exps = e->l;
diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -421,22 +421,29 @@ subtype_cmp(sql_subtype *t1, sql_subtype
{
if (!t1->type || !t2->type)
return -1;
+ if (t1->type->eclass != t2->type->eclass)
+ return -1;
+ switch (t1->type->eclass) {
+ case EC_SEC:
+ case EC_MONTH:
+ if (t1->digits != t2->digits)
+ return -1;
+ return 0;
+ case EC_NUM:
+ break;
+ case EC_FLT:
+ if (t1->digits != t2->digits)
+ return -1;
+ break;
+ default:
+ if (t1->digits != t2->digits)
+ return -1;
+ if (t1->scale != t2->scale)
+ return -1;
+ break;
+ }
- if (t1->type->eclass == t2->type->eclass && t1->type->eclass == EC_SEC)
- return 0;
- if (t1->type->eclass == t2->type->eclass && t1->type->eclass ==
EC_MONTH)
- return 0;
- if ( !(t1->type->eclass == t2->type->eclass &&
- (EC_INTERVAL(t1->type->eclass) || t1->type->eclass == EC_NUM)) &&
- (t1->digits != t2->digits ||
- (!(t1->type->eclass == t2->type->eclass &&
- t1->type->eclass == EC_FLT) &&
- t1->scale != t2->scale)) )
- return -1;
-
- /* subtypes are only equal iff
- they map onto the same systemtype */
- return (type_cmp(t1->type, t2->type));
+ return type_cmp(t1->type, t2->type);
}
int
diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c
--- a/sql/server/rel_exp.c
+++ b/sql/server/rel_exp.c
@@ -2964,7 +2964,7 @@ exp_scale_algebra(mvc *sql, sql_subfunc
sql_subtype *lt = exp_subtype(l);
sql_subtype *rt = exp_subtype(r);
- if (lt->type->scale == SCALE_FIX && (lt->scale || rt->scale) &&
+ if (!EC_INTERVAL(lt->type->eclass) && lt->type->scale == SCALE_FIX &&
(lt->scale || rt->scale) &&
strcmp(sql_func_imp(f->func), "/") == 0) {
sql_subtype *res = f->res->h->data;
unsigned int scale, digits, digL, scaleL;
diff --git a/sql/server/rel_unnest.c b/sql/server/rel_unnest.c
--- a/sql/server/rel_unnest.c
+++ b/sql/server/rel_unnest.c
@@ -2133,17 +2133,7 @@ exp_physical_types(visitor *v, sql_rel *
if (!e || (e->type != e_func && e->type != e_convert) || !e->l)
return e;
- if (e->type == e_convert) {
- sql_subtype *ft = exp_fromtype(e);
- sql_subtype *tt = exp_totype(e);
-
- /* complex conversion matrix */
- if (ft->type->eclass == EC_SEC && tt->type->eclass == EC_SEC &&
ft->type->digits > tt->type->digits) {
- /* no conversion needed, just time adjustment */
- ne = e->l;
- ne->tpe = *tt; // ugh
- }
- } else {
+ if (e->type != e_convert) {
list *args = e->l;
sql_subfunc *f = e->f;
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
@@ -4502,7 +4502,7 @@ tc_gc_col( sql_store Store, sql_change *
return LOG_OK; /* cannot cleanup yet */
// d is oldest reachable delta
- if (d->next) // Unreachable can immediately be destroyed.
+ if (d->cs.merged && d->next) // Unreachable can immediately be
destroyed.
destroy_delta(d->next, true);
d->next = NULL;
@@ -4542,7 +4542,7 @@ tc_gc_upd_col( sql_store Store, sql_chan
return LOG_OK; /* cannot cleanup yet */
// d is oldest reachable delta
- if (d->next) // Unreachable can immediately be destroyed.
+ if (d->cs.merged && d->next) // Unreachable can immediately be
destroyed.
destroy_delta(d->next, true);
d->next = NULL;
@@ -4582,7 +4582,7 @@ tc_gc_idx( sql_store Store, sql_change *
return LOG_OK; /* cannot cleanup yet */
// d is oldest reachable delta
- if (d->next) // Unreachable can immediately be destroyed.
+ if (d->cs.merged && d->next) // Unreachable can immediately be
destroyed.
destroy_delta(d->next, true);
d->next = NULL;
@@ -4622,7 +4622,7 @@ tc_gc_upd_idx( sql_store Store, sql_chan
return LOG_OK; /* cannot cleanup yet */
// d is oldest reachable delta
- if (d->next) // Unreachable can immediately be destroyed.
+ if (d->cs.merged && d->next) // Unreachable can immediately be
destroyed.
destroy_delta(d->next, true);
d->next = NULL;
diff --git a/sql/test/BugTracker-2023/Tests/All
b/sql/test/BugTracker-2023/Tests/All
--- a/sql/test/BugTracker-2023/Tests/All
+++ b/sql/test/BugTracker-2023/Tests/All
@@ -25,3 +25,4 @@ orderby-debug-crash-7416
newurl-issue-7417
rel_order_by-assertion-7418
HAVE_LIBPY3?aggregate-vararg.Bug-7422
+interval-day-and-second.Bug-7353
diff --git
a/sql/test/BugTracker-2023/Tests/interval-day-and-second.Bug-7353.test
b/sql/test/BugTracker-2023/Tests/interval-day-and-second.Bug-7353.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2023/Tests/interval-day-and-second.Bug-7353.test
@@ -0,0 +1,11 @@
+query TTI nosort
+SELECT
+ CAST(CAST(value AS TEXT) AS INTERVAL HOUR) AS hours_col,
+ CAST(CAST(value AS TEXT) AS INTERVAL SECOND) AS seconds_col,
+ 42 AS fortytwo
+FROM sys.generate_series(1, 2);
+----
+1:00:00
+0:00:01
+42
+
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]