Changeset: 3f12a431f257 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3f12a431f257
Added Files:
sql/backends/monet5/sql_cast_impl_down_from_flt.h
sql/backends/monet5/sql_cast_impl_down_from_int.h
sql/backends/monet5/sql_cast_impl_up_to_flt.h
sql/backends/monet5/sql_cast_impl_up_to_int.h
sql/backends/monet5/sql_decimal.mal.sh
Removed Files:
sql/backends/monet5/sql_cast.sh
sql/backends/monet5/sql_decimal.sh
Modified Files:
clients/Tests/exports.stable.out
configure.ag
gdk/gdk.h
gdk/gdk_bbp.c
gdk/gdk_private.h
monetdb5/modules/kernel/bat5.c
monetdb5/modules/kernel/status.c
monetdb5/modules/mal/bbp.c
monetdb5/modules/mal/tablet.c
monetdb5/modules/mal/urlbox.c
sql/backends/monet5/Makefile.ag
sql/backends/monet5/sql.c
sql/backends/monet5/sql_cast.c
sql/backends/monet5/sql_cast.h
sql/backends/monet5/sql_decimal.mal
sql/include/sql_relation.h
sql/server/rel_schema.c
sql/storage/bat/bat_storage.c
sql/storage/store.c
Branch: default
Log Message:
Merge with default
diffs (truncated from 13614 to 300 lines):
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -222,7 +222,6 @@ void BBPcold(bat b);
int BBPdecref(bat b, int logical);
BAT *BBPdescriptor(bat b);
int BBPdir(int cnt, bat *subcommit);
-BATstore *BBPgetdesc(bat i);
void BBPhot(bat b);
int BBPin;
int BBPincref(bat b, int logical);
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -1703,7 +1703,7 @@ AM_CONDITIONAL(HAVE_JAVAMEROCONTROL,test
if test x$have_java_jdbc = xno -a x$have_java_control = xno; then
# no point doing anything with Java if all Java packages are disabled
have_java=no
- if test x$why_have_java = x ; then
+ if test "x$why_have_java" = x ; then
why_have_java="(have_java_jdbc = no && have_java_control = no)"
fi
fi
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -740,14 +740,7 @@ typedef struct {
Heap *heap; /* heap where the hash is stored */
} Hash;
-typedef struct {
- bte bits; /* how many bits in imprints */
- Heap *bins; /* ranges of bins */
- Heap *imps; /* heap of imprints */
- BUN impcnt; /* counter for imprints*/
- Heap *dict; /* cache dictionary for compressing imprints */
- BUN dictcnt; /* counter for cache dictionary */
-} Imprints;
+typedef struct Imprints Imprints;
/*
@@ -935,11 +928,7 @@ typedef struct {
BUN capacity; /* tuple capacity */
} BATrec;
-typedef struct PROPrec {
- int id;
- ValRecord v;
- struct PROPrec *next; /* simple chain of properties */
-} PROPrec;
+typedef struct PROPrec PROPrec;
/* see also comment near BATassertProps() for more information about
* the properties */
@@ -996,17 +985,8 @@ typedef struct BATiter {
oid hvid, tvid;
} BATiter;
-/*
- * The different parts of which a BAT consists are physically stored
- * next to each other in the BATstore type.
- */
-typedef struct BATstore {
- BAT B; /* storage for BAT descriptor */
- BAT BM; /* mirror (reverse) BAT */
- COLrec H; /* storage for head column */
- COLrec T; /* storage for tail column */
- BATrec S; /* the BAT properties */
-} BATstore;
+typedef struct BATstore BATstore;
+#define BATSTORESIZE (2 * (sizeof(BAT) + sizeof(COLrec)) + sizeof(BATrec))
typedef int (*GDKfcn) ();
@@ -1928,13 +1908,16 @@ gdk_export BBPrec *BBP[N_BBPINIT];
#define BBPcurstamp() BBP_curstamp
#define BBPrefs(i) (BBPcheck((i),"BBPrefs")?BBP_refs(i):-1)
#define BBPcache(i) (BBPcheck((i),"BBPcache")?BBP_cache(i):(BAT*) NULL)
+/* we use ABS(i) instead of -(i) here because of a bug in gcc 4.8.2
+ * (at least) with optimization enabled; it incorrectly complains
+ * about an array bound error in monetdb5/modules/kernel/status.c */
#define BBPname(i) \
(BBPcheck((i), "BBPname") ? \
((i) > 0 ? \
BBP[(i) >> BBPINITLOG][(i) & (BBPINIT - 1)].logical[0] : \
- (BBP[-(i) >> BBPINITLOG][-(i) & (BBPINIT - 1)].logical[1] ? \
- BBP[-(i) >> BBPINITLOG][-(i) & (BBPINIT - 1)].logical[1] : \
- BBP[-(i) >> BBPINITLOG][-(i) & (BBPINIT - 1)].logical[0])) : \
+ (BBP[ABS(i) >> BBPINITLOG][ABS(i) & (BBPINIT - 1)].logical[1] ? \
+ BBP[ABS(i) >> BBPINITLOG][ABS(i) & (BBPINIT - 1)].logical[1] : \
+ BBP[ABS(i) >> BBPINITLOG][ABS(i) & (BBPINIT - 1)].logical[0])) : \
"")
#define BBPvalid(i) (BBP_logical(i) != NULL && *BBP_logical(i) != '.')
#define BATgetId(b) BBPname((b)->batCacheid)
@@ -1954,7 +1937,6 @@ gdk_export void BBPunlock(const char *s)
gdk_export str BBPlogical(bat b, str buf);
gdk_export str BBPphysical(bat b, str buf);
gdk_export int BBP_curstamp;
-gdk_export BATstore *BBPgetdesc(bat i);
gdk_export BAT *BBPquickdesc(bat b, int delaccess);
/*
@@ -3218,7 +3200,7 @@ gdk_export int ALIGNsetH(BAT *b1, BAT *b
#define GDK_MAX_VALUE 4
gdk_export void PROPdestroy(PROPrec *p);
-gdk_export PROPrec * BATgetprop(BAT *b, int idx);
+gdk_export PROPrec *BATgetprop(BAT *b, int idx);
gdk_export void BATsetprop(BAT *b, int idx, int type, void *v);
gdk_export BAT *BAThistogram(BAT *b);
gdk_export int BATtopN(BAT *b, BUN topN); /* used in
monet5/src/modules/kernel/algebra.mx */
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -2961,7 +2961,7 @@ complexatom(int t, int delaccess)
BAT *
BBPquickdesc(bat bid, int delaccess)
{
- BAT *b = BBP_cache(bid);
+ BAT *b;
if ( bid == 0)
return NULL;
@@ -2970,9 +2970,8 @@ BBPquickdesc(bat bid, int delaccess)
assert(0);
return NULL;
}
- if (b) {
+ if ((b = BBP_cache(bid)) != NULL)
return b; /* already cached */
- }
b = (BAT *) BBPgetdesc(bid);
if (b == NULL ||
complexatom(b->htype, delaccess) ||
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -19,6 +19,18 @@
/* This file should not be included in any file outside of this directory */
+/*
+ * The different parts of which a BAT consists are physically stored
+ * next to each other in the BATstore type.
+ */
+typedef struct BATstore {
+ BAT B; /* storage for BAT descriptor */
+ BAT BM; /* mirror (reverse) BAT */
+ COLrec H; /* storage for head column */
+ COLrec T; /* storage for tail column */
+ BATrec S; /* the BAT properties */
+} BATstore;
+
int ALIGNcommit(BAT *b);
int ALIGNundo(BAT *b);
int ATOMheap(int id, Heap *hp, size_t cap);
@@ -44,6 +56,7 @@ size_t BATvmsize(BAT *b, int dirty);
void BBPcacheit(BATstore *bs, int lock);
void BBPdump(void); /* never called: for debugging only */
void BBPexit(void);
+BATstore *BBPgetdesc(bat i);
void BBPinit(void);
bat BBPinsert(BATstore *bs);
void BBPtrim(size_t delta);
@@ -100,6 +113,21 @@ void IMPSprint(BAT *b);
#define BBP_BATMASK 511
#define BBP_THREADMASK 63
+typedef struct PROPrec {
+ int id;
+ ValRecord v;
+ struct PROPrec *next; /* simple chain of properties */
+} PROPrec;
+
+typedef struct Imprints {
+ bte bits; /* how many bits in imprints */
+ Heap *bins; /* ranges of bins */
+ Heap *imps; /* heap of imprints */
+ BUN impcnt; /* counter for imprints*/
+ Heap *dict; /* cache dictionary for compressing imprints */
+ BUN dictcnt; /* counter for cache dictionary */
+} Imprints;
+
typedef struct {
MT_Lock swap;
MT_Lock hash;
diff --git a/monetdb5/modules/kernel/bat5.c b/monetdb5/modules/kernel/bat5.c
--- a/monetdb5/modules/kernel/bat5.c
+++ b/monetdb5/modules/kernel/bat5.c
@@ -51,7 +51,7 @@ static BAT *
lock_desc(bat bid)
{
BBPfix(bid);
- return &BBPgetdesc(bid)->B;
+ return BBPquickdesc(bid, 0);
}
static void
@@ -979,7 +979,7 @@ CMDdestroy(bit *res, const char *input)
if (bid) {
BBPfix(bid);
if (BBPindex(input) == bid) {
- BAT *b = &BBPgetdesc(ABS(bid))->B;
+ BAT *b = BBPquickdesc(ABS(bid), 0);
BATmode(b, TRANSIENT);
*res = TRUE;
@@ -1668,7 +1668,7 @@ str
BKCgetSpaceUsed(lng *tot, int *bid)
{
BAT *b;
- size_t size = sizeof(BATstore);
+ size_t size = BATSTORESIZE;
if ((b = BATdescriptor(*bid)) == NULL)
throw(MAL, "bat.getSpaceUsed", RUNTIME_OBJECT_MISSING);
@@ -1892,7 +1892,7 @@ BKCheat(int *res, str *input)
int bid = BBPindex(*input);
if (bid) {
- *res = BBP_lastused(bid) & 0x7fffffff;
+ *res = BBPLASTUSED(BBP_lastused(bid));
}
throw(MAL, "bat", PROGRAM_NYI);
}
diff --git a/monetdb5/modules/kernel/status.c b/monetdb5/modules/kernel/status.c
--- a/monetdb5/modules/kernel/status.c
+++ b/monetdb5/modules/kernel/status.c
@@ -309,7 +309,7 @@ SYSmem_usage(int *ret, int *ret2, lng *m
s = BBPname(i);
sz = 0;
if (BBP_desc(i))
- sz += sizeof(BATstore);
+ sz += BATSTORESIZE;
if (BBP_logical(i))
n += strLen(BBP_logical(i));
if (BBP_logical(-i))
diff --git a/monetdb5/modules/mal/bbp.c b/monetdb5/modules/mal/bbp.c
--- a/monetdb5/modules/mal/bbp.c
+++ b/monetdb5/modules/mal/bbp.c
@@ -195,7 +195,7 @@ CMDbbpbind(Client cntxt, MalBlkPtr mb, M
if (lhs->vtype == TYPE_bat) {
BAT *b;
- b = (BAT *) BBPgetdesc(lhs->val.bval);
+ b = BBPquickdesc(lhs->val.bval, 0);
if (b == NULL)
throw(MAL, "bbp.bind", INTERNAL_BAT_ACCESS);
BBPincref(b->batCacheid, TRUE);
diff --git a/monetdb5/modules/mal/tablet.c b/monetdb5/modules/mal/tablet.c
--- a/monetdb5/modules/mal/tablet.c
+++ b/monetdb5/modules/mal/tablet.c
@@ -258,24 +258,19 @@ TABLETcollect_parts(Tablet *as, BUN offs
BAT *bv = NULL;
BATsetaccess(b, BAT_READ);
- bv = BATslice(b, offset, BATcount(b));
+ bv = BATslice(b, (offset>0)?offset-1:0, BATcount(b));
bats[i] = bv;
BATderiveProps(bv, 1);
- b->hkey &= bv->hkey;
- b->tkey &= bv->tkey;
- b->H->nonil &= bv->H->nonil;
+ b->tkey = (offset>0)?FALSE:bv->tkey;
b->T->nonil &= bv->T->nonil;
- b->hdense &= bv->hdense;
b->tdense &= bv->tdense;
- if (b->hsorted != bv->hsorted)
- b->hsorted = 0;
- if (b->hrevsorted != bv->hrevsorted)
- b->hrevsorted = 0;
if (b->tsorted != bv->tsorted)
b->tsorted = 0;
if (b->trevsorted != bv->trevsorted)
b->trevsorted = 0;
+ if (b->tdense)
+ b->tkey = TRUE;
b->batDirty = TRUE;
if (cnt != BATcount(b)) {
diff --git a/monetdb5/modules/mal/urlbox.c b/monetdb5/modules/mal/urlbox.c
--- a/monetdb5/modules/mal/urlbox.c
+++ b/monetdb5/modules/mal/urlbox.c
@@ -505,7 +505,7 @@ URLBOXgetSize(int *r){
BATseqbase(b,0);
for(i=0; i<urlDepth; i++){
bn= urlBAT[i];
- size = ROUND_UP(sizeof(BATstore), blksize);
+ size = ROUND_UP(BATSTORESIZE, blksize);
if (!isVIEW(bn)) {
BUN cnt = BATcapacity(bn);
diff --git a/sql/backends/monet5/Makefile.ag b/sql/backends/monet5/Makefile.ag
--- a/sql/backends/monet5/Makefile.ag
+++ b/sql/backends/monet5/Makefile.ag
@@ -48,6 +48,10 @@ lib__sql = {
sql_result.c sql_result.h \
sql_readline.c sql_readline.h \
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list