Changeset: f5b6ee9a98c2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f5b6ee9a98c2
Modified Files:
        gdk/gdk_aggr.c
Branch: qcancel
Log Message:

timeout do_groupmin do_groupmax


diffs (85 lines):

diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -3271,6 +3271,8 @@ BATgroupsize(BAT *b, BAT *g, BAT *e, BAT
                if (ngrp == cnt) {                                      \
                        /* single element groups */                     \
                        while (ncand > 0) {                             \
+                               GDK_CHECK_TIMEOUT(timeoffset, counter,\
+                                               TIMEOUT_HANDLER(BUN_NONE));\
                                ncand--;                                \
                                i = canditer_next(ci) - b->hseqbase;    \
                                if (!skip_nils ||                       \
@@ -3282,6 +3284,8 @@ BATgroupsize(BAT *b, BAT *g, BAT *e, BAT
                } else {                                                \
                        gid = 0; /* in case gids == NULL */             \
                        while (ncand > 0) {                             \
+                               GDK_CHECK_TIMEOUT(timeoffset, counter,\
+                                               TIMEOUT_HANDLER(BUN_NONE));\
                                ncand--;                                \
                                i = canditer_next(ci) - b->hseqbase;    \
                                if (gids == NULL ||                     \
@@ -3318,6 +3322,13 @@ do_groupmin(oid *restrict oids, BAT *b, 
        int (*atomcmp)(const void *, const void *);
        BATiter bi;
 
+       size_t counter = 0;
+       lng timeoffset = 0;
+       QryCtx *qry_ctx = MT_thread_get_qry_ctx();
+       if (qry_ctx != NULL) {
+               timeoffset = (qry_ctx->starttime && qry_ctx->querytimeout) ? 
(qry_ctx->starttime + qry_ctx->querytimeout) : 0;
+       }
+
        nils = ngrp;
        for (i = 0; i < ngrp; i++)
                oids[i] = oid_nil;
@@ -3366,6 +3377,8 @@ do_groupmin(oid *restrict oids, BAT *b, 
                if (gdense) {
                        /* single element groups */
                        while (ncand > 0) {
+                               GDK_CHECK_TIMEOUT(timeoffset, counter,
+                                               TIMEOUT_HANDLER(BUN_NONE));
                                ncand--;
                                i = canditer_next(ci) - b->hseqbase;
                                if (!skip_nils ||
@@ -3377,6 +3390,8 @@ do_groupmin(oid *restrict oids, BAT *b, 
                } else {
                        gid = 0; /* in case gids == NULL */
                        while (ncand > 0) {
+                               GDK_CHECK_TIMEOUT(timeoffset, counter,
+                                               TIMEOUT_HANDLER(BUN_NONE));
                                ncand--;
                                i = canditer_next(ci) - b->hseqbase;
                                if (gids == NULL ||
@@ -3422,6 +3437,13 @@ do_groupmax(oid *restrict oids, BAT *b, 
        int (*atomcmp)(const void *, const void *);
        BATiter bi;
 
+       size_t counter = 0;
+       lng timeoffset = 0;
+       QryCtx *qry_ctx = MT_thread_get_qry_ctx();
+       if (qry_ctx != NULL) {
+               timeoffset = (qry_ctx->starttime && qry_ctx->querytimeout) ? 
(qry_ctx->starttime + qry_ctx->querytimeout) : 0;
+       }
+
        nils = ngrp;
        for (i = 0; i < ngrp; i++)
                oids[i] = oid_nil;
@@ -3470,6 +3492,8 @@ do_groupmax(oid *restrict oids, BAT *b, 
                if (gdense) {
                        /* single element groups */
                        while (ncand > 0) {
+                               GDK_CHECK_TIMEOUT(timeoffset, counter,
+                                               TIMEOUT_HANDLER(BUN_NONE));
                                ncand--;
                                i = canditer_next(ci) - b->hseqbase;
                                if (!skip_nils ||
@@ -3481,6 +3505,8 @@ do_groupmax(oid *restrict oids, BAT *b, 
                } else {
                        gid = 0; /* in case gids == NULL */
                        while (ncand > 0) {
+                               GDK_CHECK_TIMEOUT(timeoffset, counter,
+                                               TIMEOUT_HANDLER(BUN_NONE));
                                ncand--;
                                i = canditer_next(ci) - b->hseqbase;
                                if (gids == NULL ||
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to