Update of /cvsroot/monetdb/sql/src/backends/monet5
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv22807/src/backends/monet5
Modified Files:
Tag: GDK-2
sql.mx sql_optimizer.mx sql_result.mx sql_scenario.mx
Log Message:
propagated changes of Saturday Aug 18 2007 - Tuesday Aug 21 2007
from the development trunk to the GDK-2 branch
Index: sql_result.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql_result.mx,v
retrieving revision 1.60.2.1
retrieving revision 1.60.2.2
diff -u -d -r1.60.2.1 -r1.60.2.2
--- sql_result.mx 12 Aug 2007 17:42:29 -0000 1.60.2.1
+++ sql_result.mx 21 Aug 2007 14:08:01 -0000 1.60.2.2
@@ -498,6 +498,8 @@
if (TABLETload_file(&as, bs, out) >= 0)
bats = TABLETcollect_bats(&as);
}
+ if (as.error)
+ showException(SQL, "sql", as.error);
TABLETdestroy_format(&as);
}
_DELETE(sep);
Index: sql_scenario.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql_scenario.mx,v
retrieving revision 1.274
retrieving revision 1.274.2.1
diff -u -d -r1.274 -r1.274.2.1
--- sql_scenario.mx 26 Jul 2007 11:21:12 -0000 1.274
+++ sql_scenario.mx 21 Aug 2007 14:08:06 -0000 1.274.2.1
@@ -47,9 +47,9 @@
sql5_export str SQLreader(Client c);
sql5_export str SQLparser(Client c);
sql5_export str SQLengine(Client c);
-sql5_export str SQLassert(int *ret, bit *flg, str *msg);
-sql5_export str SQLassertInt(int *ret, int *flg, str *msg);
-sql5_export str SQLassertLng(int *ret, lng *flg, str *msg);
+sql5_export str SQLassert(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
+sql5_export str SQLassertInt(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
+sql5_export str SQLassertLng(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
sql5_export str SQLinitEnvironment(int *ret);
sql5_export str SQLstatement(int *ret, str *expr);
@@ -83,6 +83,7 @@
#include "bat5.h"
#include <mtime.h>
#include "optimizer.h"
+#include "opt_statistics.h"
static int SQLinitialized = 0;
static int SQLdebug = 0;
@@ -228,11 +229,12 @@
throw(SQL, "SQLinit", "Catalogue initialization failed");
if (debug_str)
SQLdebug = strtol(debug_str,NULL,10);
- SQLinitialized = TRUE;
+ SQLinitialized = TRUE;
+/*
if (MT_create_thread(&sqllogthread, (void (*)(void *)) mvc_logmanager,
NULL) < 0) {
throw(SQL, "SQLinit", "Starting log manager failed");
-
}
+*/
return MAL_SUCCEED;
}
@@ -243,6 +245,7 @@
stream_printf(GDKout, "#SQLexit\n");
#endif
(void) c; /* not used */
+ QOTstatisticsExit();
if( SQLinitialized == FALSE)
throw(SQL, "SQLexit", "Catalogue not available");
return MAL_SUCCEED;
@@ -849,13 +852,16 @@
c->itrace='c';
q = newStmt(c->curprg->def,"mdb","setTimer");
pushBit(c->curprg->def,q,onoff);
+/*
q = newStmt(c->curprg->def,"mdb","setFlow");
pushBit(c->curprg->def,q,onoff);
+*/
}
void
SQLshowPlan(Client c)
{
+ /* we should determine rendering requirements first */
newStmt(c->curprg->def, "mdb", "listMapi");
}
@@ -1109,7 +1115,7 @@
@c
finalize:
if(m->mode== m_explain && be->q && be->q->code)
- printFunction(GDKout, ((Symbol)(be->q->code))->def,
LIST_MAL_INSTR | LIST_MAL_PROPS | LIST_MAPI);
+ printFunction(GDKout, ((Symbol)(be->q->code))->def,
LIST_MAL_INSTR | LIST_MAL_PROPS | LIST_MAPI );
@-
Gather the statistics for post analysis. It should preferably
be stored in an SQL table
@@ -1279,7 +1285,7 @@
InstrPtr p;
p = getInstrPtr(c->curprg->def,1);
if (p->blk)
- printFunction(c->fdout, p->blk, c->listing |
LIST_MAPI);
+ printFunction(c->fdout, p->blk, c->listing |
LIST_MAPI );
}
c->curprg->def->errors = -1; /* don;t execute */
}
@@ -1387,32 +1393,42 @@
@-
Assertion errors detected during the execution of a code block
-raises an exception.
+raises an exception. An debugger dump is generated upon request
+to ease debugging.
@c
str
-SQLassert(int *ret, bit *flg, str *msg)
-{
- (void) ret;
- if (*flg)
+SQLassert(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci){
+ bit *flg = (bit*) getArgReference(stk,pci, 1);
+ str *msg = (str*) getArgReference(stk,pci, 2);
+ (void)mb;
+ if (*flg){
+ /* mdbDump(mb,stk,pci);*/
throw(SQL, "assert", *msg);
+ }
return MAL_SUCCEED;
}
str
-SQLassertInt(int *ret, int *flg, str *msg)
-{
- (void) ret;
- if (*flg)
+SQLassertInt(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci){
+ int *flg = (int*) getArgReference(stk,pci, 1);
+ str *msg = (str*) getArgReference(stk,pci, 2);
+ (void)mb;
+ if (*flg){
+ /* mdbDump(mb,stk,pci);*/
throw(SQL, "assert", *msg);
+ }
return MAL_SUCCEED;
}
str
-SQLassertLng(int *ret, lng *flg, str *msg)
-{
- (void) ret;
- if (*flg)
+SQLassertLng(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci){
+ lng *flg = (lng*) getArgReference(stk,pci, 1);
+ str *msg = (str*) getArgReference(stk,pci, 2);
+ (void)mb;
+ if (*flg){
+ /* mdbDump(mb,stk,pci);*/
throw(SQL, "assert", *msg);
+ }
return MAL_SUCCEED;
}
Index: sql_optimizer.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql_optimizer.mx,v
retrieving revision 1.158
retrieving revision 1.158.2.1
diff -u -d -r1.158 -r1.158.2.1
--- sql_optimizer.mx 29 Jul 2007 16:08:22 -0000 1.158
+++ sql_optimizer.mx 21 Aug 2007 14:07:59 -0000 1.158.2.1
@@ -24,59 +24,106 @@
the client record. They are initialized as part of the initialization
phase of the scenario.
-The SQL compiler uses only a small subset of the MAL language.
-This involves ca 70 different operators, divided into the
-catalog management (?) and query processing (?)
@{
-[Make complete list of MAL instructions used in the compilation]
-alarm.usec
-algebra.count
-algebra.join
-algebra.kunique
-algebra.likeselect
-algebra.markT
-algebra.outerjoin
-algebra.semijoin
-algebra.sintersect
-algebra.slice
-algebra.tunique
-algebra.uselect
-bat.append
-batcalc.project
-bat.insert
-bat.mirror
-bat.new
-bat.replace
-bat.reverse
-bat.seqbase
-bat.{setReadMode, setWriteMode}
-bat.sort
-bat.tsort
-bbp.project
-calc.{<,<=,=,!=,>,>=}
-calc.{-.+.*,/,%}
-calc.{oid,int,flt,dbl,str,chr,bit}
-group.group
-group.refine
-group.refine_reverse
-io.printf
-optimizer.multiplex
-sql.assert
-sql.bind
-sql.bind_dbat
-sql.bind_idxbat
-sql.clear_table
-sql.column
-sql.columnBind
-sql.eval
-sql.output
-sql.print
-sql.setVariable
-str.codeset
-stream.close
-stream.openRead
-str.iconv
-??.{sum,min,max,count}
+August 18, 2007 the following coverage list was extracted from the SQL test set
+
+The SQL compiler uses only a small subset of the MAL language
+using the default optimizer sequence.
+This reference list is illustrative for optimizer developers .
+
+ 2429 sql.bind 17 algebra.select
+ 1734 algebra.join 14 sql.append_idxbat
+ 1337 bat.reverse 14 algebra.selectNotNil
+ 966 sql.rsColumn 13 str.toLower
+ 964 constraints.emptySet 12 mmath.cos
+ 816 algebra.markT 12 batcalc.hash
+ 688 bat.append 12 batcalc.*
+ 517 algebra.joinPath 12 algebra.markH
+ 506 algebra.project 10 sql.bbp
+ 495 algebra.uselect 9 sql.bind_idxbat
+ 408 bat.mirror 9 aggr.sum
+ 366 bat.setWriteMode 8 sql.setVariable
+ 343 sql.resultSet 8 batcalc.length
+ 343 sql.exportResult 7 sql.getVariable
+ 225 group.new 7 batcalc.isnil
+ 214 algebra.semijoin 7 batcalc.int
+ 158 group.derive 7 algebra.thetajoin
+ 158 aggr.count 7 algebra.find
+ 143 algebra.kdifference 6 sql.next_value
+ 113 sql.columnBind 6 sql.exportOperation
+ 111 bat.new 6 mmath.sin
+ 106 sql.assert 6 calc.or
+ 104 bat.hasMoreElements 6 calc.lng
+ 99 bat.replace 6 calc.abs
+ 98 aggr.count_no_nil 6 calc.>
+ 85 calc.int 6 batcalc.-
+ 85 algebra.kunion 5 sql.importTable
+ 82 mkey.bulk_rotate_xor_hash 5 mtime.current_timestamp
+ 80 sql.bind_dbat 5 calc.ifthenelse
+ 67 sql.exportValue 5 batcalc.bte
+ 64 bat.insert 5 algebra.slice
+ 56 calc.sht 5 aggr.avg
+ 52 exit MALException:str 4 str.stringlength
+ 52 exit 4 sql.clear_table
+ 52 catch MALException:str 4 io.stdin
+ 52 bat.newIterator 4 calc.dbl
+ 51 sql.append 4 batcalc./
+ 51 algebra.sortTail 4 aggr.max
+ 50 sql.affectedRows 3 str.trim
+ 50 group.refine 3 sql.zero_or_one
+ 48 batcalc.== 3 mtime.current_date
+ 45 calc.!= 3 calc.second_interval
+ 40 pcre.like 3 bat.inplace
+ 37 calc.str 3 batcalc.<
+ 34 calc.* 3 algebra.groupby
+ 34 batcalc.str 3 aggr.min
+ 33 nil:dbl 2 str.like
+ 30 algebra.reuse 2 sql.sql_environment
+ 28 str.stringleft 2 sql.not_unique
+ 23 sql.dump_opt_stats 2 sql.dump_cache
+ 23 calc.isnil 2 nil:lng
+ 23 calc.- 2 mtime.hours
+ 21 calc./ 2 mtime.diff
+ 20 calc.== 2 mmath.sqrt
+ 17 calc.+ 2 mmath.rand
+ 17 batcalc.+ 2 mmath.atan
+ 2 mmath.acos 1 mserver.disconnect
+ 2 calc.not 1 mmath.floor
+ 2 calc.date 1 group.refine_reverse
+ 2 batcalc.not 1 calc.month_interval
+ 2 batcalc.!= 1 calc.min
+ 2 batcalc.<= 1 calc.length
+ 2 aggr.rank_grp 1 calc.flt
+ 2 aggr.exist 1 calc.daytime
+ 1 str.substring 1 calc.bte
+ 1 streams.openRead 1 calc.and
+ 1 streams.close 1 calc.<
+ 1 sql.round 1 bstream.destroy
+ 1 sql.restart 1 bstream.create
+ 1 sql.dec_round 1 batcalc.sht
+ 1 pqueue.topn_max 1 batcalc.>
+ 1 mtime.minutes 1 algebra.kunique
+ 1 mtime.date_add_sec_interval
+
+Organized by module:
+ 4657 algebra
+ 4652 sql
+ 3232 bat
+ 964 constraints
+ 434 group
+ 409 calc
+ 281 aggr
+ 171 batcalc
+ 82 mkey
+ 51 str
+ 40 pcre
+ 27 mmath
+ 14 mtime
+ 4 io
+ 2 streams
+ 2 bstream
+ 1 pqueue
+ 1 mserver
@}
@h
#ifndef _SQL_OPTIMIZER_H_
@@ -418,9 +465,10 @@
"commonTerms,"
"accumulators,"
"joinPath,"
+ /*"partitions,"*/
+ /* "mergetable,"*/
"deadcode,"
"reduce,"
- /* "partitions,"*/
"garbageCollector,"
"multiplex";
static str minimalPlan=
Index: sql.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql.mx,v
retrieving revision 1.230.2.2
retrieving revision 1.230.2.3
diff -u -d -r1.230.2.2 -r1.230.2.3
--- sql.mx 12 Aug 2007 19:38:42 -0000 1.230.2.2
+++ sql.mx 21 Aug 2007 14:07:56 -0000 1.230.2.3
@@ -52,15 +52,15 @@
address SQLstatement
comment "Compile and execute a single sql statement";
-command assert(b:bit,msg:str):void
+pattern assert(b:bit,msg:str):void
address SQLassert
comment "Generate an exception when b==true";
-command assert(b:int,msg:str):void
+pattern assert(b:int,msg:str):void
address SQLassertInt
comment "Generate an exception when b!=0";
-command assert(b:lng,msg:str):void
+pattern assert(b:lng,msg:str):void
address SQLassertLng
comment "Generate an exception when b!=0";
@-
@@ -527,10 +527,6 @@
return x;
end mmath.rand;
-function sql_semijoin(b1:bat[:oid,:any_1], b2:bat[:oid,:any_2])
:bat[:oid,:any_1];
- x := bat.mirror(b2);
- return algebra.join(x,b1);
-end sql_semijoin;
@mal
command prelude()
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins