monetdbmonetdb-assembly-language

How to execute a MAL function in monetdb?


I'm reading the MonetDB Internal Description because I'm interested to implement a special procedure direct in the MonetDB Algebra Language (MAL) instead of SQL-frontend (I hope to gain more performance by doing so). Here is a sample MAL code provide in the MonetDB documentation

 function sample(nme:str, val:any_1):bit;
    c := 2 * 3;
    b := bbp.bind(nme);  #find a BAT
    h := algebra.select(b,val,val);
    t := aggr.count(h);
    x := io.print(t);
    y := io.print(val);
 end sample;

My question is how to execute such a MAL code upon one of my existing database ?

Thans for any replay


Solution

  • The monetdb client program has a language directive -l.

    Use the command:

    mclient -d -l mal

    you will see the mal> prompt, whereafter you can call the function like:

    mal> sample('colname', 23)

    Note that the bbp.bind() operation is not type correct. It can not be establised at compile time. Use instead:

    b:bat[:oid,:any_1]:= bpp.bind(nme);