Re: MonetDB: default - Prepare split of sql.mx
Martin, what's the (intended) difference between the newly added command mmath.rand{unsafe} (v:int) :int (see below) and the existing function mmath.rand{inline}( v:int ) :int; (see sql/backends/monet5/sql.mx line 1123) ? In particular, which of the two seemingly identical signatures will the MAL interpreter choose / use to evaluate, say, a:int:=mmath.rand(0:int); ? If they are identical / indistinguishable, one should be removed (again). Thanks, Stefan ps: Found by test clients/Tests/MAL-signatures ;-) ----- Original Message -----
Changeset: 026d2c8bc8ee for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=026d2c8bc8ee Added Files: sql/backends/monet5/sql.mal sql/backends/monet5/sql_aggr_bte.mal sql/backends/monet5/sql_aggr_flt.mal sql/backends/monet5/sql_aggr_int.mal sql/backends/monet5/sql_aggr_lng.mal sql/backends/monet5/sql_aggr_sht.mal sql/backends/monet5/sql_aggr_wrd.mal sql/backends/monet5/sql_cast.mal sql/backends/monet5/sql_inspect.mal sql/backends/monet5/sql_octopus.mal sql/backends/monet5/sql_rank.mal sql/backends/monet5/sql_rdf.mal sql/backends/monet5/sql_sort.mal Modified Files: monetdb5/modules/kernel/mmath.mal sql/backends/monet5/Makefile.ag Branch: default Log Message:
Prepare split of sql.mx The first step in a dissection of the monster. Splitting sql.mx into *mal and the rest
times() has been removed. Also script 11_times should be removed.
sql_cast.mal calls for a shell script whereafter we can finish the first step in the dissection.
diffs (truncated from 1794 to 300 lines):
diff --git a/monetdb5/modules/kernel/mmath.mal b/monetdb5/modules/kernel/mmath.mal --- a/monetdb5/modules/kernel/mmath.mal +++ b/monetdb5/modules/kernel/mmath.mal @@ -182,6 +182,10 @@ command rand{unsafe} () :int address MATHrandint comment "return a random number";
+command rand{unsafe} (v:int) :int +address MATHrandint +comment "return a random number"; + command srand(seed:int) :void address MATHsrandint comment "initialize the rand() function with a seed"; diff --git a/sql/backends/monet5/Makefile.ag b/sql/backends/monet5/Makefile.ag --- a/sql/backends/monet5/Makefile.ag +++ b/sql/backends/monet5/Makefile.ag @@ -96,7 +96,7 @@ lib__sql = { headers_mal = { HEADERS = mal DIR = libdir/monetdb5 - SOURCES = sql.mx + SOURCES = sql.mx sql_aggr_bte.mal sql_aggr_flt.mal sql_aggr_int.mal sql_aggr_lng.mal sql_aggr_sht.mal sql_aggr_wrd.mal sql_cast.mal sql_inspect.mal sql.mal sql_octopus.mal sql_rank.mal sql_rdf.mal sql_sort.mal }
headers_autoload = { diff --git a/sql/backends/monet5/sql.mal b/sql/backends/monet5/sql.mal new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/sql.mal @@ -0,0 +1,1055 @@ +# 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://www.monetdb.org/Legal/MonetDBLicense +# +# 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-2013 MonetDB B.V. +# All Rights Reserved. + + +module batsql; +module sql; + +pattern start():void +address SQLsession +comment "Switch to processing SQL statements"; + +pattern start2():void +address SQLsession2 +comment "Switch to processing precompiled sql statements"; + +pattern init():void +address SQLinitEnvironment +comment "Initialize the environment for MAL"; + +pattern shutdown(delay:bte, force:bit):str +address SQLshutdown_wrap; +pattern shutdown(delay:sht, force:bit):str +address SQLshutdown_wrap; +pattern shutdown(delay:int, force:bit):str +address SQLshutdown_wrap; + +pattern shutdown(delay:bte):str +address SQLshutdown_wrap; +pattern shutdown(delay:sht):str +address SQLshutdown_wrap; +pattern shutdown(delay:int):str +address SQLshutdown_wrap; + +pattern mvc():int +address SQLmvc +comment "Get the multiversion catalog context. +Needed for correct statement dependencies +(ie sql.update, should be after sql.bind in concurrent execution)"; + +pattern trans(type:int,chain:int,name:str):void +address SQLtransaction +comment "A transaction statement (type can be commit,release,rollback or start)"; + +pattern transaction{unsafe}() +address SQLtransaction2 +comment "Start an autocommit transaction"; + +pattern commit() +address SQLcommit +comment "Trigger the commit operation for a MAL block"; + +pattern abort() +address SQLabort +comment "Trigger the abort operation for a MAL block"; + +pattern catalog(type:int,sname:str,name:str,action:int):void +address SQLcatalog; +pattern catalog(type:int,sname:str,name:str,funcid:int,ft:int,action:int):void +address SQLcatalog; +pattern catalog(type:int,sname:str,name:str,tname:str,time:int,o:int,event:int,oname:str,nname:str,condition:str,query:str):void +address SQLcatalog; +pattern catalog(type:int,sname:str,t:ptr):void +address SQLcatalog; +pattern catalog(type:int,sname:str,t:ptr,temp:int):void +address SQLcatalog; +pattern catalog(type:int,sname:str,t:ptr,restart:lng):void +address SQLcatalog +comment "a catalog statement"; + +pattern catalog(type:int,grantee:str,role:str):void +address SQLcatalog +comment "a grant/revoke role statement"; + +pattern catalog(type:int,user:str,passwd:str,enc:int,schema:str,fullname:str):void +address SQLcatalog +comment "a user catalog statement"; + +pattern catalog(type:int,sname:str,tname:str,grantee:str,privs:int,cname:str,grant:int,grantor:int):void +address SQLcatalog +comment "a grant/revoke privileges statement"; + +pattern catalog(type:int,iname:str,itype:int,sname:str,tname:str...):void +address SQLcatalog +comment "a create index catalog statement"; + +pattern eval(cmd:str):void +address SQLstatement; +pattern eval(cmd:str, output:bit):void +address SQLstatement +comment "Compile and execute a single sql statement (and optionaly send output on the output stream)"; + +pattern include(fname:str):void +address SQLinclude +comment "Compile and execute a sql statements on the file"; + +pattern evalAlgebra(cmd:str, optimize:bit):void +address RAstatement +comment "Compile and execute a single 'relational algebra' statement"; + +pattern assert(b:bit,msg:str):void +address SQLassert; +pattern assert(b:int,msg:str):void +address SQLassertInt; +pattern assert(b:wrd,msg:str):void +address SQLassertWrd; +pattern assert(b:lng,msg:str):void +address SQLassertLng +comment "Generate an exception when b!=0"; + +pattern setVariable(mvc:int, varname:str, value:any_1 ):int +address setVariable +comment "Set the value of a session variable"; + +pattern getVariable(mvc:int, varname:str ):any_1 +address getVariable +comment "Get the value of a session variable"; + +pattern logfile{unsafe}(filename:str):void +address mvc_logfile +comment "Enable/disable saving the sql statement traces"; + +pattern next_value( sname:str, sequence:str ):lng +address mvc_next_value +comment "return the next value of the sequence"; + +pattern batsql.next_value( sname:bat[:oid,:str], sequence:str ) :bat[:oid,:lng] +address mvc_bat_next_value +comment "return the next value of the sequence"; + +pattern get_value( sname:str, sequence:str ):lng +address mvc_get_value +comment "return the current value of the sequence"; + +pattern restart{unsafe}( sname:str, sequence:str, start:lng ):lng +address mvc_restart_seq +comment "restart the sequence with value start"; + +pattern bind_idxbat(mvc:int, schema:str, table:str, index:str, access:int):bat[:oid,:any_1] +address mvc_bind_idxbat_wrap +comment "Bind the 'schema.table.index' BAT with access kind: + 0 - base table + 1 - inserts + 2 - updates"; + +pattern bind_idxbat(mvc:int, schema:str, table:str, index:str, access:int)(uid:bat[:oid,:oid],uval:bat[:oid,:any_1]) +address mvc_bind_idxbat_wrap +comment "Bind the 'schema.table.index' BAT with access kind: + 0 - base table + 1 - inserts + 2 - updates"; + +pattern bind_idxbat(mvc:int, schema:str, table:str, index:str, access:int, part_nr:int, nr_parts:int):bat[:oid,:any_1] +address mvc_bind_idxbat_wrap +comment "Bind the 'schema.table.index' BAT with access kind: + 0 - base table + 1 - inserts + 2 - updates"; + +pattern bind_idxbat(mvc:int, schema:str, table:str, index:str, access:int, part_nr:int, nr_parts:int)(uid:bat[:oid,:oid],uval:bat[:oid,:any_1]) +address mvc_bind_idxbat_wrap +comment "Bind the 'schema.table.index' BAT with access kind: + 0 - base table + 1 - inserts + 2 - updates"; + +pattern bind(mvc:int, schema:str, table:str, column:str, access:int ):bat[:oid,:any_1] +address mvc_bind_wrap +comment "Bind the 'schema.table.column' BAT with access kind: + 0 - base table + 1 - inserts + 2 - updates"; + +pattern bind(mvc:int, schema:str, table:str, column:str, access:int )(uid:bat[:oid,:oid],uval:bat[:oid,:any_1]) +address mvc_bind_wrap +comment "Bind the 'schema.table.column' BAT with access kind: + 0 - base table + 1 - inserts + 2 - updates"; + +pattern bind(mvc:int, schema:str, table:str, column:str, access:int, part_nr:int, nr_parts:int ):bat[:oid,:any_1] +address mvc_bind_wrap +comment "Bind the 'schema.table.column' BAT partition with access kind: + 0 - base table + 1 - inserts + 2 - updates"; + +pattern bind(mvc:int, schema:str, table:str, column:str, access:int, part_nr:int, nr_parts:int )(uid:bat[:oid,:oid],uval:bat[:oid,:any_1]) +address mvc_bind_wrap +comment "Bind the 'schema.table.column' BAT with access kind: + 0 - base table + 1 - inserts + 2 - updates"; + +command delta ( col:bat[:oid,:any_3], uid:bat[:oid,:oid], uval:bat[:oid,:any_3], ins:bat[:oid,:any_3] ) + :bat[:oid,:any_3] +address DELTAbat +comment "Return column bat with delta's applied."; + +command projectdelta( subselect:bat[:oid,:oid], col:bat[:oid,:any_3], uid:bat[:oid,:oid], uval:bat[:oid,:any_3], ins:bat[:oid,:any_3] ) :bat[:oid,:any_3] +address DELTAproject +comment "Return column bat with delta's applied."; + +command subdelta ( col:bat[:oid,:oid], cand:bat[:oid,:oid], uid:bat[:oid,:oid], uval:bat[:oid,:oid], ins:bat[:oid,:oid] ) :bat[:oid,:oid] +address DELTAsub +comment "Return a single bat of subselected delta."; + +command delta ( col:bat[:oid,:any_3], uid:bat[:oid,:oid], uval:bat[:oid,:any_3]) :bat[:oid,:any_3] +address DELTAbat2 +comment "Return column bat with delta's applied."; + +command projectdelta( subselect:bat[:oid,:oid], col:bat[:oid,:any_3], uid:bat[:oid,:oid], uval:bat[:oid,:any_3]) :bat[:oid,:any_3] +address DELTAproject2 +comment "Return column bat with delta's applied."; + +command subdelta ( col:bat[:oid,:oid], cand:bat[:oid,:oid], uid:bat[:oid,:oid], uval:bat[:oid,:oid]) :bat[:oid,:oid] +address DELTAsub2 +comment "Return a single bat of subselected delta."; + +command getVersion(clientid:int):lng +address mvc_getVersion +comment "Return the database version identifier for a client"; + +pattern append(mvc:int, sname:str, tname:str, cname:str, ins:any):int +address mvc_append_wrap +comment "Append b to the column tname.cname (possibly optimized to replace the insert bat of tname.cname (returns sequence number for order dependence)"; + +pattern update(mvc:int, sname:str, tname:str, cname:str, rids:any, upd:any):int +address mvc_update_wrap +comment "Update the values of the column tname.cname"; + +pattern clear_table{unsafe}(sname:str, tname:str) :wrd +address mvc_clear_table_wrap +comment "Clear table"; + +pattern tid( mvc:int, sname:str, tname:str):bat[:oid,:any_3] +address SQLtid; +pattern tid( mvc:int, sname:str, tname:str, part_nr:int, nr_parts:int ):bat[:oid,:any_3] +address SQLtid +comment "Return the tables tid column."; + +pattern delete{unsafe}(mvc:int, sname:str, tname:str, b:any):int +address mvc_delete_wrap +comment "delete from table"; + +pattern resultSet{unsafe}( nr_cols:int, sep:str, rsep:str, ssep:str, ns:str, order:any_1 ) :int +address mvc_result_file_wrap; +pattern resultSet{unsafe}( nr_cols:int, sep:str, rsep:str, ssep:str, ns:str, order:bat[:oid,:any_1] ) :int +address mvc_result_file_wrap; +pattern resultSet{unsafe}( nr_cols:int, qtype:int, order:any_1 ) :int +address mvc_result_row_wrap; +pattern resultSet{unsafe}( nr_cols:int, qtype:int, order:bat[:oid,:any_1] ) :int +address mvc_result_table_wrap; +pattern rsColumn{unsafe}(rs:int, tname:str, name:str, typename:str, digits:int, scale:int, val:any_1 ) :void +address mvc_result_value_wrap +comment "Add the value to the row query result"; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
-- | Stefan.Manegold@CWI.nl | DB Architectures (DA) | | www.CWI.nl/~manegold/ | Science Park 123 (L321) | | +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |
participants (1)
-
Stefan Manegold