Changeset: 3fd16df2902c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3fd16df2902c
Modified Files:
        monetdb5/mal/mal_instruction.c
        monetdb5/optimizer/opt_pushselect.c
Branch: Dec2023
Log Message:

Decouple stmt and var growth in the MAL block.


diffs (57 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
@@ -161,22 +161,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;
 }
 
@@ -1165,13 +1149,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);
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to