After this checkin (and the related output approval),
the following 4 tests do fail, now:

sql/src/backends/monet5/Tests/optimizers.sql
Please double check the error messages, whether they are indeed as desired.

sql/src/test/Tests/setoptimizer.sql.src
Please double check output and error messages, whether they are indeed as 
desired.

sql/src/benchmarks/tpch/Tests/01-22.SQL.sh
ERROR = !MALException:!ERROR: BATpropcheck: BAT tmpr_1636(-926)[oid,oid] with 
55 tuples was incorrectly marked nonil!

sql/src/test/BugTracker-2009/Tests/leftjoin_undefined.SF-2879011.sql
ERROR = !TypeException:user.s2_1[42]:'algebra.leftjoin' undefined in: _55:any 
:= algebra.leftjoin(_54:bat[:oid,:void], _27:bat[:oid,:str], _50:lng)
        !SQLException:SQLengine:Program contains errors

Stefan

On Sun, Nov 15, 2009 at 04:55:29PM +0000, Martin Kersten wrote:
> Update of /cvsroot/monetdb/sql/src/backends/monet5
> In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv27458
> 
> Modified Files:
>       Tag: Nov2009
>       sql.mx sql_optimizer.mx 
> Log Message:
> Move the validation of the optimizer pipeline to the assignment itself,
> rather then checking them on the first call.
> 
> 
> Index: sql_optimizer.mx
> ===================================================================
> RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql_optimizer.mx,v
> retrieving revision 1.230.2.8
> retrieving revision 1.230.2.9
> diff -u -d -r1.230.2.8 -r1.230.2.9
> --- sql_optimizer.mx  8 Nov 2009 14:36:34 -0000       1.230.2.8
> +++ sql_optimizer.mx  15 Nov 2009 16:55:27 -0000      1.230.2.9
> @@ -136,7 +136,7 @@
>  sql5_export void addQueryToCache(Client c);
>  sql5_export str SQLoptimizer(Client c);
>  sql5_export void SQLsetAccessMode(Client c);
> -sql5_export int SQLvalidatePipeline(void);
> +sql5_export str SQLvalidatePipeline(void);
>  sql5_export str setOptimizers(str optimizer);
>  
>  #endif /* _SQL_OPTIMIZER_H_ */
> @@ -441,6 +441,7 @@
>  Additional pipelines are defined in the monetdb.conf file.
>  The optimizers can be turned on/off, leaving the minimal plan
>  active.
> +The first error in the optimizer string is shown.
>  @c
>  str minimalPlan= "inline,remap,deadcode,multiplex";
>  
> @@ -448,17 +449,17 @@
>  static str optimizerpipe;            /* reference to last pipeline string */
>  static char *previouspipe = 0;
>       
> -int
> +str
>  SQLvalidatePipeline(void){
> -     int error= 0;
>       int mitosis= FALSE, deadcode= FALSE, mergetable= FALSE, replication= 
> FALSE;
>       int i;
>  
>       mal_set_lock(sql_contextLock,"SQL optimizer");
> -     if (optimizers[0] &&  strcmp(optimizers[0],"inline") ){
> -             showException(SQL,"optimizer"," 'inline' should be the 
> first\n");
> -             error++;
> +     if (optimizers[0] &&  strcmp(optimizers[0],"inline") ) {
> +             mal_unset_lock(sql_contextLock,"SQL optimizer");
> +             throw(SQL,"optimizer"," 'inline' should be the first\n");
>       }
> +     
>       /* deadcode should be used */
>       for ( i=0; optimizers[i]; i++)
>               if (strcmp(optimizers[i],"deadcode") == 0)
> @@ -476,34 +477,34 @@
>  #ifdef WIN32
>               else
>               if (strcmp(optimizers[i],"octopus") == 0){
> -                     showException(SQL,"optimizer"," 'octopus' needs 
> Linux\n");
> -                     error++;
> +                     mal_unset_lock(sql_contextLock,"SQL optimizer");
> +                     throw(SQL,"optimizer"," 'octopus' needs Linux\n");
>               }
>  #endif
>       if (optimizers[0] && mitosis == TRUE && mergetable == FALSE) {
> -             showException(SQL,"optimizer"," 'mitosis' needs 
> 'mergetable'\n");
> -             error++;
> +             mal_unset_lock(sql_contextLock,"SQL optimizer");
> +             throw(SQL,"optimizer"," 'mitosis' needs 'mergetable'\n");
>       }
>  
>       if ( --i >= 0 && optimizers[i] && strcmp(optimizers[i],"multiplex") ){
> -             showException(SQL,"optimizer"," 'multiplex' should be the 
> last\n");
> -             error++;
> +             mal_unset_lock(sql_contextLock,"SQL optimizer");
> +             throw(SQL,"optimizer"," 'multiplex' should be the last\n");
>       }
>       if (optimizers[0] && deadcode == FALSE ){
> -             showException(SQL,"optimizer"," 'deadcode' should be used at 
> least once\n");
> -             error++;
> +             mal_unset_lock(sql_contextLock,"SQL optimizer");
> +             throw(SQL,"optimizer"," 'deadcode' should be used at least 
> once\n");
>       }
>  @-
>  For replicated databases we need to ensure that the corresponding optimizer
>  is enabled.
>  @c
>       if ( MASTERroleEnabled() && replication == FALSE){
> -             showException(SQL,"optimizer"," 'replication' should be part of 
> the pipeline\n");
> -             error++;
> +             mal_unset_lock(sql_contextLock,"SQL optimizer");
> +             throw(SQL,"optimizer"," 'replication' should be part of the 
> pipeline\n");
>       }
>  
>       mal_unset_lock(sql_contextLock,"SQL optimizer");
> -     return error;
> +     return MAL_SUCCEED;
>  }
>  
>  @-
> @@ -558,25 +559,21 @@
>                       nxt++;
>               }
>               if ((nme = putName(optimizer,strlen(optimizer))) == 0)
> -                     showException(SQL,"optimizer"," '%s' does not 
> exist\n",optimizer);
> +                     showException(SQL,"optimizer"," '%s' pipeline does not 
> exist\n",optimizer);
>               else if (top<255)
>                       optimizers[top++] = nme; 
>               optimizer = nxt;
>       } 
>       optimizers[top] = 0;
>       GDKfree(base);
> -     if (top == 1  && pipe == NULL){
> -             showException(SQL,"optimizer","Optimizer '%s' does not exist, 
> use default pipe instead\n", optimizerpipe?optimizerpipe:"undefined");
> +     if (top <= 1  && pipe == NULL){
> +             showException(SQL,"optimizer","Optimizer '%s' pipeline does not 
> exist, use default pipe instead\n", optimizerpipe?optimizerpipe:"undefined");
>               setOptimizers("default_pipe");
>       }else
>       if (top == 256){
>               showException(SQL,"optimizer","Too many optimizer steps, use 
> default pipe instead\n");
>               setOptimizers("default_pipe");
> -     } else
> -     if (SQLvalidatePipeline() ) {
> -             showException(SQL,"optimizer"," Invalid pipeline,  use 
> default_pipe instead\n");
> -             setOptimizers("default_pipe");
> -     }
> +     } 
>       return GDKstrdup(optimizerpipe);
>  }
>  
> 
> Index: sql.mx
> ===================================================================
> RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql.mx,v
> retrieving revision 1.358.2.10
> retrieving revision 1.358.2.11
> diff -u -d -r1.358.2.10 -r1.358.2.11
> --- sql.mx    8 Nov 2009 13:38:52 -0000       1.358.2.10
> +++ sql.mx    15 Nov 2009 16:55:27 -0000      1.358.2.11
> @@ -1180,6 +1180,7 @@
>  #include <sql_storage.h>
>  #include <sql_scenario.h>
>  #include <store_sequence.h>
> +#include <sql_optimizer.h>
>  #include <sql_datetime.h>
>  #include <rel_optimizer.h>
>  #include <rel_select.h>
> @@ -1416,6 +1417,14 @@
>  
>       if (mtype < 0 || mtype >= 255)
>               throw(SQL, "sql.setVariable", "failed");
> +     if ( strcmp("optimizer",  varname)== 0) {
> +             setOptimizers(*(str *) getArgReference(stk,pci,2));
> +             msg = SQLvalidatePipeline();
> +             if ( msg ){
> +                     setOptimizers("default_pipe");
> +                     return msg;
> +             }
> +     }
>       src = &stk->stk[getArg(pci, 2)];
>       if (stack_find_var(m, varname)) {
>               stack_set_var(m, varname, src);
> 
> 
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Monetdb-sql-checkins mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins
> 
> 

-- 
| Dr. Stefan Manegold | mailto:[email protected] |
| CWI,  P.O.Box 94079 | http://www.cwi.nl/~manegold/  |
| 1090 GB Amsterdam   | Tel.: +31 (20) 592-4212       |
| The Netherlands     | Fax : +31 (20) 592-4312       |

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to