Changeset: 465a541f25f5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=465a541f25f5
Modified Files:
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_statement.c
sql/backends/monet5/sql_subquery.c
sql/server/rel_unnest.c
sql/test/remote/Tests/ssbm.stable.out
sql/test/remote/Tests/ssbm.stable.out.int128
Branch: sq2default
Log Message:
merged, but reverted change to exp_bin (ie don't generate a st_table for single
values)
diffs (truncated from 692 to 300 lines):
diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -505,6 +505,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
/* handle table returning functions */
if (l->type == e_psm && l->flag & PSM_REL) {
stmt *lst = r->op1;
+ //if (r->type == st_table && lst->nrcols == 0
&& lst->key) {
if (r->type == st_table && lst->nrcols == 0 &&
lst->key && e->card > CARD_ATOM) {
node *n;
list *l = sa_list(sql->sa);
@@ -1395,7 +1396,8 @@ rel2bin_basetable(backend *be, sql_rel *
if (!t && c)
t = c->t;
- dels = stmt_tid(be, t, rel->flag == REL_PARTITION);
+
+ dels = stmt_tid(be, t, rel->flag == REL_PARTITION);
/* add aliases */
assert(rel->exps);
@@ -1411,7 +1413,7 @@ rel2bin_basetable(backend *be, sql_rel *
const char *cname = cexp->r;
list *l = sa_list(sql->sa);
- c = find_sql_column(t, cname);
+ c = find_sql_column(t, cname);
s = stmt_col(be, c, dels);
append(l, s);
if (exps->h->next) {
diff --git a/sql/backends/monet5/sql_gencode.c
b/sql/backends/monet5/sql_gencode.c
--- a/sql/backends/monet5/sql_gencode.c
+++ b/sql/backends/monet5/sql_gencode.c
@@ -547,9 +547,9 @@ static int
/* catch exceptions */
p = newCatchStmt(curBlk,"MALexception");
- p = newExitStmt(curBlk,"MALexception");
- p = newCatchStmt(curBlk,"SQLexception");
- p = newExitStmt(curBlk,"SQLexception");
+ p = newExitStmt(curBlk,"MALexception");
+ p = newCatchStmt(curBlk,"SQLexception");
+ p = newExitStmt(curBlk,"SQLexception");
/* remote.disconnect(q); */
p = newStmt(curBlk, remoteRef, disconnectRef);
p = pushArgument(curBlk, p, q);
diff --git a/sql/backends/monet5/sql_statement.c
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -575,7 +575,7 @@ stmt_bat(backend *be, sql_column *c, int
s->nr = l[c->colnr+1];
return s;
}
- q = newStmt(mb, sqlRef, bindRef);
+ q = newStmt(mb, sqlRef, bindRef);
if (q == NULL)
return NULL;
if (access == RD_UPD_ID) {
diff --git a/sql/backends/monet5/sql_subquery.c
b/sql/backends/monet5/sql_subquery.c
--- a/sql/backends/monet5/sql_subquery.c
+++ b/sql/backends/monet5/sql_subquery.c
@@ -18,7 +18,7 @@ zero_or_one_error(ptr ret, const bat *bi
const void *p;
if ((b = BATdescriptor(*bid)) == NULL) {
- throw(SQL, "zero_or_one", SQLSTATE(HY005) "Cannot access column
descriptor");
+ throw(SQL, "sql.zero_or_one", SQLSTATE(HY005) "Cannot access
column descriptor");
}
c = BATcount(b);
if (c == 0) {
@@ -29,22 +29,22 @@ zero_or_one_error(ptr ret, const bat *bi
} else {
p = NULL;
BBPunfix(b->batCacheid);
- throw(SQL, "zero_or_one", SQLSTATE(21000) "Cardinality
violation, scalar value expected");
+ throw(SQL, "sql.zero_or_one", SQLSTATE(21000) "Cardinality
violation, scalar value expected");
}
_s = ATOMsize(ATOMtype(b->ttype));
if (ATOMextern(b->ttype)) {
_s = ATOMlen(ATOMtype(b->ttype), p);
*(ptr *) ret = GDKmalloc(_s);
- if(*(ptr *) ret == NULL){
+ if (*(ptr *) ret == NULL) {
BBPunfix(b->batCacheid);
- throw(SQL, "zero_or_one", SQLSTATE(HY001)
MAL_MALLOC_FAIL);
+ throw(SQL, "sql.zero_or_one", SQLSTATE(HY001)
MAL_MALLOC_FAIL);
}
memcpy(*(ptr *) ret, p, _s);
} else if (b->ttype == TYPE_bat) {
bat bid = *(bat *) p;
if((*(BAT **) ret = BATdescriptor(bid)) == NULL){
BBPunfix(b->batCacheid);
- throw(SQL, "zero_or_one", SQLSTATE(HY005) "Cannot
access column descriptor");
+ throw(SQL, "sql.zero_or_one", SQLSTATE(HY005) "Cannot
access column descriptor");
}
} else if (_s == 4) {
*(int *) ret = *(int *) p;
@@ -104,8 +104,7 @@ SQLsubzero_or_one(bat *ret, const bat *b
BATmax(h, &max);
BBPunfix(h->batCacheid);
if (max != lng_nil && max > 1)
- throw(SQL, "assert", SQLSTATE(M0M29) "zero_or_one:
cardinality violation, scalar expression expected");
-
+ throw(SQL, "sql.subzero_or_one", SQLSTATE(M0M29)
"zero_or_one: cardinality violation, scalar expression expected");
}
BBPunfix(g->batCacheid);
if (r == GDK_SUCCEED) {
@@ -123,7 +122,7 @@ SQLall(ptr ret, const bat *bid)
const void *p;
if ((b = BATdescriptor(*bid)) == NULL) {
- throw(SQL, "all", SQLSTATE(HY005) "Cannot access column
descriptor");
+ throw(SQL, "sql.all", SQLSTATE(HY005) "Cannot access column
descriptor");
}
c = BATcount(b);
if (c == 0) {
@@ -154,16 +153,16 @@ SQLall(ptr ret, const bat *bid)
if (ATOMextern(b->ttype)) {
_s = ATOMlen(ATOMtype(b->ttype), p);
*(ptr *) ret = GDKmalloc(_s);
- if(*(ptr *) ret == NULL){
+ if (*(ptr *) ret == NULL) {
BBPunfix(b->batCacheid);
- throw(SQL, "SQLall", SQLSTATE(HY001) MAL_MALLOC_FAIL);
+ throw(SQL, "sql.all", SQLSTATE(HY001) MAL_MALLOC_FAIL);
}
memcpy(*(ptr *) ret, p, _s);
} else if (b->ttype == TYPE_bat) {
bat bid = *(bat *) p;
if ((*(BAT **) ret = BATdescriptor(bid)) == NULL) {
BBPunfix(b->batCacheid);
- throw(SQL, "all", SQLSTATE(HY005) "Cannot access column
descriptor");
+ throw(SQL, "sql.all", SQLSTATE(HY005) "Cannot access
column descriptor");
}
} else if (_s == 4) {
*(int *) ret = *(int *) p;
@@ -195,16 +194,16 @@ SQLall_grp(bat *ret, const bat *bid, con
(void)no_nil;
if ((l = BATdescriptor(*bid)) == NULL) {
- throw(SQL, "all =", SQLSTATE(HY005) "Cannot access column
descriptor");
+ throw(SQL, "sql.all =", SQLSTATE(HY005) "Cannot access column
descriptor");
}
if ((g = BATdescriptor(*gp)) == NULL) {
BBPunfix(l->batCacheid);
- throw(SQL, "all =", SQLSTATE(HY005) "Cannot access column
descriptor");
+ throw(SQL, "sql.all =", SQLSTATE(HY005) "Cannot access column
descriptor");
}
if ((e = BATdescriptor(*gpe)) == NULL) {
BBPunfix(l->batCacheid);
BBPunfix(g->batCacheid);
- throw(SQL, "all =", SQLSTATE(HY005) "Cannot access column
descriptor");
+ throw(SQL, "sql.all =", SQLSTATE(HY005) "Cannot access column
descriptor");
}
li = bat_iterator(l);
ocmp = ATOMcompare(l->ttype);
@@ -212,7 +211,12 @@ SQLall_grp(bat *ret, const bat *bid, con
BUN q, o, s, offset = 0;
BATiter gi = bat_iterator(g);
- pos = GDKmalloc(sizeof(BUN)*BATcount(e));
+ if ((pos = GDKmalloc(sizeof(BUN)*BATcount(e))) == NULL) {
+ BBPunfix(l->batCacheid);
+ BBPunfix(g->batCacheid);
+ BBPunfix(e->batCacheid);
+ throw(SQL, "sql.all =", SQLSTATE(HY001)
MAL_MALLOC_FAIL);
+ }
for (s = 0; s < BATcount(e); s++)
pos[s] = -1;
@@ -233,7 +237,15 @@ SQLall_grp(bat *ret, const bat *bid, con
}
}
}
- res = COLnew(e->hseqbase, l->ttype, BATcount(e), TRANSIENT);
+
+ if ((res = COLnew(e->hseqbase, l->ttype, BATcount(e), TRANSIENT)) ==
NULL) {
+ BBPunfix(l->batCacheid);
+ BBPunfix(g->batCacheid);
+ BBPunfix(e->batCacheid);
+ GDKfree(pos);
+ throw(SQL, "sql.all =", SQLSTATE(HY001) MAL_MALLOC_FAIL);
+ }
+
const void *nilp = ATOMnilptr(l->ttype);
for (p = 0; p < (ssize_t)BATcount(e) && !error; p++) {
const void *v = nilp;
@@ -248,7 +260,7 @@ SQLall_grp(bat *ret, const bat *bid, con
}
GDKfree(pos);
if (error)
- throw(SQL, "all =", SQLSTATE(HY005) "all append failed");
+ throw(SQL, "sql.all =", SQLSTATE(HY005) "all append failed");
res->hseqbase = g->hseqbase;
res->tnil = (has_nil)?1:0;
@@ -268,12 +280,12 @@ SQLnil(bit *ret, const bat *bid)
BAT *b;
if ((b = BATdescriptor(*bid)) == NULL) {
- throw(SQL, "all", SQLSTATE(HY005) "Cannot access column
descriptor");
+ throw(SQL, "sql.nil", SQLSTATE(HY005) "Cannot access column
descriptor");
}
*ret = FALSE;
if (BATcount(b) == 0)
*ret = bit_nil;
- if (BATcount(b) > 0) {
+ else {
BUN q, o;
int (*ocmp) (const void *, const void *);
BATiter bi = bat_iterator(b);
@@ -303,18 +315,23 @@ SQLnil_grp(bat *ret, const bat *bid, con
(void)no_nil;
if ((l = BATdescriptor(*bid)) == NULL) {
- throw(SQL, "any =", SQLSTATE(HY005) "Cannot access column
descriptor");
+ throw(SQL, "sql.any =", SQLSTATE(HY005) "Cannot access column
descriptor");
}
if ((g = BATdescriptor(*gp)) == NULL) {
BBPunfix(l->batCacheid);
- throw(SQL, "any =", SQLSTATE(HY005) "Cannot access column
descriptor");
+ throw(SQL, "sql.any =", SQLSTATE(HY005) "Cannot access column
descriptor");
}
if ((e = BATdescriptor(*gpe)) == NULL) {
BBPunfix(l->batCacheid);
BBPunfix(g->batCacheid);
- throw(SQL, "any =", SQLSTATE(HY005) "Cannot access column
descriptor");
+ throw(SQL, "sql.any =", SQLSTATE(HY005) "Cannot access column
descriptor");
}
- res = BATconstant(0, TYPE_bit, &F, BATcount(e), TRANSIENT);
+ if ((res = BATconstant(0, TYPE_bit, &F, BATcount(e), TRANSIENT)) ==
NULL) {
+ BBPunfix(l->batCacheid);
+ BBPunfix(g->batCacheid);
+ BBPunfix(e->batCacheid);
+ throw(SQL, "sql.any =", SQLSTATE(HY001) MAL_MALLOC_FAIL);
+ }
BAThseqbase(res, e->hseqbase);
offset = g->hseqbase - l->hseqbase;
if (BATcount(g) > 0) {
@@ -386,11 +403,11 @@ SQLanyequal(bit *ret, const bat *bid1, c
const void *p;
if ((l = BATdescriptor(*bid1)) == NULL) {
- throw(SQL, "any =", SQLSTATE(HY005) "Cannot access column
descriptor");
+ throw(SQL, "sql.any =", SQLSTATE(HY005) "Cannot access column
descriptor");
}
if ((r = BATdescriptor(*bid2)) == NULL) {
BBPunfix(l->batCacheid);
- throw(SQL, "any =", SQLSTATE(HY005) "Cannot access column
descriptor");
+ throw(SQL, "sql.any =", SQLSTATE(HY005) "Cannot access column
descriptor");
}
*ret = FALSE;
if (BATcount(r) > 0) {
@@ -427,24 +444,30 @@ SQLanyequal_grp(bat *ret, const bat *bid
(void)no_nil;
if ((l = BATdescriptor(*bid1)) == NULL) {
- throw(SQL, "any =", SQLSTATE(HY005) "Cannot access column
descriptor");
+ throw(SQL, "sql.any =", SQLSTATE(HY005) "Cannot access column
descriptor");
}
if ((r = BATdescriptor(*bid2)) == NULL) {
BBPunfix(l->batCacheid);
- throw(SQL, "any =", SQLSTATE(HY005) "Cannot access column
descriptor");
+ throw(SQL, "sql.any =", SQLSTATE(HY005) "Cannot access column
descriptor");
}
if ((g = BATdescriptor(*gp)) == NULL) {
BBPunfix(l->batCacheid);
BBPunfix(r->batCacheid);
- throw(SQL, "any =", SQLSTATE(HY005) "Cannot access column
descriptor");
+ throw(SQL, "sql.any =", SQLSTATE(HY005) "Cannot access column
descriptor");
}
if ((e = BATdescriptor(*gpe)) == NULL) {
BBPunfix(l->batCacheid);
BBPunfix(r->batCacheid);
BBPunfix(g->batCacheid);
- throw(SQL, "any =", SQLSTATE(HY005) "Cannot access column
descriptor");
+ throw(SQL, "sql.any =", SQLSTATE(HY005) "Cannot access column
descriptor");
}
- res = BATconstant(0, TYPE_bit, &F, BATcount(e), TRANSIENT);
+ if ((res = BATconstant(0, TYPE_bit, &F, BATcount(e), TRANSIENT)) ==
NULL) {
+ BBPunfix(l->batCacheid);
+ BBPunfix(r->batCacheid);
+ BBPunfix(g->batCacheid);
+ BBPunfix(e->batCacheid);
+ throw(SQL, "sql.any =", SQLSTATE(HY001) MAL_MALLOC_FAIL);
+ }
BAThseqbase(res, e->hseqbase);
assert(BATcount(l) == BATcount(r));
offset = g->hseqbase - l->hseqbase;
@@ -497,31 +520,38 @@ SQLanyequal_grp2(bat *ret, const bat *bi
(void)no_nil;
if ((l = BATdescriptor(*bid1)) == NULL) {
- throw(SQL, "any =", SQLSTATE(HY005) "Cannot access column
descriptor");
+ throw(SQL, "sql.any =", SQLSTATE(HY005) "Cannot access column
descriptor");
}
if ((r = BATdescriptor(*bid2)) == NULL) {
BBPunfix(l->batCacheid);
- throw(SQL, "any =", SQLSTATE(HY005) "Cannot access column
descriptor");
+ throw(SQL, "sql.any =", SQLSTATE(HY005) "Cannot access column
descriptor");
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list