Changeset: 94d57352b355 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/94d57352b355
Modified Files:
        monetdb5/modules/mal/pp_mat.c
        sql/backends/monet5/bin_partition_by_slice.c
Branch: pp_hashjoin
Log Message:

fixes for mats which may have some empty parts


diffs (48 lines):

diff --git a/monetdb5/modules/mal/pp_mat.c b/monetdb5/modules/mal/pp_mat.c
--- a/monetdb5/modules/mal/pp_mat.c
+++ b/monetdb5/modules/mal/pp_mat.c
@@ -521,12 +521,13 @@ MATnr_parts(Client ctx, int *nr, const b
        assert(mt->s.type == MAT_SINK);
        int n = 0;
        for(int i = 0; i< mt->nr; i++) {
-               n += (int)((BATcount(mt->bat[i]) + sz - 1)/sz);
+               BUN nr = BATcount(mt->bat[i]);
+               n += (int)((nr + sz - 1)/sz);
                mt->bat[i] = BATsetaccess(mt->bat[i], BAT_READ);
+               if (!nr)
+                       n++;
        }
        mt->nr_parts = n;
-       int cnt = n;
-       n++;
        mt->part = (int*)GDKmalloc(sizeof(int) * n);
        mt->subpart = (int*)GDKmalloc(sizeof(int) * n);
        mt->slicesize = *slicesize;
@@ -538,9 +539,14 @@ MATnr_parts(Client ctx, int *nr, const b
                        mt->part[k] = i;
                        mt->subpart[k] = j;
                }
+               if (!nr) {
+                       mt->part[k] = i;
+                       mt->subpart[k] = 0;
+                       k++;
+               }
        }
+       *nr = n;
        BBPreclaim(m);
-       *nr = cnt;
        return MAL_SUCCEED;
 }
 
diff --git a/sql/backends/monet5/bin_partition_by_slice.c 
b/sql/backends/monet5/bin_partition_by_slice.c
--- a/sql/backends/monet5/bin_partition_by_slice.c
+++ b/sql/backends/monet5/bin_partition_by_slice.c
@@ -851,7 +851,7 @@ rel2bin_groupby_pp(backend *be, sql_rel 
                InstrPtr ctr = mat_counters_get(be, mat, seqnr);
                sub = mats_fetch_slices(be, sub, getArg(ctr, 0), getArg(ctr, 
1));
                /* fetch result bats */
-               shared = mats_fetch(be, shared, aggrresults, 
seqnr);//getArg(ctr, 0));
+               shared = mats_fetch(be, shared, aggrresults, getArg(ctr, 0));
                oaggrresults = aggrresults;
                aggrresults = shared;
        }
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to