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

timeout BATcalcavg


diffs (35 lines):

diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -2918,6 +2918,8 @@ BATgroupavg3combine(BAT *avg, BAT *rem, 
                /* first try to calculate the sum of all values into a */ \
                /* lng/hge */                                           \
                while (ncand > 0) {                                     \
+                       GDK_CHECK_TIMEOUT(timeoffset, counter,\
+                                       TIMEOUT_HANDLER(GDK_FAIL));\
                        ncand--;                                        \
                        i = canditer_next(&ci) - b->hseqbase;           \
                        x = ((const TYPE *) src)[i];                    \
@@ -2981,6 +2983,8 @@ BATgroupavg3combine(BAT *avg, BAT *rem, 
                double a = 0;                                   \
                TYPE x;                                         \
                while (ncand > 0) {                             \
+                       GDK_CHECK_TIMEOUT(timeoffset, counter,\
+                                       TIMEOUT_HANDLER(GDK_FAIL));\
                        ncand--;                                \
                        i = canditer_next(&ci) - b->hseqbase;   \
                        x = ((const TYPE *) src)[i];            \
@@ -3008,6 +3012,13 @@ BATcalcavg(BAT *b, BAT *s, dbl *avg, BUN
        bool abort_on_error = true;
        BUN nils = 0;
 
+       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;
+       }
+
        ncand = canditer_init(&ci, b, s);
 
        src = Tloc(b, 0);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to