Changeset: 163611ae616e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=163611ae616e
Added Files:
        clients/R/Tests/dbi.reqtests
        clients/R/Tests/dplyr.reqtests
        clients/R/Tests/survey.reqtests
Modified Files:
        gdk/gdk_bat.c
        gdk/gdk_bbp.c
        gdk/gdk_select.c
Branch: mosaic
Log Message:

Merge with default branch.


diffs (184 lines):

diff --git a/clients/R/Tests/dbi.reqtests b/clients/R/Tests/dbi.reqtests
new file mode 100644
--- /dev/null
+++ b/clients/R/Tests/dbi.reqtests
@@ -0,0 +1,1 @@
+install
diff --git a/clients/R/Tests/dplyr.reqtests b/clients/R/Tests/dplyr.reqtests
new file mode 100644
--- /dev/null
+++ b/clients/R/Tests/dplyr.reqtests
@@ -0,0 +1,1 @@
+install
diff --git a/clients/R/Tests/survey.reqtests b/clients/R/Tests/survey.reqtests
new file mode 100644
--- /dev/null
+++ b/clients/R/Tests/survey.reqtests
@@ -0,0 +1,1 @@
+install
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -601,6 +601,8 @@ BATclear(BAT *b, int force)
        else
                b->batFirst = b->batInserted;
        BATsetcount(b,0);
+       BATseqbase(b, 0);
+       BATseqbase(BATmirror(b), 0);
        b->batDirty = TRUE;
        BATsettrivprop(b);
        return b;
@@ -2122,6 +2124,10 @@ BATsetcount(BAT *b, BUN cnt)
        b->T->heap.free = tailsize(b, BUNfirst(b) + cnt);
        if (b->H->type == TYPE_void && b->T->type == TYPE_void)
                b->batCapacity = cnt;
+       if (cnt <= 1) {
+               b->hsorted = b->hrevsorted = BATatoms[b->htype].linear != 0;
+               b->tsorted = b->trevsorted = BATatoms[b->ttype].linear != 0;
+       }
        assert(b->batCapacity >= cnt);
 }
 
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -733,6 +733,8 @@ heapinit(COLrec *col, const char *buf, i
                   &n) < 13)
                GDKfatal("BBPinit: invalid format for BBP.dir\n%s", buf);
 
+       if (properties & ~0x0F81)
+               GDKfatal("BBPinit: unknown properties are set: incompatible 
database\n");
        *hashash = var & 2;
        var &= ~2;
        /* silently convert chr columns to bte */
@@ -1231,10 +1233,33 @@ BBPexit(void)
  * reclaimed as well.
  */
 static int
+heap_entry(stream *s, COLrec *col)
+{
+       int t;
+
+       t = col->type;
+       if (mnstr_printf(s, " %s %u %u %u " BUNFMT " " BUNFMT " " BUNFMT " "
+                        BUNFMT " " OIDFMT " " OIDFMT " " SZFMT " " SZFMT " %d",
+                         t >= 0 ? BATatoms[t].name : ATOMunknown_name(t),
+                         col->width,
+                         col->varsized | (col->vheap ? col->vheap->hashash << 
1 : 0),
+                        (unsigned short) col->sorted | ((unsigned short) 
col->revsorted << 7) | (((unsigned short) col->key & 0x01) << 8) | ((unsigned 
short) col->dense << 9) | ((unsigned short) col->nonil << 10) | ((unsigned 
short) col->nil << 11),
+                         col->nokey[0],
+                         col->nokey[1],
+                         col->nosorted,
+                         col->norevsorted,
+                         col->seq,
+                         col->align,
+                         col->heap.free,
+                         col->heap.size,
+                         (int) col->heap.newstorage) < 0)
+               return -1;
+       return 0;
+}
+
+static int
 new_bbpentry(stream *s, bat i)
 {
-       int t;
-
 #ifndef NDEBUG
        assert(i > 0);
        assert(i < (bat) ATOMIC_GET(BBPsize, BBPsizeLock, "new_bbpentry"));
@@ -1272,39 +1297,9 @@ new_bbpentry(stream *s, bat i)
                          (unsigned char) BBP_desc(i)->S.map_hheap,
                          (unsigned char) BBP_desc(i)->S.map_theap) < 0)
                return -1;
-       t = BBP_desc(i)->H.type;
-       if (mnstr_printf(s, " %s %u %u %u " BUNFMT " " BUNFMT " " BUNFMT " "
-                        BUNFMT " " OIDFMT " " OIDFMT " " SZFMT " " SZFMT " %d",
-                         t >= 0 ? BATatoms[t].name : ATOMunknown_name(t),
-                         BBP_desc(i)->H.width,
-                         BBP_desc(i)->H.varsized | (BBP_desc(i)->H.vheap ? 
BBP_desc(i)->H.vheap->hashash << 1 : 0),
-                        ((unsigned short) BBP_desc(i)->H.sorted & 0x01) | 
(((unsigned short) BBP_desc(i)->H.revsorted & 0x01) << 7) | (((unsigned short) 
BBP_desc(i)->H.key & 0x01) << 8) | (((unsigned short) BBP_desc(i)->H.dense & 
0x01) << 9) | (((unsigned short) BBP_desc(i)->H.nonil & 0x01) << 10) | 
(((unsigned short) BBP_desc(i)->H.nil & 0x01) << 11),
-                         BBP_desc(i)->H.nokey[0],
-                         BBP_desc(i)->H.nokey[1],
-                         BBP_desc(i)->H.nosorted,
-                         BBP_desc(i)->H.norevsorted,
-                         BBP_desc(i)->H.seq,
-                         BBP_desc(i)->H.align,
-                         BBP_desc(i)->H.heap.free,
-                         BBP_desc(i)->H.heap.size,
-                         (int) BBP_desc(i)->H.heap.newstorage) < 0)
+       if (heap_entry(s, &BBP_desc(i)->H) < 0)
                return -1;
