Changeset: 1d734f898f87 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/1d734f898f87
Modified Files:
monetdb5/modules/mal/heapn.c
Branch: pp_hashjoin
Log Message:
fix crash with limit 0
diffs (36 lines):
diff --git a/monetdb5/modules/mal/heapn.c b/monetdb5/modules/mal/heapn.c
--- a/monetdb5/modules/mal/heapn.c
+++ b/monetdb5/modules/mal/heapn.c
@@ -1536,6 +1536,32 @@ HEAPtopn(Client cntxt, MalBlkPtr m, MalS
BBPreclaim(gps);
return createException(SQL, "heapn.topn", SQLSTATE(HY013)
MAL_MALLOC_FAIL);
}
+ if (!hp->size) {
+ for(subheap *nsh = hp->sub; nsh; nsh = nsh->sub) {
+ bat *res = getArgReference_bat(s, pci, retc++);
+ *res = nsh->vb->batCacheid;
+ BBPretain(*res);
+ }
+ if (rgrp) {
+ *rgrp = hp->grpb->batCacheid;
+ BBPretain(*rgrp);
+ }
+ BBPreclaim(b);
+ BBPreclaim(gps);
+ BAT *P = COLnew(0, TYPE_oid, 0, TRANSIENT);
+ BAT *S = COLnew(0, TYPE_oid, 0, TRANSIENT);
+ if (!P || !S) {
+ BBPreclaim(P);
+ BBPreclaim(S);
+ return createException(SQL, "heapn.topn",
SQLSTATE(HY013) MAL_MALLOC_FAIL);
+ }
+ *pos = P->batCacheid;
+ BBPkeepref(P);
+ *sel = S->batCacheid;
+ BBPkeepref(S);
+ BBPkeepref(hps);
+ return MAL_SUCCEED;
+ }
subheap *sh = hp->sub;
int nxt = (int)ATOMIC_INC(&hp->counter);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]