Changeset: 0b03c3554cb9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0b03c3554cb9
Modified Files:
monetdb5/modules/kernel/algebra.c
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_statement.h
Branch: delete_in_vlist
Log Message:
Except for a minor null-value-related cornercase, it finally seems to be
working.
diffs (75 lines):
diff --git a/monetdb5/modules/kernel/algebra.c
b/monetdb5/modules/kernel/algebra.c
--- a/monetdb5/modules/kernel/algebra.c
+++ b/monetdb5/modules/kernel/algebra.c
@@ -694,6 +694,9 @@ ALGsort33(bat *result, bat *norder, bat
BAT *bn = NULL, *on = NULL, *gn = NULL;
BAT *b = NULL, *o = NULL, *g = NULL;
+ // TODO: I think that ALGsort doesn't maintain the key property of the
resulting bat, e.g. reordering a key bat
+ // should return a bat with the key property.
+
if ((b = BATdescriptor(*bid)) == NULL)
throw(MAL, "algebra.sort", SQLSTATE(HY002)
RUNTIME_OBJECT_MISSING);
if (order && !is_bat_nil(*order) && (o = BATdescriptor(*order)) ==
NULL) {
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
@@ -295,7 +295,7 @@ handle_in_exps(backend *be, sql_exp *ce,
{
mvc *sql = be->mvc;
node *n;
- stmt *r = NULL, *s = NULL, *c = exp_bin(be, ce, left, right, grp, ext,
cnt, NULL);
+ stmt *s = NULL, *c = exp_bin(be, ce, left, right, grp, ext, cnt, NULL);
if (c->nrcols == 0) {
sql_subtype *bt = sql_bind_localtype("bit");
@@ -321,18 +321,29 @@ handle_in_exps(backend *be, sql_exp *ce,
stmt_const(be, bin_first_column(be, left), s),
stmt_bool(be, 1), cmp_equal, sel, 0);
} else {
- comp_type cmp = (in)?cmp_equal:cmp_notequal;
-
- s = distinct_value_list(be, value_list(be, nl, NULL, NULL));
- s = stmt_join(be, c, s, NULL, in, cmp);
+ s = value_list(be, nl, NULL, NULL);
+ s = distinct_value_list(be, s); // make sure results are unique
+ s = stmt_join(be, c, s, NULL, in, cmp_equal);
s = stmt_result(be, s, 0);
+ if (!in) {
+ stmt* oid_c;
+ oid_c = stmt_mirror(be, c);
+ // TODO: Somehow stmt_tdiff only allows BAT[oid]
arguments hence the mirror op.
+ s = stmt_tdiff(be, oid_c, s);
+ }
+
if (sel) {
- r = stmt_join(be, s, sel, NULL, 0, cmp_equal);
- r = stmt_result(be, r, 0);
- r = distinct_value_list(be, s);
- s = stmt_project(be, r, s);
+ stmt* oid_intersection;
+ // TODO: check if stmt_tinter should safely allow a
null value for sel
+ oid_intersection = stmt_tinter(be, s, sel);
+ s = stmt_project(be, oid_intersection, s);
}
+
+ // Need to order this because the output of join is not
necessarily an ordered cl.
+ // This is relevant for instance when this passed to a
mergecand operation.
+ s = stmt_order(be, s, 1, 0);
+ s = stmt_result(be, s, 0);
}
return s;
diff --git a/sql/backends/monet5/sql_statement.h
b/sql/backends/monet5/sql_statement.h
--- a/sql/backends/monet5/sql_statement.h
+++ b/sql/backends/monet5/sql_statement.h
@@ -111,7 +111,7 @@ typedef struct stmt {
stmtdata op4; /* only op4 will hold other types */
char nrcols;
- char key; /* key (aka all values are unique) */
+ char key; /* key (aka all values are unique) */ // TODO
make this thing a bool
char aggr; /* aggregated */
char partition; /* selected as mitosis candidate */
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list