3

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

Michael
  • 41,989
  • 11
  • 82
  • 128
Fopa Léon Constantin
  • 11,863
  • 8
  • 48
  • 82

1 Answers1

4

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);

mkersten
  • 694
  • 3
  • 7
  • thanks for your answer, could you please provide me a link to a more detailed documentation on Monet Assembler Language (MAL)? the one i'm reading now (https://www.monetdb.org/Documentation/MonetDB/Introduction) is quit synthetic and don't have detaille information which can help me to go deeper in MAL programmation – Fopa Léon Constantin Mar 21 '14 at 13:52
  • It is the starting place. Basically, it is not intended to be your primary programming language, unless you aim to develop a front-end compiler. For the rest, have a look at all hundreds of MAL test programs. – mkersten Mar 22 '14 at 20:41