Changeset: 961640c703e9 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=961640c703e9
Modified Files:
        gdk/gdk_batop.c
Branch: default
Log Message:

Materialize correct column before sorting it, and also when it's a view.


diffs (33 lines):

diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -1322,7 +1322,11 @@ BATsubsort(BAT **sorted, BAT **order, BA
                bn = BATleftfetchjoin(o, b, BATcount(b));
                if (bn == NULL)
                        goto error;
-               bn = BATmaterializeh(bn);
+               if (bn->ttype == TYPE_void || isVIEW(bn)) {
+                       b = BATcopy(bn, TYPE_void, ATOMtype(bn->ttype), TRUE);
+                       BBPunfix(bn->batCacheid);
+                       bn = b;
+               }
        } else {
                bn = BATcopy(b, TYPE_void, b->ttype, TRUE);
        }
@@ -1341,13 +1345,13 @@ BATsubsort(BAT **sorted, BAT **order, BA
                                goto error;
                } else {
                        /* create new order */
-                       on = BATnew(TYPE_void, TYPE_oid, BATcount(b));
+                       on = BATnew(TYPE_void, TYPE_oid, BATcount(bn));
                        if (on == NULL)
                                goto error;
                        grps = (oid *) Tloc(on, BUNfirst(on));
-                       for (p = 0, q = BATcount(b); p < q; p++)
+                       for (p = 0, q = BATcount(bn); p < q; p++)
                                     grps[p] = p;
-                       BATsetcount(on, BATcount(b));
+                       BATsetcount(on, BATcount(bn));
                        on->tkey = 1;
                }
                BATseqbase(on, 0);
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to