Microsoft Azure IoT Developer — Question 38
You have an Azure Stream Analytics workspace that contains a Stream Analytics job.
You need to create a JavaScript user-defined aggregate (UDA) method that will recalculate the UDA state based on the previous state and the current event values. The UDA method must be called when an event leaves a SLIDINGWINDOW.
Which UDA method should you use?
Answer options
- A. deaccumulateState()
- B. accumulate()
- C. computeResult()
- D. deaccumulate()
Correct answer: D
Explanation
The correct answer is D, as the deaccumulate() method is specifically designed to update the UDA state when an event leaves a SLIDINGWINDOW. Options A and B are not suitable for this scenario because deaccumulateState() does not fit the requirement, and accumulate() is meant for adding to the state rather than recalculating it. Option C, computeResult(), is used to compute the final result rather than managing state transitions.