Open e-tang opened 2 years ago
Based on the testing, particularly the first window got called twice
Tried to use map function on Series directly it turned out the same, the function got called more than it should. So it should be the bug in the iterator.
OKay, figured out why this happened.
After going through the source code, find out whenever the series is baked, the internal iterators are called and trigger the selector function. During this process, the selector function can be call numerous times from getColumnNames(), toArray(), and toPairs().
I believe this is due to Data-Forge's laziness and you need to write the transformer function so that it can execute without side effects.
I do realise this is a problem and I'm considering removing the the laziness in Data-Forge v2.
I've labelled this issue and will return to it for v2.
When using rollingwindow with the select function, the rolling windows are correct but select function calls the transformer more than it should.
Please see the following test code:
The following are the outputs:
I think only 4 times should be the correct number.