Changeset: c55c502ef9fe for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c55c502ef9fe
Modified Files:
        sql/backends/monet5/Makefile.ag
        sql/backends/monet5/sql_sciql.mx
        sql/backends/monet5/sql_user.mx
        sql/test/sciql/Tests/.Msciql03.sql.swp
        sql/test/sciql/Tests/Msci00.mal
        sql/test/sciql/Tests/Msci01.mal
        sql/test/sciql/Tests/Msci02.mal
        sql/test/sciql/Tests/Msci03.mal
Branch: sciql
Log Message:

The start of the sciql runtime system


diffs (269 lines):

diff -r 2a59eb63c74e -r c55c502ef9fe sql/backends/monet5/Makefile.ag
--- a/sql/backends/monet5/Makefile.ag   Sun Jan 16 15:03:36 2011 +0100
+++ b/sql/backends/monet5/Makefile.ag   Sun Jan 16 20:48:51 2011 +0100
@@ -46,6 +46,7 @@
                sql_result.mx \
                sql_readline.mx \
                sql_emptyset.mx \
+               sql_sciql.mx \
                sql_bpm.mx
        LIBS = ../../server/libsqlserver \
                   ../../storage/libstore \
@@ -109,7 +110,7 @@
 headers_mal = {
        HEADERS = mal
        DIR = libdir/monetdb5
-       SOURCES = sql.mx sql_bpm.mx sql_emptyset.mx
+       SOURCES = sql.mx sql_bpm.mx sql_emptyset.mx sql_sciql.mx
 }
 
 headers_autoload = {
diff -r 2a59eb63c74e -r c55c502ef9fe sql/backends/monet5/sql_sciql.mx
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sql/backends/monet5/sql_sciql.mx  Sun Jan 16 20:48:51 2011 +0100
@@ -0,0 +1,121 @@
+@/
+The contents of this file are subject to the MonetDB Public License
+Version 1.1 (the "License"); you may not use this file except in
+compliance with the License. You may obtain a copy of the License at
+http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html
+
+Software distributed under the License is distributed on an "AS IS"
+basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+License for the specific language governing rights and limitations
+under the License.
+
+The Original Code is the MonetDB Database System.
+
+The Initial Developer of the Original Code is CWI.
+Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
+Copyright August 2008-2011 MonetDB B.V.
+All Rights Reserved.
+@
+
+@f sciql
+@t SciQL runtime
+@a N.Nes, M.Kersten, J.Zhang, M.Ivanova
+@+ SciQL
+This module contains the additions for the SciQL extensions of SQL.
+This current focus is on testing the code generation.
+@m
+module sciql;
+pattern newDimension(sch:str, tab:str, col:str, kind:int, start:any_0, 
stop:any_0, step:any_0):bat[:oid,:any_0]
+address SCI1D
+comment "Define the dimension of a vector";
+
+pattern newDimension(sch:str, tab:str, col:str, kind:int,
+       start0:any_0, stop0:any_0, step0:any_0,
+       col1:str, start1:any_1, stop1:any_1, step1:any_1
+)(:bat[:oid,:any_0], :bat[:oid,:any_1])
+address SCI2D
+comment "Define the dimensions of a 2D space";
+
+pattern newDimension(sch:str, tab:str, col:str, kind:int,
+       start0:any_0, stop0:any_0, step0:any_0,
+       col1:str, start1:any_1, stop1:any_1, step1:any_1,
+       col2:str, start2:any_2, stop2:any_2, step2:any_2
+)(:bat[:oid,:any_0], :bat[:oid,:any_1], :bat[:oid,:any_2]);
+address SCI3D
+comment "Define the dimensions of a 3D space";
+
+pattern newDimension(sch:str, tab:str, col:str, kind:int,
+       start0:any_0, stop0:any_0, step0:any_0,
+       col1:str, start1:any_1, stop1:any_1, step1:any_1,
+       col2:str, start2:any_2, stop2:any_2, step2:any_2,
+       col3:str, start3:any_3, stop3:any_3, step3:any_3
+)(:bat[:oid,:any_0], :bat[:oid,:any_1], :bat[:oid,:any_2], :bat[:oid,:any_3]);
+address SCI3D
+comment "Define the dimensions of a 4D space";
+
+pattern setDefault(b:bat[:oid,:any_0], def:any_1):bat[:oid,:any_1]
+address SCIsetDefault
+comment "Create an array instance initialized with default values);
+@h
+#ifndef _SCIQL_H_
+#define _SCIQL_H_
+#include "sql.h"       /* includes sql_backend.h */
+
+sql5_export str SQL1D(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
+sql5_export str SQL2D(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
+sql5_export str SQL3D(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
+sql5_export str SQL4D(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
+sql5_export str SQLdefault(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
+
+#endif /* _SCIQL_H_ */
+
+@c
+#include "monetdb_config.h"
+#include "sql_user.h"
+#include "sql_mvc.h"
+#include "bat5.h"
+
+sql5_export str SQL1D(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+{
+       (void) cntxt;
+       (void) mb;
+       (void) stk;
+       (void) pic;
+       throw(MAL,"sciql.newDimension",PROGRAM_NYI);
+}
+
+sql5_export str SQL2D(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+{
+       (void) cntxt;
+       (void) mb;
+       (void) stk;
+       (void) pic;
+       throw(MAL,"sciql.newDimension",PROGRAM_NYI);
+}
+
+sql5_export str SQL3D(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+{
+       (void) cntxt;
+       (void) mb;
+       (void) stk;
+       (void) pic;
+       throw(MAL,"sciql.newDimension",PROGRAM_NYI);
+}
+
+sql5_export str SQL4D(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+{
+       (void) cntxt;
+       (void) mb;
+       (void) stk;
+       (void) pic;
+       throw(MAL,"sciql.newDimension",PROGRAM_NYI);
+}
+
+sql5_export str SQLdefault(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci)
+{
+       (void) cntxt;
+       (void) mb;
+       (void) stk;
+       (void) pic;
+       throw(MAL,"sciql.setDefault",PROGRAM_NYI);
+}
diff -r 2a59eb63c74e -r c55c502ef9fe sql/backends/monet5/sql_user.mx
--- a/sql/backends/monet5/sql_user.mx   Sun Jan 16 15:03:36 2011 +0100
+++ b/sql/backends/monet5/sql_user.mx   Sun Jan 16 20:48:51 2011 +0100
@@ -24,6 +24,7 @@
 The SQL user and authorisation implementation differs per backend.  This
 file implements the authorisation and user management based on the M5
 system authorisation.
+@{
 @h
 #ifndef _SQL_USER_H_
 #define _SQL_USER_H_
@@ -513,4 +514,4 @@
        return schema;
 }
 
-
+@}
diff -r 2a59eb63c74e -r c55c502ef9fe sql/test/sciql/Tests/.Msciql03.sql.swp
Binary file sql/test/sciql/Tests/.Msciql03.sql.swp has changed
diff -r 2a59eb63c74e -r c55c502ef9fe sql/test/sciql/Tests/Msci00.mal
--- a/sql/test/sciql/Tests/Msci00.mal   Sun Jan 16 15:03:36 2011 +0100
+++ b/sql/test/sciql/Tests/Msci00.mal   Sun Jan 16 20:48:51 2011 +0100
@@ -1,7 +1,12 @@
---CREATE ARRAY A1( x integer DIMENSION[4], val float DEFAULT 0.0);
-CREATE table A1( x integer, val float DEFAULT 0.0);
---CREATE ARRAY A2 ( x integer DIMENSION[0:4:1], val float DEFAULT 0.0);
-CREATE TABLE A2 ( x integer,  val float DEFAULT 0.0);
+#CREATE ARRAY A1( x integer DIMENSION[4], val float DEFAULT 0.0);
+#additional operations required for explicit indices
+x:bat[:oid,:int]:= array.newDimension("sys","A1","x",0,0,4,1);
+
+#CREATE ARRAY A2 ( x integer DIMENSION[0:4:1], val float DEFAULT 0.0);
+#additional operations required for explicit indices
+x:bat[:oid,:int]:= array.newDimension("sys","A2","x",0,0,4,1);
+
 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);
-CREATE ARRAY A3 ( x integer , val float DEFAULT 0.0);
+#CREATE ARRAY A3 ( x integer DIMENSION range, val float DEFAULT 0.0);
+#additional operations required for explicit indices
+x:bat[:oid,:int]:= array.newDimension("sys","A3","x",0,0,4,1);
diff -r 2a59eb63c74e -r c55c502ef9fe sql/test/sciql/Tests/Msci01.mal
--- a/sql/test/sciql/Tests/Msci01.mal   Sun Jan 16 15:03:36 2011 +0100
+++ b/sql/test/sciql/Tests/Msci01.mal   Sun Jan 16 20:48:51 2011 +0100
@@ -1,8 +1,17 @@
---CREATE ARRAY matrix ( x integer DIMENSION[4], y integer DIMENSION[4], val 
float DEFAULT 0.0 );
-CREATE TABLE matrix ( x integer,  y integer,  val float DEFAULT 0.0 );
---CREATE ARRAY grid( x integer DIMENSION[4] CHECK(mod(x,2) = 0), y integer 
DIMENSION[4], val float DEFAULT 0.0);
-CREATE TABLE grid( x integer,  y integer , val float DEFAULT 0.0);
---CREATE ARRAY diagonal( x integer DIMENSION[4], y integer DIMENSION[4] 
CHECK(x = y), val float );
-CREATE TABLE diagonal( x integer,  y integer, val float );
---CREATE ARRAY sparse( x integer DIMENSION[4], y integer DIMENSION[4], val 
float DEFAULT 0.0 CHECK(val>0));
-CREATE TABLE sparse( x integer, y integer,  val float DEFAULT 0.0 
CHECK(val>0));
+#CREATE ARRAY matrix ( x integer DIMENSION[4], y integer DIMENSION[4], val 
float DEFAULT 0.0 );
+#additional operations required for explicit indices
+(x:bat[:oid,:int],y:bat[:oid,:int]) := 
array.newDimension("sys","matrix","x",0,0,4,1,0,4,1);
+
+
+#CREATE ARRAY grid( x integer DIMENSION[4] CHECK(mod(x,2) = 0), y integer 
DIMENSION[4], val float DEFAULT 0.0);
+#additional operations required for explicit indices
+(x:bat[:oid,:int],y:bat[:oid,:int]) := 
array.newDimension("sys","grid","x",0,0,4,1,0,4,1);
+
+#CREATE ARRAY diagonal( x integer DIMENSION[4], y integer DIMENSION[4] CHECK(x 
= y), val float );
+#additional operations required for explicit indices
+(x:bat[:oid,:int],y:bat[:oid,:int]) := 
array.newDimension("sys","diagonal","x",0,0,4,1,0,4,1);
+
+#CREATE ARRAY sparse( x integer DIMENSION[4], y integer DIMENSION[4], val 
float DEFAULT 0.0 CHECK(val>0));
+#additional operations required for explicit indices
+(x:bat[:oid,:int],y:bat[:oid,:int]) := 
array.newDimension("sys","sparse","x",0,0,4,1,0,4,1);
+
diff -r 2a59eb63c74e -r c55c502ef9fe sql/test/sciql/Tests/Msci02.mal
--- a/sql/test/sciql/Tests/Msci02.mal   Sun Jan 16 15:03:36 2011 +0100
+++ b/sql/test/sciql/Tests/Msci02.mal   Sun Jan 16 20:48:51 2011 +0100
@@ -1,6 +1,10 @@
---CREATE TABLE experiment( 
---     run date DIMENSION[  TIMESTAMP '2010-01-01':*: INTERVAL'1' day], 
---     payload float ARRAY[4][4] DEFAULT 0.0 );
-CREATE TABLE experiment( 
-       run date,
-       payload float DEFAULT 0.0 );
+#CREATE TABLE experiment( 
+#      run timestamp DIMENSION[  TIMESTAMP '2010-01-01':*: INTERVAL'1' day], 
+#      payload float ARRAY[4][4] 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);
+
+#CREATE TABLE 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);
diff -r 2a59eb63c74e -r c55c502ef9fe sql/test/sciql/Tests/Msci03.mal
--- a/sql/test/sciql/Tests/Msci03.mal   Sun Jan 16 15:03:36 2011 +0100
+++ b/sql/test/sciql/Tests/Msci03.mal   Sun Jan 16 20:48:51 2011 +0100
@@ -9,20 +9,11 @@
 
 # explicit model, after definition we have to instanciate the array
        # create the x- and y- bats, initialize with their value
-       #pattern array.newIndex(min:any_0,max:any_0,step:any_0):bat[:oid,:any_0]
-       #pattern 
array.newIndex(xmin:any_0,xmax:any_0,xstep:any_0,ymin:any_1,ymax:any_1,ystep:any_1)(x:bat[:oid,:any_0],y:bat[:oid,:any_1])
-       #idem z, t
-       #pattern array.setDefault(idx:bat[:oid,:any_0], 
def:any_1):bat[:oid,:any_1];
-
-       # for a fixed array the post dimension operations are to be called 
explicitly
-       #(x,y):= array.newIndex(0,4,1,0,4,1);
-    #val  := array.setDefault(x,0.0);
-       # create the val bat
 
 function user.s1_1{autoCommit=true}():void;
     _2 := sql.mvc();
 #if we have a dimension with fixed bounds then there can not be updates
-   (_3:bat[:oid,:int],_23:bat[:oid,:int])  := 
array.dimension(_2,"sys","stripes","x",0,4,1,"y",0,4,1);
+   (_3:bat[:oid,:int],_23:bat[:oid,:int])  := 
sciql.dimension(_2,"sys","stripes","x",0,0,4,1,"y",0,4,1);
    _4:bat[:int,:oid]  := bat.reverse(_3);
    _5:bat[:oid,:oid]  := bat.mirror(_4);
    _32:bat[:oid,:int]  := batcalc.+(_3,_23);
@@ -37,7 +28,7 @@
 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])  := 
array.dimension(_2,"sys","stripes","x",null,null,null,"y",null,null,null);
+   (_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);
    _4:bat[:int,:oid]  := bat.reverse(_3);
    _5:bat[:oid,:oid]  := bat.mirror(_4);
    _32:bat[:oid,:int]  := batcalc.+(_3,_23);
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to