Changeset: 10efb81646f5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=10efb81646f5
Modified Files:
monetdb5/modules/atoms/uuid.c
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_statement.c
sql/server/rel_rel.c
sql/server/sql_scan.c
Branch: default
Log Message:
Merged with Oct2020
diffs (truncated from 519 to 300 lines):
diff --git a/debian/libmonetdb-client12.install
b/debian/libmonetdb-client12.install
--- a/debian/libmonetdb-client12.install
+++ b/debian/libmonetdb-client12.install
@@ -1,2 +1,1 @@
-debian/tmp/usr/lib/x86_64-linux-gnu/libmapi.so.12 /usr/lib/x86_64-linux-gnu
-debian/tmp/usr/lib/x86_64-linux-gnu/libmapi.so.12.* /usr/lib/x86_64-linux-gnu
+debian/tmp/usr/lib/x86_64-linux-gnu/libmapi.so.* /usr/lib/x86_64-linux-gnu
diff --git a/debian/libmonetdb-stream14.install
b/debian/libmonetdb-stream14.install
--- a/debian/libmonetdb-stream14.install
+++ b/debian/libmonetdb-stream14.install
@@ -1,2 +1,1 @@
-debian/tmp/usr/lib/x86_64-linux-gnu/libstream.so.14 usr/lib/x86_64-linux-gnu
-debian/tmp/usr/lib/x86_64-linux-gnu/libstream.so.14.* usr/lib/x86_64-linux-gnu
+debian/tmp/usr/lib/x86_64-linux-gnu/libstream.so.* usr/lib/x86_64-linux-gnu
diff --git a/debian/libmonetdb21.install b/debian/libmonetdb21.install
--- a/debian/libmonetdb21.install
+++ b/debian/libmonetdb21.install
@@ -1,2 +1,1 @@
-debian/tmp/usr/lib/x86_64-linux-gnu/libbat.so.21 usr/lib/x86_64-linux-gnu
-debian/tmp/usr/lib/x86_64-linux-gnu/libbat.so.21.* usr/lib/x86_64-linux-gnu
+debian/tmp/usr/lib/x86_64-linux-gnu/libbat.so.* usr/lib/x86_64-linux-gnu
diff --git a/debian/libmonetdbe1.install b/debian/libmonetdbe1.install
--- a/debian/libmonetdbe1.install
+++ b/debian/libmonetdbe1.install
@@ -1,2 +1,1 @@
-debian/tmp/usr/lib/x86_64-linux-gnu/libmonetdbe.so.1 usr/lib/x86_64-linux-gnu
-debian/tmp/usr/lib/x86_64-linux-gnu/libmonetdbe.so.1.* usr/lib/x86_64-linux-gnu
+debian/tmp/usr/lib/x86_64-linux-gnu/libmonetdbe.so.* usr/lib/x86_64-linux-gnu
diff --git a/monetdb5/modules/atoms/uuid.c b/monetdb5/modules/atoms/uuid.c
--- a/monetdb5/modules/atoms/uuid.c
+++ b/monetdb5/modules/atoms/uuid.c
@@ -407,7 +407,7 @@ UUIDhash(const void *v)
(ulng) u->u[10] << 40 | (ulng) u->u[11] << 32 |
(ulng) u->u[12] << 24 | (ulng) u->u[13] << 16 |
(ulng) u->u[14] << 8 | (ulng) u->u[15];
- /* we're not using mix_hge since this we way get the same result
+ /* we're not using mix_hge since this way we get the same result
* on systems with and without 128 bit integer support */
return (BUN) (mix_lng(u1) ^ mix_lng(u2));
}
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
@@ -31,6 +31,13 @@ static stmt * subrel_bin(backend *be, sq
static stmt *check_types(backend *be, sql_subtype *ct, stmt *s, check_type
tpe);
+static void
+clean_mal_statements(backend *be, int oldstop, int oldvtop)
+{
+ MSresetInstructions(be->mb, oldstop);
+ freeVariables(be->client, be->mb, NULL, oldvtop);
+}
+
static stmt *
stmt_selectnil( backend *be, stmt *col)
{
@@ -429,6 +436,8 @@ handle_in_exps(backend *be, sql_exp *ce,
/* The actual in-value-list should not contain duplicates to
ensure that final join results are unique. */
s = distinct_value_list(be, nl, &last_null_value);
+ if (!s)
+ return NULL;
if (last_null_value) {
/* The actual in-value-list should not contain null
values. */
@@ -1164,7 +1173,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
} break;
case e_cmp: {
stmt *l = NULL, *r = NULL, *r2 = NULL;
- int swapped = 0, is_select = 0;
+ int swapped = 0, is_select = 0, oldvtop, oldstop;
sql_exp *re = e->r, *re2 = e->f;
/* general predicate, select and join */
@@ -1177,10 +1186,13 @@ exp_bin(backend *be, sql_exp *e, stmt *l
ops = sa_list(sql->sa);
args = e->l;
for( n = args->h; n; n = n->next ) {
+ oldvtop = be->mb->vtop;
+ oldstop = be->mb->stop;
s = NULL;
if (!swapped)
s = exp_bin(be, n->data, left, NULL,
grp, ext, cnt, NULL, depth+1, 0, push);
if (!s && (first || swapped)) {
+ clean_mal_statements(be, oldstop,
oldvtop);
s = exp_bin(be, n->data, right, NULL,
grp, ext, cnt, NULL, depth+1, 0, push);
swapped = 1;
}
@@ -1202,7 +1214,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
}
r = stmt_list(be, ops);
- if (left && right && exps_card(e->r) > CARD_ATOM) {
+ if (left && right && (exps_card(e->r) != CARD_ATOM ||
!exps_are_atoms(e->r))) {
sql_subfunc *f = e->f;
return stmt_genjoin(be, l, r, f, is_anti(e),
swapped);
}
@@ -1223,23 +1235,31 @@ exp_bin(backend *be, sql_exp *e, stmt *l
if (right && find_prop(e->p, PROP_JOINIDX) != NULL)
be->join_idx++;
+ oldvtop = be->mb->vtop;
+ oldstop = be->mb->stop;
if (!l) {
l = exp_bin(be, e->l, left, (!reduce)?right:NULL, grp,
ext, cnt, sel, depth+1, 0, push);
swapped = 0;
}
if (!l && right) {
+ clean_mal_statements(be, oldstop, oldvtop);
l = exp_bin(be, e->l, right, NULL, grp, ext, cnt, sel,
depth+1, 0, push);
swapped = 1;
}
+
+ oldvtop = be->mb->vtop;
+ oldstop = be->mb->stop;
if (swapped || !right || !reduce)
r = exp_bin(be, re, left, (!reduce)?right:NULL, grp,
ext, cnt, sel, depth+1, 0, push);
else
r = exp_bin(be, re, right, NULL, grp, ext, cnt, sel,
depth+1, 0, push);
if (!r && !swapped) {
+ clean_mal_statements(be, oldstop, oldvtop);
r = exp_bin(be, re, left, NULL, grp, ext, cnt, sel,
depth+1, 0, push);
is_select = 1;
}
if (!r && swapped) {
+ clean_mal_statements(be, oldstop, oldvtop);
r = exp_bin(be, re, right, NULL, grp, ext, cnt, sel,
depth+1, 0, push);
is_select = 1;
}
@@ -2610,11 +2630,12 @@ rel2bin_semijoin(backend *be, sql_rel *r
break;
if (equality_only) {
+ int oldvtop = be->mb->vtop, oldstop =
be->mb->stop, swap = 0;
stmt *r, *l = exp_bin(be, e->l, left,
NULL, NULL, NULL, NULL, NULL, 0, 0, 0);
- int swap = 0;
if (!l) {
swap = 1;
+ clean_mal_statements(be,
oldstop, oldvtop);
l = exp_bin(be, e->l, right,
NULL, NULL, NULL, NULL, NULL, 0, 0, 0);
}
r = exp_bin(be, e->r, left, right,
NULL, NULL, NULL, NULL, 0, 0, 0);
@@ -3174,10 +3195,13 @@ rel2bin_project(backend *be, sql_rel *re
psub = stmt_list(be, pl);
for( en = rel->exps->h; en; en = en->next ) {
sql_exp *exp = en->data;
+ int oldvtop = be->mb->vtop, oldstop = be->mb->stop;
stmt *s = exp_bin(be, exp, sub, NULL /*psub*/, NULL, NULL,
NULL, NULL, 0, 0, 0);
- if (!s) /* try with own projection as well */
+ if (!s) { /* try with own projection as well, but first clean
leftover statements */
+ clean_mal_statements(be, oldstop, oldvtop);
s = exp_bin(be, exp, sub, psub, NULL, NULL, NULL, NULL,
0, 0, 0);
+ }
if (!s) /* error */
return NULL;
/* single value with limit */
@@ -3428,8 +3452,8 @@ rel2bin_groupby(backend *be, sql_rel *re
cursub = stmt_list(be, l);
for( n = aggrs->h; n; n = n->next ) {
sql_exp *aggrexp = n->data;
-
stmt *aggrstmt = NULL;
+ int oldvtop, oldstop;
/* first look in the current aggr list (l) and group by column
list */
if (l && !aggrstmt && aggrexp->type == e_column)
@@ -3443,13 +3467,17 @@ rel2bin_groupby(backend *be, sql_rel *re
}
}
+ oldvtop = be->mb->vtop;
+ oldstop = be->mb->stop;
if (!aggrstmt)
aggrstmt = exp_bin(be, aggrexp, sub, NULL, grp, ext,
cnt, NULL, 0, 0, 0);
/* maybe the aggr uses intermediate results of this group by,
therefore we pass the group by columns too
*/
- if (!aggrstmt)
+ if (!aggrstmt) {
+ clean_mal_statements(be, oldstop, oldvtop);
aggrstmt = exp_bin(be, aggrexp, sub, cursub, grp, ext,
cnt, NULL, 0, 0, 0);
+ }
if (!aggrstmt) {
assert(sql->session->status == -10); /* Stack overflow
errors shouldn't terminate the server */
return NULL;
@@ -3495,16 +3523,23 @@ rel2bin_topn(backend *be, sql_rel *rel,
const char *cname = column_name(sql->sa, sc);
const char *tname = table_name(sql->sa, sc);
list *newl = sa_list(sql->sa);
+ int oldvtop = be->mb->vtop, oldstop = be->mb->stop;
if (le)
l = exp_bin(be, le, NULL, NULL, NULL, NULL, NULL, NULL,
0, 0, 0);
+ if (!l) {
+ clean_mal_statements(be, oldstop, oldvtop);
+ l = stmt_atom_lng_nil(be);
+ }
+
+ oldvtop = be->mb->vtop;
+ oldstop = be->mb->stop;
if (oe)
o = exp_bin(be, oe, NULL, NULL, NULL, NULL, NULL, NULL,
0, 0, 0);
-
- if (!l)
- l = stmt_atom_lng_nil(be);
- if (!o)
+ if (!o) {
+ clean_mal_statements(be, oldstop, oldvtop);
o = stmt_atom_lng(be, 0);
+ }
if (!l || !o)
return NULL;
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
@@ -1398,6 +1398,7 @@ stmt_genselect(backend *be, stmt *lops,
s->op1 = lops;
s->op2 = rops;
s->op3 = sub;
+ s->key = lops->nrcols == 0 && rops->nrcols == 0;
s->flag = cmp_filter;
s->nrcols = lops->nrcols;
s->nr = getDestVar(q);
@@ -1562,6 +1563,7 @@ stmt_uselect(backend *be, stmt *op1, stm
s->op2 = op2;
s->op3 = sub;
s->flag = cmptype;
+ s->key = op1->nrcols == 0 && op2->nrcols == 0;
s->nrcols = op1->nrcols;
s->nr = getDestVar(q);
s->q = q;
@@ -1815,6 +1817,7 @@ stmt_uselect2(backend *be, stmt *op1, st
s->op4.stval = sub;
s->flag = cmp;
s->nrcols = op1->nrcols;
+ s->key = op1->nrcols == 0 && op2->nrcols == 0 && op3->nrcols ==
0;
s->nr = getDestVar(q);
s->q = q;
s->cand = sub;
diff --git a/sql/backends/monet5/vaults/shp/CMakeLists.txt
b/sql/backends/monet5/vaults/shp/CMakeLists.txt
--- a/sql/backends/monet5/vaults/shp/CMakeLists.txt
+++ b/sql/backends/monet5/vaults/shp/CMakeLists.txt
@@ -32,7 +32,7 @@ if(GDAL_FOUND)
$<TARGET_PROPERTY:sqlcommon,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:sqlstorage,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:geomlib,INTERFACE_INCLUDE_DIRECTORIES>
- $<$<VERSION_LESS:${CMAKE_VERSION},3.14.0>:${GDAL_INCLUDE_DIRS}>
+ $<$<VERSION_LESS:${CMAKE_VERSION},3.14.0>:${GDAL_INCLUDE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${INCLUDEDIR}/monetdb>)
@@ -43,6 +43,7 @@ if(GDAL_FOUND)
bat
monetdb5
sqlinclude
+ $<$<VERSION_LESS:${CMAKE_VERSION},3.14.0>:${GDAL_LIBRARY}>
$<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.14.0>:GDAL::GDAL>)
set_target_properties(shp
diff --git a/sql/server/rel_rel.c b/sql/server/rel_rel.c
--- a/sql/server/rel_rel.c
+++ b/sql/server/rel_rel.c
@@ -159,7 +159,8 @@ rel_copy(mvc *sql, sql_rel *i, int deep)
break;
case op_project:
case op_groupby:
- rel->l = rel_copy(sql, i->l, deep);
+ if (i->l)
+ rel->l = rel_copy(sql, i->l, deep);
if (i->r) {
if (!deep) {
rel->r = list_dup(i->r, (fdup) NULL);
diff --git a/sql/server/sql_scan.c b/sql/server/sql_scan.c
--- a/sql/server/sql_scan.c
+++ b/sql/server/sql_scan.c
@@ -691,7 +691,7 @@ scanner_string(mvc *c, int quote, bool e
size_t pos = 0;
const size_t yycur = rs->pos + lc->yycur;
- while (cur != EOF && pos < limit &&
+ while (cur != EOF && (quote != '"' || cur != 0xFEFF) && pos <
limit &&
(((cur = rs->buf[yycur + pos++]) & 0x80) == 0) &&
cur && (cur != quote || escape)) {
if (escapes && cur == '\\')
@@ -703,8 +703,9 @@ scanner_string(mvc *c, int quote, bool e
(void) sql_error(c, 2, SQLSTATE(42000) "string too
long");
return LEX_ERROR;
}
- if (cur == EOF)
- break;
+ /* BOM character not allowed as an identifier */
+ if (cur == EOF || (quote == '"' && cur == 0xFEFF))
+ return scanner_error(c, cur);
lc->yycur += pos;
/* check for quote escaped quote: Obscure SQL Rule */
if (cur == quote && rs->buf[yycur + pos] == quote) {
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list