Is there anything else to pay attention to when using GetArrayElements() function?

kunming jian 40 Reputation points
2023-09-21T08:08:18.81+00:00

I create a UDF in Azure Stream Analysis,but there was an error when I called it, as follows:

//ExtractDynamicFields(inputData) is the UDF,and it return the array type
CROSS APPLY GetArrayElements(ExtractDynamicFields(event)) AS arrayElement
//error like follows:
Function 'GetArrayElements' requires a field of type 'array' as a parameter.

What should I do to solve this problem?

Azure Stream Analytics
Azure Stream Analytics
An Azure real-time analytics service designed for mission-critical workloads.
331 questions
{count} votes

Accepted answer
  1. Sander van de Velde 29,196 Reputation points MVP
    2023-09-24T22:18:33.3366667+00:00

    Hello

    It's a bit hard to actually grasp what the function should do but I was able to do something similar.

    I got the same error message until I split up the query:

    User's image

    First, make sure the output of the function is 'array':

    User's image

    My function is not that impressive:

    User's image

    Call the function as an UDF:

    User's image

    Finally, I did not call the function on the same line as the cross apply but added the function as extra columns to an tempory table:

    User's image

    I recommend using the VS Code extension for Stream Analytics so you can test your function and job locally.


    If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful