Changeset: d9487b848450 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d9487b848450
Modified Files:
gdk/gdk_firstn.c
Branch: default
Log Message:
Limit size of output; also compare heap root with nil.
diffs (44 lines):
diff --git a/gdk/gdk_firstn.c b/gdk/gdk_firstn.c
--- a/gdk/gdk_firstn.c
+++ b/gdk/gdk_firstn.c
@@ -1370,6 +1370,8 @@ BATgroupedfirstn(BUN n, BAT *s, BAT *g,
if (n == 0 || BATcount(bats[0]) == 0) {
return BATdense(0, 0, 0);
}
+ if (n > BATcount(bats[0]))
+ n = BATcount(bats[0]);
if ((err = BATgroupaggrinit(bats[0], g, NULL /* e */, s, &min, &max,
&ngrp, &ci)) != NULL) {
GDKerror("%s\n", err);
@@ -1421,15 +1423,23 @@ BATgroupedfirstn(BUN n, BAT *s, BAT *g,
BUNtail(batinfo[i].bi2,
oids[goff] - batinfo[i].hseq));
if (comp == 0)
continue;
- if (!batinfo[i].bi1.nonil &&
- batinfo[i].cmp(BUNtail(batinfo[i].bi1, o -
batinfo[i].hseq),
- batinfo[i].nil) == 0) {
- if (batinfo[i].nilslast)
- comp = 1;
- else
- comp = -1;
- } else if (!batinfo[i].asc)
+ if (!batinfo[i].asc)
comp = -comp;
+ if (!batinfo[i].bi1.nonil) {
+ if
(batinfo[i].cmp(BUNtail(batinfo[i].bi1, o - batinfo[i].hseq),
+ batinfo[i].nil) ==
0) {
+ if (batinfo[i].nilslast)
+ comp = 1;
+ else
+ comp = -1;
+ } else if
(batinfo[i].cmp(BUNtail(batinfo[i].bi1, oids[goff] - batinfo[i].hseq),
+
batinfo[i].nil) == 0) {
+ if (batinfo[i].nilslast)
+ comp = -1;
+ else
+ comp = 1;
+ }
+ }
break;
}
}
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]