Details
-
Type:
Bug
-
Status: Open (View Workflow)
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 10.7.3
-
Fix Version/s: None
-
Component/s: Plugins
-
Labels:None
-
Environment:Windows 64bit
Description
Hi.
When call a very simple test udf function in the sub query,
it seem not reset internal values. Am I something wrong?
--------------------
[udf summary]
1. have init/deinit/xxxx_my_sum.
2. data structure = data->_sum
(to sum/cumulate all values)
3. data->_sum += (*((double*)args->args[0]));
[query summary] |
select
|
*,
|
if(running_sum > 0, 1, 0) as result -- HERE! when refer inner udf's alias, it runs twice |
from
|
(
|
select |
xxxx_my_sum(field_a) as running_sum |
from TableA |
) as test |
--------------------
as above that simple.
in this case, as the result xxxx_my_sum value doubled. Means called twice as a sub query and by the outer query.
How to make the result only one set of sum?(means eventhough called multiple times, want to reset udf inner value _sum every time query restart)