如何在流分析中检查JSON属性中的空值?

问题描述 投票:0回答:1

我将以下Json输入从Eventhub传递到Stream Analytics。

{"meter_totalcycleenergy":null,"Test2": 20}, {"meter_totalcycleenergy":40,"Test2":20}

但是这项工作没有说明错误。

尝试写入1个事件时遇到错误:无法从“System.String”类型的属性“meter_totalcycleenergy”转换为“System.Single”类型的“meter_totalcycleenergy”列。

Error Image如何处理这种情况。

我认为Json nulls不完全是SQL NULL,那么在查询中检查空值的正确方法是什么?

meter_totalcycleenergy的数据类型在我的数据库中是浮点数。

azure-stream-analytics stream-analytics
1个回答
0
投票

你可以使用is not null。例如:

select *
from input
where meter_totalcycleenergy is not null
© www.soinside.com 2019 - 2024. All rights reserved.