Search code examples
azure-stream-analytics

Azure Stream Analytics Job query: how to case bigint to float?


My input is JSON like this:

{
        "ClientStateOrProvince": "Noord-Holland",
        "ClientType": "PC",
        "IKey": "6ca435d6-f333-4888-9288-8e3170a12664",
        "ItemCount": 1,
        "Max": 2,
        "Min": 2,
}

The properties Min and Max are integers in the example above but they could also be decimal numbers. If I test out my query in the portal's editor, both Min and Max are showing up as bigint in the "Test results" pane although I applied a CAST(Min AS float) AS Min:

SELECT
    [...]
    CAST(Min AS float) AS Min,
    Max
FROM
    Input

What am I doing wrong? How can I enforce a float data type?


Solution

  • It's a problem with the UI only. The UI will deduct the data type based on the value, no matter what the CAST() specifies. The moment an output is added (for example ADL2 Parquet), the resulting data type will match the result of the case, in my case float.