Running MAL Programs Manually?

Stephen P. Morgan stephen_p_morgan at
Tue Mar 12 00:04:26 CET 2013

I can answer my own question here.  First, apparently we have to run 
"sql.init();" before running the MAL program iff it includes "sql.mvc();"  
Second, there is something wrong with the code generator--it is not generating 
initialization steps for X_15 and X_22.  When I added these, the function ran 
correctly.  Thus, before the barrier statement, I needed to add the lines,

    X_15 := nil:bat[:oid,:int];
    X_22 := nil:bat[:oid,:int];

Steve Morgan

From: Stephen P. Morgan <stephen_p_morgan at>
To: developers-list at
Sent: Mon, March 11, 2013 1:09:33 PM
Subject: Running MAL Programs Manually?

Should it be possible to run MAL programs manually, by reading them from a 
file?  I just tried a simple experiment and got an error message.

The experiment: I created a table, "test," with two columns, "field1" and 
field2."  I created a MAL query by issuing the SQL query, "EXPLAIN SELECT * FROM 
test;" and cut and pasted the output to a file.  I then stripped out all of the 
formatting characters ('|') and extraneous spaces.  I then re-entered mclient, 
choosing the MAL language, and read in the MAL form of the query with "\< 
junk.mal."  The interpreter then complained that two identifiers were not 
initialized (see output, below).  So, is it not possible to issue a MAL query by 
hand?  Or am I missing something?  (Again, please forgive me, I  am new to 


Steve Morgan

mal>\< junk.mal
MAPI  = (monetdb) /tmp/.s.monetdb.50000
QUERY = function user.s1_1{autoCommit=true}():void;
        barrier X_41 := language.dataflow();
            X_2 := sql.mvc();
            X_3:bat[:oid,:oid]  := sql.tid(X_2,"sys","test");
            X_6 := sql.bind(X_2,"sys","test","field1",0);
            (X_9,r1_9) := sql.bind(X_2,"sys","test","field1",2);
            X_12 :=  sql.bind(X_2,"sys","test","field1",1);
            X_14 :=,X_9,r1_9,X_12);
            X_15 := algebra.leftfetchjoin(X_3,X_14);
            X_16 := sql.bind(X_2,"sys","test","field2",0);
            (X_18,r1_22) := sql.bind(X_2,"sys","test","field2",2);
            X_20 := sql.bind(X_2,"sys","test","field2",1);
            X_21 :=,X_18,r1_22,X_20);
            X_22 := algebra.leftfetchjoin(X_3,X_21);
        exit X_41;
            X_23 := sql.resultSet(2,1,X_15);
            X_29 := io.stdout();
        end s1_1;
ERROR = !TypeException:user.s1_1[16]:'X_15' may not be used before being 
        !TypeException:user.s1_1[17]:'X_15' may not be used before being 
         !TypeException:user.s1_1[18]:'X_22' may not be used before being 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the developers-list mailing list