Changeset: c4dd5cbbfdd7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c4dd5cbbfdd7
Modified Files:
monetdb5/mal/mal_instruction.c
monetdb5/optimizer/opt_pushselect.c
sql/backends/monet5/sql.c
sql/server/rel_basetable.c
Branch: Aug2024
Log Message:
Merge with Dec2023 branch.
diffs (91 lines):
diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c
--- a/monetdb5/mal/mal_instruction.c
+++ b/monetdb5/mal/mal_instruction.c
@@ -169,22 +169,6 @@ resizeMalBlk(MalBlkPtr mb, int elements)
return -1;
}
}
-
-
- if (elements > mb->vsize) {
- VarRecord *ovar = mb->var;
- mb->var = GDKrealloc(mb->var, elements * sizeof(VarRecord));
- if (mb->var) {
- memset(((char *) mb->var) +sizeof(VarRecord) *
mb->vsize, 0,
- (elements - mb->vsize) * sizeof(VarRecord));
- mb->vsize = elements;
- } else {
- mb->var = ovar;
- mb->errors = createMalException(mb, 0, TYPE,
-
SQLSTATE(HY013) MAL_MALLOC_FAIL);
- return -1;
- }
- }
return 0;
}
@@ -1117,13 +1101,11 @@ void
pushInstruction(MalBlkPtr mb, InstrPtr p)
{
int i;
- int extra;
InstrPtr q;
if (p == NULL)
return;
- extra = mb->vsize - mb->vtop; /* the extra variables already known */
if (mb->stop + 1 >= mb->ssize) {
- int s = ((mb->ssize + extra) / MALCHUNK + 1) * MALCHUNK;
+ int s = (mb->ssize / MALCHUNK + 1) * MALCHUNK;
if (resizeMalBlk(mb, s) < 0) {
/* we are now left with the situation that the new
* instruction is dangling. The hack is to take an
diff --git a/monetdb5/optimizer/opt_pushselect.c
b/monetdb5/optimizer/opt_pushselect.c
--- a/monetdb5/optimizer/opt_pushselect.c
+++ b/monetdb5/optimizer/opt_pushselect.c
@@ -432,10 +432,8 @@ OPTpushselectImplementation(Client cntxt
slices = (int *) GDKzalloc(sizeof(int) * mb->vtop);
rslices = (bool *) GDKzalloc(sizeof(bool) * mb->vtop);
oclean = (bool *) GDKzalloc(sizeof(bool) * mb->vtop);
- if (!nvars || !slices || !rslices || !oclean
- || newMalBlkStmt(mb,
- mb->stop + (5 *
push_down_delta) + (2 * nr_topn)) <
- 0) {
+ if (!nvars || !slices || !rslices || !oclean ||
+ newMalBlkStmt(mb, mb->stop + (5 * push_down_delta) + (2 *
nr_topn)) < 0) {
mb->stmt = old;
GDKfree(vars);
GDKfree(nvars);
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -5105,14 +5105,16 @@ SQLunionfunc(Client cntxt, MalBlkPtr mb,
i=1;
for (ii = 0; i < pci->retc &&
!ret; ii++, i++) {
BAT *b;
-
- if (!(b =
BATdescriptor(omb?env->stk[q->argv[ii]].val.bval:nstk->stk[q->argv[ii]].val.bval)))
+ ValPtr vp = omb ?
env->stk + q->argv[ii] : nstk->stk + q->argv[ii];
+
+ if (!(b =
BATdescriptor(vp->val.bval)))
ret =
createException(MAL, "sql.unionfunc", SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
else if
(BATappend(res[i], b, NULL, FALSE) != GDK_SUCCEED)
ret =
createException(MAL, "sql.unionfunc", GDK_EXCEPTION);
if (b) {
BBPrelease(b->batCacheid); /* release ref from env stack */
BBPunfix(b->batCacheid); /* free pointer */
+ VALempty(vp);
}
}
}
diff --git a/sql/server/rel_basetable.c b/sql/server/rel_basetable.c
--- a/sql/server/rel_basetable.c
+++ b/sql/server/rel_basetable.c
@@ -231,7 +231,7 @@ bind_col_exp(mvc *sql, rel_base_t *ba, c
static sql_exp *
bind_col(mvc *sql, sql_rel *rel, char *name, sql_column *c )
{
- if (rel_base_use(sql, rel, c->colnr)) {
+ if (!c || rel_base_use(sql, rel, c->colnr)) {
/* error */
return NULL;
}
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]