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.