Changeset: 9c8d67da017d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9c8d67da017d
Added Files:
monetdb5/modules/kernel/Tests/select.malC
monetdb5/modules/kernel/Tests/select.stable.err
monetdb5/modules/kernel/Tests/select.stable.out
Modified Files:
gdk/gdk_logger.c
gdk/gdk_select.c
monetdb5/modules/kernel/Tests/All
monetdb5/modules/mal/Tests/orderidx01.malC
monetdb5/modules/mal/Tests/orderidx02.malC
sql/backends/monet5/UDF/pyapi/convert_loops.h
sql/backends/monet5/generator/generator.c
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_statement.c
sql/backends/monet5/vaults/netcdf/netcdf.c
sql/storage/bat/bat_storage.c
sql/storage/bat/bat_utils.c
sql/storage/bat/res_table.c
sql/test/BugTracker-2012/Tests/rewrite_like_into_likesubselect.Bug-3179.stable.out
sql/test/BugTracker-2015/Tests/useless_casts.Bug-3756.stable.out
sql/test/BugTracker-2016/Tests/decimal_vs_integer.Bug-3941.stable.out
sql/test/BugTracker/Tests/explain.SF-1739353.stable.out
sql/test/BugTracker/Tests/jdbc_no_debug.SF-1739356.stable.out
Branch: default
Log Message:
Merge with Dec2016 branch.
diffs (truncated from 3631 to 300 lines):
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1598,6 +1598,8 @@ logger_load(int debug, const char *fn, c
logger_fatal("Logger_new: inconsistent
database, snapshots_tid does not exist", 0, 0, 0);
} else {
lg->dsnapshots = logbat_new(TYPE_oid, 1, PERSISTENT);
+ if (lg->dsnapshots == NULL)
+ logger_fatal("Logger_new: cannot create
dsnapshot bat", 0, 0, 0);
snprintf(bak, sizeof(bak), "%s_dsnapshots", fn);
if (BBPrename(lg->dsnapshots->batCacheid, bak) < 0)
logger_fatal("Logger_new: BBPrename to %s
failed", bak, 0, 0);
@@ -2513,6 +2515,9 @@ bm_commit(logger *lg)
BAT *n = logbat_new(TYPE_str, BATcount(lg->freed), TRANSIENT);
gdk_return res;
+ if (n == NULL)
+ return LOG_ERR;
+
/* subcommit the freed bats */
if (BATcount(lg->freed)) {
diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c
--- a/gdk/gdk_select.c
+++ b/gdk/gdk_select.c
@@ -1275,14 +1275,13 @@ BATselect(BAT *b, BAT *s, const void *tl
equi = th == NULL || (lval && ATOMcmp(t, tl, th) == 0); /* point
select? */
if (equi) {
assert(lval);
- hi = li;
+ if (th == NULL)
+ hi = li;
th = tl;
hval = 1;
} else {
hval = ATOMcmp(t, th, nil) != 0;
}
- if (!equi && !lval && !hval && lnil)
- anti = !anti;
if (anti) {
if (lval != hval) {
/* one of the end points is nil and the other
@@ -1857,7 +1856,7 @@ BATthetaselect(BAT *b, BAT *s, const voi
nil = ATOMnilptr(b->ttype);
if (ATOMcmp(b->ttype, val, nil) == 0)
return newempty();
- if (op[0] == '=' && ((op[1] == '=' && op[2] == 0) || op[2] == 0)) {
+ if (op[0] == '=' && ((op[1] == '=' && op[2] == 0) || op[1] == 0)) {
/* "=" or "==" */
return BATselect(b, s, val, NULL, 1, 1, 0);
}
diff --git a/monetdb5/modules/kernel/Tests/All
b/monetdb5/modules/kernel/Tests/All
--- a/monetdb5/modules/kernel/Tests/All
+++ b/monetdb5/modules/kernel/Tests/All
@@ -2,3 +2,4 @@ time01
TriBool
batstr
math
+select
diff --git a/monetdb5/modules/kernel/Tests/select.malC
b/monetdb5/modules/kernel/Tests/select.malC
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/kernel/Tests/select.malC
@@ -0,0 +1,1010 @@
+b := bat.new(:int);
+bat.append(b, 7);
+bat.append(b, 6);
+bat.append(b, 8);
+bat.append(b, nil:int);
+bat.append(b, 9);
+bat.append(b, 5);
+bat.append(b, 0);
+bat.append(b, 3);
+bat.append(b, 2);
+bat.append(b, 1);
+bat.append(b, 4);
+s := algebra.sort(b, false, true);
+r := algebra.sort(b, true, true);
+bat.setAccess(b, "r");
+bat.setAccess(s, "r");
+bat.setAccess(r, "r");
+
+# if tl and th are both nil, and li and hi are both true,
+# algebra.select translates th to NULL
+
+x := algebra.select(b, nil:int, nil:int, true, true, false);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # nil
+io.print("nil");
+x := algebra.select(b, nil:int, nil:int, true, false, false);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 0,1,2,3,4,5,6,7,8,9
+io.print("0,1,2,3,4,5,6,7,8,9");
+x := algebra.select(b, nil:int, nil:int, false, true, false);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 0,1,2,3,4,5,6,7,8,9
+io.print("0,1,2,3,4,5,6,7,8,9");
+x := algebra.select(b, nil:int, nil:int, false, false, false);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 0,1,2,3,4,5,6,7,8,9
+io.print("0,1,2,3,4,5,6,7,8,9");
+x := algebra.select(b, nil:int, nil:int, true, true, true);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 0,1,2,3,4,5,6,7,8,9
+io.print("0,1,2,3,4,5,6,7,8,9");
+x := algebra.select(b, nil:int, nil:int, true, false, true);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # nothing
+io.print("nothing");
+x := algebra.select(b, nil:int, nil:int, false, true, true);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # nothing
+io.print("nothing");
+x := algebra.select(b, nil:int, nil:int, false, false, true);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # nothing
+io.print("nothing");
+
+x := algebra.select(b, 4, nil:int, true, true, false);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 4,5,6,7,8,9
+io.print("4,5,6,7,8,9");
+x := algebra.select(b, 4, nil:int, true, false, false);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 4,5,6,7,8,9
+io.print("4,5,6,7,8,9");
+x := algebra.select(b, 4, nil:int, false, true, false);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 5,6,7,8,9
+io.print("5,6,7,8,9");
+x := algebra.select(b, 4, nil:int, false, false, false);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 5,6,7,8,9
+io.print("5,6,7,8,9");
+x := algebra.select(b, 4, nil:int, true, true, true);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 0,1,2,3
+io.print("0,1,2,3");
+x := algebra.select(b, 4, nil:int, true, false, true);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 0,1,2,3
+io.print("0,1,2,3");
+x := algebra.select(b, 4, nil:int, false, true, true);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 0,1,2,3,4
+io.print("0,1,2,3,4");
+x := algebra.select(b, 4, nil:int, false, false, true);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 0,1,2,3,4
+io.print("0,1,2,3,4");
+
+x := algebra.select(b, nil:int, 4, true, true, false);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 0,1,2,3,4
+io.print("0,1,2,3,4");
+x := algebra.select(b, nil:int, 4, true, false, false);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 0,1,2,3
+io.print("0,1,2,3");
+x := algebra.select(b, nil:int, 4, false, true, false);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 0,1,2,3,4
+io.print("0,1,2,3,4");
+x := algebra.select(b, nil:int, 4, false, false, false);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 0,1,2,3
+io.print("0,1,2,3");
+x := algebra.select(b, nil:int, 4, true, true, true);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 5,6,7,8,9
+io.print("5,6,7,8,9");
+x := algebra.select(b, nil:int, 4, true, false, true);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 4,5,6,7,8,9
+io.print("4,5,6,7,8,9");
+x := algebra.select(b, nil:int, 4, false, true, true);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 5,6,7,8,9
+io.print("5,6,7,8,9");
+x := algebra.select(b, nil:int, 4, false, false, true);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 4,5,6,7,8,9
+io.print("4,5,6,7,8,9");
+
+x := algebra.select(b, 4, 4, true, true, false);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 4
+io.print("4");
+x := algebra.select(b, 4, 4, true, false, false);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # nothing
+io.print("nothing");
+x := algebra.select(b, 4, 4, false, true, false);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # nothing
+io.print("nothing");
+x := algebra.select(b, 4, 4, false, false, false);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # nothing
+io.print("nothing");
+x := algebra.select(b, 4, 4, true, true, true);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 0,1,2,3,5,6,7,8,9
+io.print("0,1,2,3,5,6,7,8,9");
+x := algebra.select(b, 4, 4, true, false, true);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 0,1,2,3,4,5,6,7,8,9
+io.print("0,1,2,3,4,5,6,7,8,9");
+x := algebra.select(b, 4, 4, false, true, true);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 0,1,2,3,4,5,6,7,8,9
+io.print("0,1,2,3,4,5,6,7,8,9");
+x := algebra.select(b, 4, 4, false, false, true);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 0,1,2,3,4,5,6,7,8,9
+io.print("0,1,2,3,4,5,6,7,8,9");
+
+x := algebra.select(b, 3, 7, true, true, false);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 3,4,5,6,7
+io.print("3,4,5,6,7");
+x := algebra.select(b, 3, 7, true, false, false);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 3,4,5,6
+io.print("3,4,5,6");
+x := algebra.select(b, 3, 7, false, true, false);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 4,5,6,7
+io.print("4,5,6,7");
+x := algebra.select(b, 3, 7, false, false, false);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 4,5,6
+io.print("4,5,6");
+x := algebra.select(b, 3, 7, true, true, true);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 0,1,2,8,9
+io.print("0,1,2,8,9");
+x := algebra.select(b, 3, 7, true, false, true);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 0,1,2,7,8,9
+io.print("0,1,2,7,8,9");
+x := algebra.select(b, 3, 7, false, true, true);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 0,1,2,3,8,9
+io.print("0,1,2,3,8,9");
+x := algebra.select(b, 3, 7, false, false, true);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # 0,1,2,3,7,8,9
+io.print("0,1,2,3,7,8,9");
+
+x := algebra.select(b, 7, 3, true, true, false);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # nothing
+io.print("nothing");
+x := algebra.select(b, 7, 3, true, false, false);
+z := algebra.projection(x, b);
+z := algebra.sort(z, false, true);
+io.print(z); # nothing
+io.print("nothing");
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list