Changeset: afa033a71379 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=afa033a71379
Modified Files:
sql/test/sciql/Tests/Msci00.mal
sql/test/sciql/Tests/Msci01.mal
sql/test/sciql/Tests/Msci02.mal
sql/test/sciql/Tests/Msci03.mal
sql/test/sciql/Tests/Msci06.mal
sql/test/sciql/Tests/Msci09.mal
sql/test/sciql/Tests/Msci10.mal
sql/test/sciql/Tests/Msci13.mal
sql/test/sciql/Tests/Msci18.mal
sql/test/sciql/Tests/Msci20.mal
sql/test/sciql/Tests/sciql02.sql
sql/test/sciql/Tests/sciql03.sql
Branch: sciql
Log Message:
work in progress: hand compiling sciql queries
and some minor changes in the queries.
diffs (truncated from 420 to 300 lines):
diff --git a/sql/test/sciql/Tests/Msci00.mal b/sql/test/sciql/Tests/Msci00.mal
--- a/sql/test/sciql/Tests/Msci00.mal
+++ b/sql/test/sciql/Tests/Msci00.mal
@@ -1,4 +1,6 @@
-# Query: CREATE ARRAY A1( x integer DIMENSION[4], val float DEFAULT 0.0);
+# Query:
+# CREATE ARRAY A1( x integer DIMENSION[4], v float DEFAULT 0.0);
+#
# Note: additional operations required for explicit indices
# Note: base arrays are initialized once in most situations considered!
# (appends are allowed)
@@ -9,28 +11,30 @@
# x:bat[:oid,:int]:= sciql.newDimension("sys","A1","x",0,0,4,1);
function user.s0_1{autoCommit=true}():void;
- sql.mvc();
- sql.catalog(63,"sys":str,140473280789176:ptr,0:int); # DDL_CREATE_ARRAY==63
- sql.exportOperation("");
+ sql.mvc();
+ sql.catalog(63,"sys":str,140473280789176:ptr,0:int); #
DDL_CREATE_ARRAY==63
+ sql.exportOperation("");
end s0_1;
-# Query: CREATE ARRAY A2 ( x integer DIMENSION[0:4:1], val float DEFAULT 0.0);
+# Query:
+# CREATE ARRAY A2 ( x integer DIMENSION[0:4:1], v float DEFAULT 0.0);
function user.s1_1{autoCommit=true}():void;
- sql.mvc();
- sql.catalog(63,"sys":str,140473280789176:ptr,0:int); # DDL_CREATE_ARRAY==63
- sql.exportOperation("");
+ sql.mvc();
+ sql.catalog(63,"sys":str,140473280789176:ptr,0:int); #
DDL_CREATE_ARRAY==63
+ sql.exportOperation("");
end s1_1;
-# Query: CREATE SEQUENCE range AS integer START WITH 0 INCREMENT BY 1 MAXVALUE
3;
-# CREATE ARRAY A3 ( x integer DIMENSION range, val float DEFAULT 0.0);
+# Query:
+# CREATE SEQUENCE range AS integer START WITH 0 INCREMENT BY 1 MAXVALUE 3;
+# CREATE ARRAY A3 ( x integer DIMENSION range, v float DEFAULT 0.0);
function user.s2_1{autoCommit=true}():void;
- sql.mvc();
- sql.catalog(5,"sys":str,140473281519496:ptr,0:int);
- sql.exportOperation("");
+ sql.mvc();
+ sql.catalog(5,"sys":str,140473281519496:ptr,0:int);
+ sql.exportOperation("");
end s2_1;
function user.s3_1{autoCommit=true}():void;
- sql.mvc();
- sql.catalog(63,"sys":str,140473280789176:ptr,0:int); # DDL_CREATE_ARRAY==63
- sql.exportOperation("");
+ sql.mvc();
+ sql.catalog(63,"sys":str,140473280789176:ptr,0:int); #
DDL_CREATE_ARRAY==63
+ sql.exportOperation("");
end s3_1;
diff --git a/sql/test/sciql/Tests/Msci01.mal b/sql/test/sciql/Tests/Msci01.mal
--- a/sql/test/sciql/Tests/Msci01.mal
+++ b/sql/test/sciql/Tests/Msci01.mal
@@ -1,57 +1,62 @@
-# Query: CREATE ARRAY matrix (
-# x integer DIMENSION[4],
-# y integer DIMENSION[4],
-# val float DEFAULT 0.0 );
+# Query:
+# CREATE ARRAY matrix (
+# integer DIMENSION[4],
+# integer DIMENSION[4],
+# float DEFAULT 0.0 );
#(x:bat[:oid,:int],y:bat[:oid,:int]) :=
sciql.newDimension("sys","matrix","x",0,0,4,1,"y",0,4,1);
function user.s0_1{autoCommit=true}():void;
- sql.mvc();
- sql.catalog(63,"sys":str,140473280789176:ptr,0:int); # DDL_CREATE_ARRAY==63
- sql.exportOperation("");
+ sql.mvc();
+ sql.catalog(63,"sys":str,140473280789176:ptr,0:int); #
DDL_CREATE_ARRAY==63
+ sql.exportOperation("");
end s0_1;
-# Query: CREATE ARRAY stripes(
-# x integer DIMENSION[4],
-# y integer DIMENSION[4] CHECK(mod(y,2) = 1),
-# val float DEFAULT 0.0);
+# Query:
+# CREATE ARRAY stripes(
+# integer DIMENSION[4],
+# integer DIMENSION[4] CHECK(mod(y,2) = 1),
+# float DEFAULT 0.0);
function user.s1_1{autoCommit=true}():void;
- sql.mvc();
- sql.catalog(63,"sys":str,140473280789176:ptr,0:int); # DDL_CREATE_ARRAY==63
- sql.exportOperation("");
+ sql.mvc();
+ sql.catalog(63,"sys":str,140473280789176:ptr,0:int); #
DDL_CREATE_ARRAY==63
+ sql.exportOperation("");
end s1_1;
-# Query: CREATE ARRAY diagonal(
-# x integer DIMENSION[4],
-# y integer DIMENSION[4] CHECK(x = y),
-# val float DEFAULT 0.0);
+# Query:
+# CREATE ARRAY diagonal(
+# integer DIMENSION[4],
+# integer DIMENSION[4] CHECK(x = y),
+# float DEFAULT 0.0);
function user.s2_1{autoCommit=true}():void;
- sql.mvc();
- sql.catalog(63,"sys":str,140473280789176:ptr,0:int); # DDL_CREATE_ARRAY==63
- sql.exportOperation("");
+ sql.mvc();
+ sql.catalog(63,"sys":str,140473280789176:ptr,0:int); #
DDL_CREATE_ARRAY==63
+ sql.exportOperation("");
end s2_1;
-# Query: CREATE ARRAY sparse(
-# x integer DIMENSION[4],
-# y integer DIMENSION[4],
-# val float DEFAULT 0.0 CHECK(val>=0));
+# Query:
+# CREATE ARRAY sparse(
+# integer DIMENSION[4],
+# integer DIMENSION[4],
+# float DEFAULT 0.0 CHECK(v>=0));
function user.s3_1{autoCommit=true}():void;
- sql.mvc();
- sql.catalog(63,"sys":str,140473280789176:ptr,0:int); # DDL_CREATE_ARRAY==63
- sql.exportOperation("");
+ sql.mvc();
+ sql.catalog(63,"sys":str,140473280789176:ptr,0:int); #
DDL_CREATE_ARRAY==63
+ sql.exportOperation("");
end s3_1;
-# Query: CREATE ARRAY stripes2(
-# x integer DIMENSION,
-# y integer DIMENSION,
-# val float DEFAULT 0.0);
+# Query:
+# CREATE ARRAY stripes2(
+# integer DIMENSION,
+# integer DIMENSION,
+# float DEFAULT 0.0);
function user.s1_1{autoCommit=true}():void;
- sql.mvc();
- sql.catalog(63,"sys":str,140473280789176:ptr,0:int); # DDL_CREATE_ARRAY==63
- sql.exportOperation("");
+ sql.mvc();
+ sql.catalog(63,"sys":str,140473280789176:ptr,0:int); #
DDL_CREATE_ARRAY==63
+ sql.exportOperation("");
end s1_1;
diff --git a/sql/test/sciql/Tests/Msci02.mal b/sql/test/sciql/Tests/Msci02.mal
--- a/sql/test/sciql/Tests/Msci02.mal
+++ b/sql/test/sciql/Tests/Msci02.mal
@@ -1,34 +1,37 @@
-# Query: CREATE TABLE experiment(
-# run timestamp DIMENSION[TIMESTAMP '2010-01-01':*: INTERVAL'1'
day],
-# payload float DEFAULT 0.0 );
+# Query:
+# CREATE TABLE experiment(
+# run timestamp DIMENSION[TIMESTAMP '2010-01-01':*: INTERVAL'1' day],
+# payload float DEFAULT 0.0 );
#additional operations required for explicit indices
#run:bat[:oid,:timestamp]:=
array.newDimension("sys","experiment","run",0,"2010-01-01":timestamp,null:timestamp,"1:0:0":timestamp);
function user.s0_1{autoCommit=true}():void;
- sql.mvc();
- sql.catalog(63,"sys":str,140473280789176:ptr,0:int); # DDL_CREATE_ARRAY==63
- sql.exportOperation("");
+ sql.mvc();
+ sql.catalog(63,"sys":str,140473280789176:ptr,0:int); #
DDL_CREATE_ARRAY==63
+ sql.exportOperation("");
end s0_1;
-# Query: CREATE ARRAY timeseries(
-# run timestamp DIMENSION,
-# payload float DEFAULT 0.0 );
+# Query:
+# CREATE ARRAY timeseries(
+# run timestamp DIMENSION,
+# payload float DEFAULT 0.0 );
#run:bat[:oid,:timestamp]:=
array.newDimension("sys","timeseries","run",0,null:timestamp,null:timestamp,null:timestamp);
function user.s1_1{autoCommit=true}():void;
- sql.mvc();
- sql.catalog(63,"sys":str,140473280789176:ptr,0:int); # DDL_CREATE_ARRAY==63
- sql.exportOperation("");
+ sql.mvc();
+ sql.catalog(63,"sys":str,140473280789176:ptr,0:int); #
DDL_CREATE_ARRAY==63
+ sql.exportOperation("");
end s1_1;
-# Query: CREATE ARRAY experiment2(
-# run date DIMENSION[TIMESTAMP '2010-01-01':*: INTERVAL'1' day],
-# payload ARRAY (
-# x integer DIMENSION[4],
-# y integer DIMENSION[4],
-# val float DEFAULT 0.0)
-#);
+# Query:
+# CREATE ARRAY experiment2(
+# run date DIMENSION[TIMESTAMP '2010-01-01':*: INTERVAL'1' day],
+# payload ARRAY (
+# x integer DIMENSION[4],
+# y integer DIMENSION[4],
+# v float DEFAULT 0.0)
+# );
function user.s2_1{autoCommit=true}():void;
- sql.mvc();
- sql.catalog(63,"sys":str,140473281784632:ptr,0:int); # DDL_CREATE_ARRAY==63
- sql.exportOperation("");
+ sql.mvc();
+ sql.catalog(63,"sys":str,140473281784632:ptr,0:int); #
DDL_CREATE_ARRAY==63
+ sql.exportOperation("");
end s0_1;
diff --git a/sql/test/sciql/Tests/Msci03.mal b/sql/test/sciql/Tests/Msci03.mal
--- a/sql/test/sciql/Tests/Msci03.mal
+++ b/sql/test/sciql/Tests/Msci03.mal
@@ -2,10 +2,15 @@
function user.s0_1{autoCommit=true}():void;
_2 := sql.mvc();
# if we have a dimension with fixed bounds then there can not be updates
- # pattern sciql.bind_dim(mvc:ptr, schema:str, table:str, column:str,
- # access:int, low:any_1, hgh:any_1,
stp:any_1):bat[:oid,:any_1]
_12:bat[:oid,:int] := sciql.bind_dim(_2,"sys","matrix","x",0,0,4,1);
_21:bat[:oid,:int] := sciql.bind_dim(_2,"sys","matrix","y",0,0,4,1);
+ # => new MAL primitive:
+ # pattern sciql.bind_dim(mvc:ptr, schema:str, array:str, column:str,
+ # access:int):bat[:oid,:any_1]
+ # comment "bind to the dimension denoted by schema.array.column";
+ # pattern sciql.bind_dim(mvc:ptr, schema:str, array:str, column:str,
+ # access:int, low:any_1, hgh:any_1,
stp:any_1):bat[:oid,:any_1]
+ # comment "array slicing: bind to the dimension denoted by
schema.array.column[low:hgh:stp]";
_39 := bat.mirror(_12);
_44 := aggr.count(_39);
_40 := bat.reverse(_39);
@@ -21,6 +26,7 @@
_35:bat[:oid,:int] := batcalc.ifthenelse(_28,_29,_34);
_36 := batcalc.dbl(_35);
_41 := algebra.join(_40,_36);
+ # NB: must ensure values of 'v' are aligned with 'x','y'
sql.update(_2,"sys","matrix","v":str,_41);
sql.affectedRows(_44,"");
end s0_1;
@@ -37,26 +43,81 @@
_33 := batcalc.dbl(_32);
_34 := algebra.join(_5,_33);
_37:= aggr.count(_34);
- sql.update(_2,"sys","stripes","val",_34);
+ # NB: must ensure values of 'v' are aligned with 'x','y'
+ sql.update(_2,"sys","stripes","v",_34);
sql.affectedRows(_37,"");
end s1_1;
# Query: UPDATE stripes SET v = MOD(RAND(),16);
+function user.s2_1{autoCommit=true}():void;
+ _2 := sql.mvc();
+ # can't we directly bind to 'v' and then overwrite its values?
+ _17:bat[:oid,:int] := sciql.bind_dim(_2,"sys","stripes","x",0,0,4,1);
+ _18 := algebra.project(_17,0:int);
+ _56 := bat.new(nil:oid,nil:int);
+barrier (_60,_61,_62) := bat.newIterator(_18);
+ _64 := mmath.rand(_62);
+ bat.insert(_56,_61,_64);
+ redo (_60,_61,_62) := bat.hasMoreElements(_18);
+exit (_60,_61,_62);
+ _18 := nil:BAT;
+ _19:bat[:oid,:int] := _56;
+ _28 := bat.mirror(_17);
+ _33 := aggr.count(_28);
+ _29 := bat.reverse(_28);
+ _22 := algebra.project(_17,16:bte);
+ _23 := batcalc.int(_22);
+ _24:bat[:oid,:int] := batcalc.%(_19,_23);
+ _25 := batcalc.dbl(_24);
+ _30 := algebra.join(_29,_25);
+ # NB: must ensure values of 'v' are aligned with 'x','y'
+ sql.update(_2,"sys","stripes","v":str,_30);
+ sql.affectedRows(_33,"");
+end s2_1;
#-- for stripes2 it becomes
function user.s1_1{autoCommit=true}():void;
_2 := sql.mvc();
-#if we have a dimension with free bounds then we need an explicit
representation of x
- (_3:bat[:oid,:int],_23:bat[:oid,:int]) :=
sciql.dimension(_2,"sys","stripes","x",null:int,null:int,null:int,"y",null:int,null:int,null:int);
+ # if we have a dimension with free bounds then we need an explicit
representation of x
+ # (_3:bat[:oid,:int],_23:bat[:oid,:int]) :=
sciql.dimension(_2,"sys","stripes","x",null:int,null:int,null:int,"y",null:int,null:int,null:int);
+
+ # we don't need to care for this query how 'v' is stored. we just
overwrite
+ # all its values.
+ _3:bat[:oid,:float] := sciql.bind_cval(_2, "sys", "stripes2", "v", 0);
+ # => new MAL primitive:
+ # pattern sciql.bind_cval(mvc:ptr, schema:str, array:str, column:str,
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list