Changeset: 7686602e7b38 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7686602e7b38
Modified Files:
        gdk/gdk_select.c
Branch: Mar2018
Log Message:

Fix point select for floating point nil.
We need to use the appropriate macro.


diffs (225 lines):

diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c
--- a/gdk/gdk_select.c
+++ b/gdk/gdk_select.c
@@ -441,8 +441,8 @@ BAT_hashselect(BAT *b, BAT *s, BAT *bn, 
 
 /* argument list for type-specific core scan select function call */
 #define scanargs                                                       \
-       b, s, bn, tl, th, li, hi, equi, anti, lval, hval, p, q, cnt, off, \
-       dst, candlist, maximum, use_imprints
+       b, s, bn, tl, th, li, hi, equi, anti, lval, hval, lnil, p, q,   \
+       cnt, off, dst, candlist, maximum, use_imprints
 
 #define PREVVALUEbte(x)        ((x) - 1)
 #define PREVVALUEsht(x)        ((x) - 1)
@@ -501,8 +501,8 @@ BAT_hashselect(BAT *b, BAT *s, BAT *bn, 
 #define scanfunc(NAME, TYPE, CAND, END)                                        
\
 static BUN                                                             \
 NAME##_##TYPE(BAT *b, BAT *s, BAT *bn, const TYPE *tl, const TYPE *th, \
-             bool li, bool hi, bool equi, bool anti, bool lval, bool hval,     
\
-             BUN r, BUN q, BUN cnt, lng off, oid *restrict dst,        \
+             bool li, bool hi, bool equi, bool anti, bool lval, bool hval, \
+             bool lnil, BUN r, BUN q, BUN cnt, lng off, oid *restrict dst, \
              const oid *candlist, BUN maximum, bool use_imprints)      \
 {                                                                      \
        TYPE vl = *tl;                                                  \
@@ -542,12 +542,15 @@ NAME##_##TYPE(BAT *b, BAT *s, BAT *bn, c
        END;                                                            \
        if (equi) {                                                     \
                assert(!use_imprints);                                  \
-               scanloop(NAME, CAND, v == vl);                          \
+               if (lnil)                                               \
+                       scanloop(NAME, CAND, is_##TYPE##_nil(v));       \
+               else                                                    \
+                       scanloop(NAME, CAND, v == vl);                  \
        } else if (anti) {                                              \
                if (b->tnonil) {                                        \
                        choose(NAME, CAND, (v <= vl || v >= vh), TYPE); \
                } else {                                                \
-                       choose(NAME, CAND, (v <= vl || v >= vh) && v != nil, 
TYPE); \
+                       choose(NAME, CAND, !is_##TYPE##_nil(v) && (v <= vl || v 
>= vh), TYPE); \
                }                                                       \
        } else if (b->tnonil && vl == minval) {                         \
                choose(NAME, CAND, v <= vh, TYPE);                      \
@@ -562,7 +565,7 @@ NAME##_##TYPE(BAT *b, BAT *s, BAT *bn, c
 static BUN
 candscan_any (BAT *b, BAT *s, BAT *bn, const void *tl, const void *th,
              bool li, bool hi, bool equi, bool anti, bool lval, bool hval,
-             BUN r, BUN q, BUN cnt, lng off, oid *restrict dst,
+             bool lnil, BUN r, BUN q, BUN cnt, lng off, oid *restrict dst,
              const oid *candlist, BUN maximum, bool use_imprints)
 {
        const void *v;
@@ -575,6 +578,7 @@ candscan_any (BAT *b, BAT *s, BAT *bn, c
 
        (void) maximum;
        (void) use_imprints;
+       (void) lnil;
 
        if (equi) {
                ALGODEBUG fprintf(stderr,
@@ -649,7 +653,7 @@ candscan_any (BAT *b, BAT *s, BAT *bn, c
 static BUN
 fullscan_any(BAT *b, BAT *s, BAT *bn, const void *tl, const void *th,
             bool li, bool hi, bool equi, bool anti, bool lval, bool hval,
-            BUN r, BUN q, BUN cnt, lng off, oid *restrict dst,
+            bool lnil, BUN r, BUN q, BUN cnt, lng off, oid *restrict dst,
             const oid *candlist, BUN maximum, bool use_imprints)
 {
        const void *v;
@@ -663,6 +667,7 @@ fullscan_any(BAT *b, BAT *s, BAT *bn, co
        (void) candlist;
        (void) maximum;
        (void) use_imprints;
+       (void) lnil;
 
        if (equi) {
                ALGODEBUG fprintf(stderr,
@@ -737,7 +742,7 @@ fullscan_any(BAT *b, BAT *s, BAT *bn, co
 static BUN
 fullscan_str(BAT *b, BAT *s, BAT *bn, const void *tl, const void *th,
             bool li, bool hi, bool equi, bool anti, bool lval, bool hval,
-            BUN r, BUN q, BUN cnt, lng off, oid *restrict dst,
+            bool lnil, BUN r, BUN q, BUN cnt, lng off, oid *restrict dst,
             const oid *candlist, BUN maximum, bool use_imprints)
 {
        var_t pos;
@@ -746,7 +751,7 @@ fullscan_str(BAT *b, BAT *s, BAT *bn, co
 
        if (!equi || !GDK_ELIMDOUBLES(b->tvheap))
                return fullscan_any(b, s, bn, tl, th, li, hi, equi, anti,
-                                   lval, hval, r, q, cnt, off, dst,
+                                   lval, hval, lnil, r, q, cnt, off, dst,
                                    candlist, maximum, use_imprints);
        ALGODEBUG fprintf(stderr,
                          "#BATselect(b=%s#"BUNFMT",s=%s%s,anti=%d): "
@@ -851,7 +856,7 @@ scan_sel(fullscan, o = (oid) (p+off), w 
 static BAT *
 BAT_scanselect(BAT *b, BAT *s, BAT *bn, const void *tl, const void *th,
               bool li, bool hi, bool equi, bool anti, bool lval, bool hval,
-              BUN maximum, bool use_imprints)
+              bool lnil, BUN maximum, bool use_imprints)
 {
 #ifndef NDEBUG
        int (*cmp)(const void *, const void *);
@@ -1817,7 +1822,7 @@ BATselect(BAT *b, BAT *s, const void *tl
                        use_imprints = true;
                }
                bn = BAT_scanselect(b, s, bn, tl, th, li, hi, equi, anti,
-                                   lval, hval, maximum, use_imprints);
+                                   lval, hval, lnil, maximum, use_imprints);
        }
 
        return virtualize(bn);
@@ -2238,6 +2243,7 @@ rangejoin(BAT *r1, BAT *r2, BAT *l, BAT 
                                        ncnt = candscan_bte(l, sl, r1, &vl, &vh,
                                                            true, true, false,
                                                            false, true, true,
+                                                           false,
                                                            lstart, lend, cnt,
                                                            off, dst1, lcand,
                                                            cnt + maximum,
@@ -2246,6 +2252,7 @@ rangejoin(BAT *r1, BAT *r2, BAT *l, BAT 
                                        ncnt = fullscan_bte(l, sl, r1, &vl, &vh,
                                                            true, true, false,
                                                            false, true, true,
+                                                           false,
                                                            lstart, lend, cnt,
                                                            off, dst1, NULL,
                                                            cnt + maximum,
@@ -2274,6 +2281,7 @@ rangejoin(BAT *r1, BAT *r2, BAT *l, BAT 
                                        ncnt = candscan_sht(l, sl, r1, &vl, &vh,
                                                            true, true, false,
                                                            false, true, true,
+                                                           false,
                                                            lstart, lend, cnt,
                                                            off, dst1, lcand,
                                                            cnt + maximum,
@@ -2282,6 +2290,7 @@ rangejoin(BAT *r1, BAT *r2, BAT *l, BAT 
                                        ncnt = fullscan_sht(l, sl, r1, &vl, &vh,
                                                            true, true, false,
                                                            false, true, true,
+                                                           false,
                                                            lstart, lend, cnt,
                                                            off, dst1, NULL,
                                                            cnt + maximum,
@@ -2323,6 +2332,7 @@ rangejoin(BAT *r1, BAT *r2, BAT *l, BAT 
                                        ncnt = candscan_int(l, sl, r1, &vl, &vh,
                                                            true, true, false,
                                                            false, true, true,
+                                                           false,
                                                            lstart, lend, cnt,
                                                            off, dst1, lcand,
                                                            cnt + maximum,
@@ -2331,6 +2341,7 @@ rangejoin(BAT *r1, BAT *r2, BAT *l, BAT 
                                        ncnt = fullscan_int(l, sl, r1, &vl, &vh,
                                                            true, true, false,
                                                            false, true, true,
+                                                           false,
                                                            lstart, lend, cnt,
                                                            off, dst1, NULL,
                                                            cnt + maximum,
@@ -2372,6 +2383,7 @@ rangejoin(BAT *r1, BAT *r2, BAT *l, BAT 
                                        ncnt = candscan_lng(l, sl, r1, &vl, &vh,
                                                            true, true, false,
                                                            false, true, true,
+                                                           false,
                                                            lstart, lend, cnt,
                                                            off, dst1, lcand,
                                                            cnt + maximum,
@@ -2380,6 +2392,7 @@ rangejoin(BAT *r1, BAT *r2, BAT *l, BAT 
                                        ncnt = fullscan_lng(l, sl, r1, &vl, &vh,
                                                            true, true, false,
                                                            false, true, true,
+                                                           false,
                                                            lstart, lend, cnt,
                                                            off, dst1, NULL,
                                                            cnt + maximum,
@@ -2409,6 +2422,7 @@ rangejoin(BAT *r1, BAT *r2, BAT *l, BAT 
                                        ncnt = candscan_hge(l, sl, r1, &vl, &vh,
                                                            true, true, false,
                                                            false, true, true,
+                                                           false,
                                                            lstart, lend, cnt,
                                                            off, dst1, lcand,
                                                            cnt + maximum,
@@ -2417,6 +2431,7 @@ rangejoin(BAT *r1, BAT *r2, BAT *l, BAT 
                                        ncnt = fullscan_hge(l, sl, r1, &vl, &vh,
                                                            true, true, false,
                                                            false, true, true,
+                                                           false,
                                                            lstart, lend, cnt,
                                                            off, dst1, NULL,
                                                            cnt + maximum,
@@ -2448,6 +2463,7 @@ rangejoin(BAT *r1, BAT *r2, BAT *l, BAT 
                                        ncnt = candscan_flt(l, sl, r1, &vl, &vh,
                                                            true, true, false,
                                                            false, true, true,
+                                                           false,
                                                            lstart, lend, cnt,
                                                            off, dst1, lcand,
                                                            cnt + maximum,
@@ -2456,6 +2472,7 @@ rangejoin(BAT *r1, BAT *r2, BAT *l, BAT 
                                        ncnt = fullscan_flt(l, sl, r1, &vl, &vh,
                                                            true, true, false,
                                                            false, true, true,
+                                                           false,
                                                            lstart, lend, cnt,
                                                            off, dst1, NULL,
                                                            cnt + maximum,
@@ -2486,6 +2503,7 @@ rangejoin(BAT *r1, BAT *r2, BAT *l, BAT 
                                        ncnt = candscan_dbl(l, sl, r1, &vl, &vh,
                                                            true, true, false,
                                                            false, true, true,
+                                                           false,
                                                            lstart, lend, cnt,
                                                            off, dst1, lcand,
                                                            cnt + maximum,
@@ -2494,6 +2512,7 @@ rangejoin(BAT *r1, BAT *r2, BAT *l, BAT 
                                        ncnt = fullscan_dbl(l, sl, r1, &vl, &vh,
                                                            true, true, false,
                                                            false, true, true,
+                                                           false,
                                                            lstart, lend, cnt,
                                                            off, dst1, NULL,
                                                            cnt + maximum,
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to