Changeset: 26eacb3b4a7e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=26eacb3b4a7e
Modified Files:
        monetdb5/modules/mal/mal_weld.c
Branch: mal-weld
Log Message:

weld group.group - check if the previous group IDs were computing in the curr 
weld program


diffs (36 lines):

diff --git a/monetdb5/modules/mal/mal_weld.c b/monetdb5/modules/mal/mal_weld.c
--- a/monetdb5/modules/mal/mal_weld.c
+++ b/monetdb5/modules/mal/mal_weld.c
@@ -792,18 +792,28 @@ WeldGroup(Client cntxt, MalBlkPtr mb, Ma
        /* Build zip(col1, col2, ...) */
        wstate->groupDeps[groups] = pci;
        InstrPtr dep = pci;
+       int count = 0, colArgNo = 3;
        char zipStmt[STR_SIZE_INC] = {'\0'};
        char dictTypeStmt[STR_SIZE_INC] = {'\0'};
        char dictKeyStmt[STR_SIZE_INC] = {'\0'};
        char structMember[64];
-       int count = 0;
        while (dep != NULL) {
-               int col = getArg(dep, 3);
-               int colType = getBatType(getArgType(mb, dep, 3));
+               int col = getArg(dep, colArgNo);
+               int colType = getBatType(getArgType(mb, dep, colArgNo));
                if (dep->argc == 6) {
                        int oldGrps = getArg(dep, 4);
-                       dep = wstate->groupDeps[oldGrps];
+                       if (wstate->groupDeps[oldGrps] != NULL) {
+                               /* the previous groups were computed in this 
Weld program so we can use the column */
+                               dep = wstate->groupDeps[oldGrps];
+                       } else if (colArgNo == 3) {
+                               /* the previous groups were not computed in 
this Weld program so we need to use them */
+                               colArgNo = 4;
+                       } else {
+                               /* currently using the precomputed group ids, 
this is the last step */
+                               dep = NULL;
+                       }
                } else {
+                       /* last column in the grouping */
                        dep = NULL;
                }
                sprintf(zipStmt + strlen(zipStmt), "v%d,", col);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to