Hi Martin,

The version is Jan2022-SP1 (V11.43.9.).
How can I maintain unique variables within a function, when executed multiple times on the same query?

Thanks.

On Thu, Jun 16, 2022 at 2:22 PM Martin Kersten <Martin.Kersten@cwi.nl> wrote:
within parallel blocks all variables should be unique. I really advice to stay close to the latest releases

> On 16 Jun 2022, at 10:53, imad hajj chahine <imad.hajj.chahine@gmail.com> wrote:
>
> 
> Hi,
>
> I have a mal function defined as following:
>
> function halfofyear(pdate:bat[:date]):bat[:int];
> hym:= batmtime.month(pdate);
> hy:= batcalc.-(hym, 1, nil:bat);
> hy:= batcalc./(hy, 6, nil:bat);
> return halfofyear:= batcalc.+(hy, 1, nil:bat);
> end halfofyear;
>
> and I am calling it twice on 2 date columns:
> select  halfofyear(colDate1),  halfofyear(colDate2) from table.
>
> My concern is the scope of variables defined (hym, hy), as I was expecting to have unique naming when executing. Is it a guarantee that internally they are different variables or these are shared across the calls from the same query.
>
> bellow is the trace produced:
>     hym=[57530]:bat[:int] := batmtime.month(pdate=[57530]:bat[:date]);
>     hym=[57530]:bat[:int] := batmtime.month(pdate=[57530]:bat[:date]);
>     hy=[57530]:bat[:int] := batcalc.-(hym=[57530]:bat[:int], 1:int, nil:BAT);
>     hy=[57530]:bat[:int] := batcalc.-(hym=[57530]:bat[:int], 1:int, nil:BAT);
>     hy=[57530]:bat[:int] := batcalc./(hy=[57530]:bat[:int], 6:int, nil:BAT);
>     hy=[57530]:bat[:int] := batcalc./(hy=[57530]:bat[:int], 6:int, nil:BAT);
>     return halfofyear=[57530]:bat[:int] := batcalc.+(hy=[57530]:bat[:int], 1:int, nil:BAT);
>     return halfofyear=nil:bat[:int] := batcalc.+(hy=nil:bat[:int], 1:int, nil:BAT);
> function batudf.halfofyear(pdate:bat[:date]):bat[:int];
>     X_22=[57530]:bat[:int] := batudf.halfofyear(X_20=[57530]:bat[:date]);
>     return halfofyear=[57530]:bat[:int] := batcalc.+(hy=[57530]:bat[:int], 1:int, nil:BAT);
>     return halfofyear=nil:bat[:int] := batcalc.+(hy=nil:bat[:int], 1:int, nil:BAT);
> function batudf.halfofyear(pdate:bat[:date]):bat[:int];
>     X_25=[57530]:bat[:int] := batudf.halfofyear(X_21=[57530]:bat[:date]);
> barrier X_76=false:bit := language.dataflow();
>     X_26=33:int := sql.resultSet(X_27=[2]:bat[:str], X_28=[2]:bat[:str], X_29=[2]:bat[:str], X_30=[2]:bat[:int], X_31=[2]:bat[:int], X_22=[57530]:bat[:int], X_25=[57530]:bat[:int]);
>
> Thanks.
> _______________________________________________
> users-list mailing list -- users-list@monetdb.org
> To unsubscribe send an email to users-list-leave@monetdb.org

_______________________________________________
users-list mailing list -- users-list@monetdb.org
To unsubscribe send an email to users-list-leave@monetdb.org