Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversion error in Stream Analytics Job when processing JSON data has a "double" property #177

Open
cago-rebl opened this issue Aug 14, 2023 · 0 comments

Comments

@cago-rebl
Copy link

Hello,

I have a console application that streams JSON data to an Azure IoT hub with the following format:

{
   "Name": "testname",
   "testvalue": 0,
}

This JSON represents a C# model in my console app, which looks like this:

public class testmodel
{
     public double Name { get; set; }
     public double testvalue { get; set; }
}

After the data has been sent up to the hub, my stream analytics job processes it and outputs it to my PostgreSQL database in the testtable table, which has the following columns:

  • name (varchar)
  • testvalue (float4)

The query I'm using for this is:

SELECT
    Input.Name AS name
    ,CAST(Input.testvalue AS float) AS testvalue
INTO
    [test-db]
FROM
    [iothub] AS Input TIMESTAMP BY Input.EventProcessedUtcTime

However, when the analytics job tries to insert the data, I encounter errors indicating that the conversion from bigint to float is failing.

The problem here is that the "testvalue" field sometimes includes decimals and sometimes does not. This inconsistency is causing the issue: when the "testvalue" field contains decimals, the conversion works correctly, but when it does not contain decimals, the conversion fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant