Changeset: b574fe476f10 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b574fe476f10
Added Files:
sql/backends/monet5/Tests/pyloader06.stable.out.Windows
sql/backends/monet5/Tests/pyloader07.stable.out.Windows
sql/test/BugTracker-2016/Tests/groupby_on_column_expression.Bug-3832.sql
sql/test/BugTracker-2016/Tests/groupby_on_column_expression.Bug-3832.stable.err
sql/test/BugTracker-2016/Tests/groupby_on_column_expression.Bug-3832.stable.out
sql/test/BugTracker-2017/Tests/cast_boolean_to_string.Bug-6110.sql
sql/test/BugTracker-2017/Tests/cast_boolean_to_string.Bug-6110.stable.err
sql/test/BugTracker-2017/Tests/cast_boolean_to_string.Bug-6110.stable.out
sql/test/BugTracker-2017/Tests/create_view_order_by.Bug-3465.sql
sql/test/BugTracker-2017/Tests/create_view_order_by.Bug-3465.stable.err
sql/test/BugTracker-2017/Tests/create_view_order_by.Bug-3465.stable.out
sql/test/BugTracker-2017/Tests/modulo.Bug-6225.sql
sql/test/BugTracker-2017/Tests/modulo.Bug-6225.stable.err
sql/test/BugTracker-2017/Tests/modulo.Bug-6225.stable.out
Modified Files:
gdk/gdk_aggr.c
monetdb5/mal/mal_builder.c
monetdb5/mal/mal_instruction.c
monetdb5/modules/atoms/Tests/strappend.malC
monetdb5/optimizer/Tests/dataflow.stable.out
monetdb5/optimizer/Tests/dataflow4.stable.out
monetdb5/optimizer/opt_dataflow.c
monetdb5/optimizer/opt_garbageCollector.c
sql/ChangeLog
sql/backends/monet5/sql_statement.c
sql/server/rel_schema.c
sql/server/rel_select.c
sql/server/sql_parser.y
sql/test/BugTracker-2016/Tests/All
sql/test/BugTracker-2017/Tests/All
sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade/Tests/upgrade.stable.out
sql/test/mergetables/Tests/mergequery.stable.out
sql/test/pg_regress/Tests/create_view.sql
sql/test/pg_regress/Tests/create_view.stable.err
sql/test/pg_regress/Tests/create_view.stable.out
sql/test/quantiles/Tests/quantiles.stable.out
sql/test/remote/Tests/partition_elim.stable.out
sql/test/testdb-upgrade-chain-hge/Tests/dump.SQL.py
sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade-chain/Tests/dump.SQL.py
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
sql/test/testdb-upgrade-hge/Tests/dump.SQL.py
sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade/Tests/dump.SQL.py
sql/test/testdb-upgrade/Tests/upgrade.stable.out
sql/test/testdb/Tests/testdb-dump.SQL.py
Branch: wlcr
Log Message:
Merge with default
diffs (truncated from 2970 to 300 lines):
diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -2369,6 +2369,13 @@ BATgroupmedian(BAT *b, BAT *g, BAT *e, B
return BATgroupquantile(b,g,e,s,tp,0.5,skip_nils,abort_on_error);
}
+#if SIZEOF_OID == SIZEOF_INT
+#define binsearch_oid(indir, offset, vals, lo, hi, v, ordering, last)
binsearch_int(indir, offset, (const int *) vals, lo, hi, (int) (v), ordering,
last)
+#endif
+#if SIZEOF_OID == SIZEOF_LNG
+#define binsearch_oid(indir, offset, vals, lo, hi, v, ordering, last)
binsearch_lng(indir, offset, (const lng *) vals, lo, hi, (lng) (v), ordering,
last)
+#endif
+
BAT *
BATgroupquantile(BAT *b, BAT *g, BAT *e, BAT *s, int tp, double quantile,
int skip_nils, int abort_on_error)
@@ -2469,36 +2476,35 @@ BATgroupquantile(BAT *b, BAT *g, BAT *e,
bi = bat_iterator(b);
grps = (const oid *) Tloc(g, 0);
- prev = grps[0];
/* for each group (r and p are the beginning and end
* of the current group, respectively) */
- for (r = 0, p = 1, q = BATcount(g); p <= q; p++) {
- assert(r < p);
- if (p == q || grps[p] != prev) {
- BUN qindex;
- if (skip_nils && !b->tnonil) {
- r = binsearch(NULL, 0, tp, Tloc(b, 0),
- b->tvheap ?
b->tvheap->base : NULL,
- b->twidth, r, p, nil,
- 1, 1);
- }
- if (r == p) {
- v = nil;
- nils++;
- } else {
- /* round *down* to nearest integer */
- qindex = r + p - (BUN) (p + 0.5 - (p -
r - 1) * quantile);
- /* be a little paranoid about the index
*/
- assert(qindex >= r && qindex < p);
- v = BUNtail(bi, qindex);
+ for (r = 0, q = BATcount(g); r < q; r = p) {
+ BUN qindex;
+ prev = grps[r];
+ /* search for end of current group (grps is
+ * sorted so we can use binary search) */
+ p = binsearch_oid(NULL, 0, grps, r, q - 1, prev, 1, 1);
+ if (skip_nils && !b->tnonil) {
+ /* within group, locate start of non-nils */
+ r = binsearch(NULL, 0, tp, Tloc(b, 0),
+ b->tvheap ? b->tvheap->base :
NULL,
+ b->twidth, r, p, nil,
+ 1, 1);
+ }
+ if (r == p) {
+ /* no non-nils found */
+ v = nil;
+ nils++;
+ } else {
+ /* round *down* to nearest integer */
+ qindex = r + p - (BUN) (p + 0.5 - (p - r - 1) *
quantile);
+ /* be a little paranoid about the index */
+ assert(qindex >= r && qindex < p);
+ v = BUNtail(bi, qindex);
+ if (!skip_nils && !b->tnonil)
nils += (*atomcmp)(v, nil) == 0;
- }
- bunfastapp_nocheck(bn, BUNlast(bn), v,
Tsize(bn));
-
- r = p;
- if (p < q)
- prev = grps[p];
}
+ bunfastapp_nocheck(bn, BUNlast(bn), v, Tsize(bn));
}
nils += ngrp - BATcount(bn);
while (BATcount(bn) < ngrp) {
diff --git a/monetdb5/mal/mal_builder.c b/monetdb5/mal/mal_builder.c
--- a/monetdb5/mal/mal_builder.c
+++ b/monetdb5/mal/mal_builder.c
@@ -27,15 +27,11 @@ newAssignment(MalBlkPtr mb)
if ( q == NULL)
return NULL;
- if ((getArg(q,0)= newTmpVariable(mb,TYPE_any)) < 0) {
+ if ((getArg(q,0)= newTmpVariable(mb,TYPE_any)) < 0 || mb->errors) {
freeInstruction(q);
return NULL;
}
pushInstruction(mb, q);
- if (mb->errors) {
- freeInstruction(q);
- return NULL;
- }
return q;
}
@@ -47,15 +43,11 @@ newStmt(MalBlkPtr mb, const char *module
if ( q == NULL)
return NULL;
setDestVar(q, newTmpVariable(mb, TYPE_any));
- if (getDestVar(q) < 0) {
+ if (getDestVar(q) < 0 || mb->errors) {
freeInstruction(q);
return NULL;
}
pushInstruction(mb, q);
- if (mb->errors) {
- freeInstruction(q);
- return NULL;
- }
return q;
}
@@ -66,16 +58,12 @@ newReturnStmt(MalBlkPtr mb)
if ( q == NULL)
return NULL;
- if ((getArg(q,0)= newTmpVariable(mb,TYPE_any)) < 0) {
+ if ((getArg(q,0)= newTmpVariable(mb,TYPE_any)) < 0 || mb->errors) {
freeInstruction(q);
return NULL;
}
q->barrier= RETURNsymbol;
pushInstruction(mb, q);
- if (mb->errors) {
- freeInstruction(q);
- return NULL;
- }
return q;
}
@@ -115,10 +103,6 @@ newComment(MalBlkPtr mb, const char *val
return NULL;
}
pushInstruction(mb, q);
- if (mb->errors) {
- freeInstruction(q);
- return NULL;
- }
return q;
}
@@ -132,7 +116,7 @@ newCatchStmt(MalBlkPtr mb, str nme)
return NULL;
q->barrier = CATCHsymbol;
if ( i< 0) {
- if ((getArg(q,0)= newVariable(mb, nme, strlen(nme),TYPE_str)) <
0) {
+ if ((getArg(q,0)= newVariable(mb, nme, strlen(nme),TYPE_str)) <
0 || mb->errors) {
freeInstruction(q);
return NULL;
}
@@ -140,6 +124,7 @@ newCatchStmt(MalBlkPtr mb, str nme)
} else getArg(q,0) = i;
return q;
}
+
InstrPtr
newRaiseStmt(MalBlkPtr mb, str nme)
{
@@ -150,7 +135,7 @@ newRaiseStmt(MalBlkPtr mb, str nme)
return NULL;
q->barrier = RAISEsymbol;
if ( i< 0) {
- if ((getArg(q,0)= newVariable(mb, nme, strlen(nme),TYPE_str)) <
0) {
+ if ((getArg(q,0)= newVariable(mb, nme, strlen(nme),TYPE_str)) <
0 || mb->errors) {
freeInstruction(q);
return NULL;
}
@@ -169,17 +154,13 @@ newExitStmt(MalBlkPtr mb, str nme)
return NULL;
q->barrier = EXITsymbol;
if ( i< 0) {
- if ((getArg(q,0)= newVariable(mb, nme,strlen(nme),TYPE_str)) <
0) {
+ if ((getArg(q,0)= newVariable(mb, nme,strlen(nme),TYPE_str)) <
0 || mb->errors) {
freeInstruction(q);
return NULL;
}
} else
getArg(q,0) = i;
pushInstruction(mb, q);
- if (mb->errors) {
- freeInstruction(q);
- return NULL;
- }
return q;
}
diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c
--- a/monetdb5/mal/mal_instruction.c
+++ b/monetdb5/mal/mal_instruction.c
@@ -659,6 +659,8 @@ makeVarSpace(MalBlkPtr mb)
new = (VarRecord*) GDKrealloc(mb->var, s * sizeof(VarRecord));
if (new == NULL) {
+ // the only place to return an error signal at this
stage.
+ // The Client context should be passed around more
deeply
mb->errors++;
showException(GDKout, MAL, "newMalBlk",MAL_MALLOC_FAIL);
return -1;
@@ -748,10 +750,10 @@ newTypeVariable(MalBlkPtr mb, malType ty
{
int n, i;
for (i = 0; i < mb->vtop; i++)
- if (isTmpVar(mb, i) && getVarType(mb, i) == type)
+ if (isVarTypedef(mb, i) && getVarType(mb, i) == type)
break;
- if( i < mb->vtop && isVarTypedef(mb,i))
+ if( i < mb->vtop )
return i;
n = newTmpVariable(mb, type);
setVarTypedef(mb, n);
diff --git a/monetdb5/modules/atoms/Tests/strappend.malC
b/monetdb5/modules/atoms/Tests/strappend.malC
--- a/monetdb5/modules/atoms/Tests/strappend.malC
+++ b/monetdb5/modules/atoms/Tests/strappend.malC
@@ -15,5 +15,5 @@ bat.append(n, "");
bat.append(n, "another 1");
b := bat.append(b, n);
-(g,e,h) := group.subgroup(b);
+(g,e,h) := group.group(b);
io.print(b,g);
diff --git a/monetdb5/optimizer/Tests/dataflow.stable.out
b/monetdb5/optimizer/Tests/dataflow.stable.out
--- a/monetdb5/optimizer/Tests/dataflow.stable.out
+++ b/monetdb5/optimizer/Tests/dataflow.stable.out
@@ -25,12 +25,12 @@ Ready.
# 10:55:30 >
function user.tst():void; #[0] (0) 0
- s:bat[:int] := microbenchmark.uniform(0@0:oid, 100000:lng, 100000:int);
#[1] (0) MBMuniform 1 <- 2 3 4
- l:int := aggr.min(s:bat[:int]); #[2] (0) ALGminany 5 <- 1
- h:int := l:int; #[3] (0) 6 <- 5
+barrier X_27:bit := language.dataflow(); #[1] (0) MALstartDataflow 27
+ s:bat[:int] := microbenchmark.uniform(0@0:oid, 100000:lng, 100000:int);
#[2] (0) MBMuniform 1 <- 2 3 4
+ l:int := aggr.min(s:bat[:int]); #[3] (0) ALGminany 5 <- 1
+ h:int := l:int; #[4] (0) 6 <- 5
#mdb.setTimer(true);
#mdb.setThread(true);
-barrier X_28:bit := language.dataflow(); #[6] (0) MALstartDataflow 28
z:bat[:oid] := nil:bat[:oid]; #[7] (0) 9 <- 10
t1:bat[:oid] := algebra.select(s:bat[:int], l:int, h:int, true:bit,
true:bit, false:bit); #[8] (0) ALGselect1 11 <- 1 5 6 12 13 14
t2:bat[:oid] := algebra.select(s:bat[:int], l:int, h:int, true:bit,
true:bit, false:bit); #[9] (0) ALGselect1 15 <- 1 5 6 12 12 14
@@ -40,35 +40,39 @@ barrier X_28:bit := language.dataflow();
t6:bat[:oid] := algebra.select(s:bat[:int], l:int, h:int, true:bit,
true:bit, false:bit); #[13] (0) ALGselect1 19 <- 1 5 6 12 12 14
t7:bat[:oid] := algebra.select(s:bat[:int], l:int, h:int, true:bit,
true:bit, false:bit); #[14] (0) ALGselect1 20 <- 1 5 6 12 12 14
t8:bat[:oid] := algebra.select(s:bat[:int], l:int, h:int, true:bit,
true:bit, false:bit); #[15] (0) ALGselect1 21 <- 1 5 6 12 12 14
- language.pass(s:bat[:int]); #[16] (0) MALpass 27 <- 1
-exit X_28:bit; #[17] (0) 28
+ language.pass(s:bat[:int]); #[16] (0) MALpass 29 <- 1
+exit X_27:bit; #[17] (0) 27
z:bat[:oid] := mat.pack(t1:bat[:oid], t2:bat[:oid], t3:bat[:oid],
t4:bat[:oid], t5:bat[:oid], t6:bat[:oid], t7:bat[:oid], t8:bat[:oid]); #[18]
(0) MATpack 9 <- 11 15 16 17 18 19 20 21
mdb.var(); #[19] (0) MDBvar 22
c:lng := aggr.count(z:bat[:oid]); #[20] (0) ALGcount_bat 23 <- 9
io.print(c:lng); #[21] (0) IOprint_val 24 <- 23
io.print("done":str); #[22] (0) IOprint_val 25 <- 26
end user.tst; #[23] (0)
-#Stack 'tst' size=512 top=31
-#[1] s = nil :bat[:int] eolife=16
-#[2] _2 = 0@0 :oid constant
-#[3] _3 = 10000000 :wrd constant
-#[4] _4 = 10000000 :int constant
-#[5] l = 0 :int
-#[6] h = 0 :int
-#[9] z = <tmp_160> :bat[:void,:int] rows=8 eolife=20
-#[10] _10 = nil :bat[:oid,:int] constant eolife=6
-#[11] go = false :bit
-#[12] t1 = nil :bat[:oid,:int] eolife=16
-#[13] t2 = nil :bat[:oid,:int] eolife=16
-#[14] t3 = nil :bat[:oid,:int] eolife=16
-#[15] t4 = nil :bat[:oid,:int] eolife=16
-#[16] t5 = nil :bat[:oid,:int] eolife=16
-#[17] t6 = nil :bat[:oid,:int] eolife=16
-#[18] t7 = nil :bat[:oid,:int] eolife=16
-#[19] t8 = nil :bat[:oid,:int] eolife=16
-#[21] c = 0 :wrd
-#[24] _24 = "done" :str constant
-#[26] _26 = nil :bat[:oid,:int] constant
+#dataflow actions= 1 time=22 usec
+#garbagecollector actions= 1 time=18 usec
+#Stack 'tst' size=40 top=33
+#[ 1] s (2,2,16) = <tmp_106> :bat[:int] rows=100000
+#[ 2] X_2 (2,2,2) = 0@0 :oid constant
+#[ 3] X_3 (2,2,2) = 100000 :lng constant
+#[ 4] X_4 (2,2,2) = 100000 :int constant
+#[ 5] l (3,3,15) = 0 :int
+#[ 6] h (4,4,15) = 0 :int
+#[ 9] z (7,17,19) = <tmp_67> :bat[:oid] rows=8
+#[10] X_10 (7,7,7) = nil :bat[:oid] constant
+#[11] t1 (8,8,17) = <tmp_165> :bat[:void] rows=1
+#[12] X_12 (8,8,15) = true :bit constant
+#[13] X_13 (8,8,8) = true :bit constant
+#[14] X_14 (8,8,15) = false :bit constant
+#[15] t2 (9,9,17) = <tmp_54> :bat[:void] rows=1
+#[16] t3 (10,10,17) = <tmp_15> :bat[:void] rows=1
+#[17] t4 (11,11,17) = <tmp_57> :bat[:void] rows=1
+#[18] t5 (12,12,17) = <tmp_10> :bat[:void] rows=1
+#[19] t6 (13,13,17) = <tmp_16> :bat[:void] rows=1
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list