-       t = BBP_desc(i)->T.type;
-       if (mnstr_printf(s, " %s %u %u %u " BUNFMT " " BUNFMT " " BUNFMT " "
-                        BUNFMT " " OIDFMT " " OIDFMT " " SZFMT " " SZFMT " %d",
-                         t >= 0 ? BATatoms[t].name : ATOMunknown_name(t),
-                         BBP_desc(i)->T.width,
-                         BBP_desc(i)->T.varsized | (BBP_desc(i)->T.vheap ? 
BBP_desc(i)->T.vheap->hashash << 1 : 0),
-                        ((unsigned short) BBP_desc(i)->T.sorted & 0x01) | 
(((unsigned short) BBP_desc(i)->T.revsorted & 0x01) << 7) | (((unsigned short) 
BBP_desc(i)->T.key & 0x01) << 8) | (((unsigned short) BBP_desc(i)->T.dense & 
0x01) << 9) | (((unsigned short) BBP_desc(i)->T.nonil & 0x01) << 10) | 
(((unsigned short) BBP_desc(i)->T.nil & 0x01) << 11),
-                         BBP_desc(i)->T.nokey[0],
-                         BBP_desc(i)->T.nokey[1],
-                         BBP_desc(i)->T.nosorted,
-                         BBP_desc(i)->T.norevsorted,
-                         BBP_desc(i)->T.seq,
-                         BBP_desc(i)->T.align,
-                         BBP_desc(i)->T.heap.free,
-                         BBP_desc(i)->T.heap.size,
-                         (int) BBP_desc(i)->T.heap.newstorage) < 0)
+       if (heap_entry(s, &BBP_desc(i)->T) < 0)
                return -1;
 
        if (BBP_desc(i)->H.vheap &&
diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c
--- a/gdk/gdk_select.c
+++ b/gdk/gdk_select.c
@@ -294,6 +294,12 @@ do {                                                       
                \
        }                                                               \
 } while (0)
 
+#define quickins(dst, cnt, o, bn)                      \
+       do{                                             \
+               assert((cnt) < BATcapacity(bn));        \
+               dst[cnt] = (o);                         \
+       } while(0)
+
 /* construct the mask */
 #define impsmask(CAND,TEST,B)                                          \
 do {                                                                   \
@@ -329,7 +335,7 @@ do {                                                        
                \
                                          * (dbl) (q-p) * 1.1 + 1024),  \
                                   BATcapacity(bn) + q - p, BUN_NONE)); \
        } else {                                                        \
-               impsloop(CAND, TEST, dst[cnt] = o);                     \
+               impsloop(CAND, TEST, quickins(dst, cnt, o, bn));        \
        }                                                               \
 } while (0)
 
@@ -367,7 +373,7 @@ do {                                                        
                \
                while (p < q) {                                         \
                        CAND;                                           \
                        v = src[o-off];                                 \
-                       buninsfix(bn, dst, cnt, (oid)(o),               \
+                       buninsfix(bn, dst, cnt, o,                      \
                                  (BUN) ((dbl) cnt / (dbl) (p-r)        \
                                         * (dbl) (q-p) * 1.1 + 1024),   \
                                  BATcapacity(bn) + q - p, BUN_NONE);   \
@@ -378,7 +384,8 @@ do {                                                        
                \
                while (p < q) {                                         \
                        CAND;                                           \
                        v = src[o-off];                                 \
-                       dst[cnt] = (oid)(o);                            \
+                       assert(cnt < BATcapacity(bn));                  \
+                       dst[cnt] = o;                                   \
                        cnt += (TEST);                                  \
                        p++;                                            \
                }                                                       \
@@ -675,7 +682,7 @@ fullscan_any(BAT *b, BAT *s, BAT *bn, co
        scanfunc_hge(NAME, CAND, END)
 
 /* scan/imprints select with candidates */
-scan_sel(candscan, o = (oid) (*candlist++), w = (BUN) ((*(oid *) Tloc(s,q?(q - 
1):0)) + 1))
+scan_sel(candscan, o = *candlist++, w = (BUN) ((*(oid *) Tloc(s,q?(q - 1):0)) 
+ 1))
 /* scan/imprints select without candidates */
 scan_sel(fullscan, o = (oid) (p+off), w = (BUN) (q+off))
 
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to