首页 > 解决方案 > 如何在流分析中检查 JSON 属性中的空值?

问题描述

我将以下 Json 输入从 Eventhub 传递到流分析。

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

但这项工作未能说明错误。

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

错误图像 如何处理这种情况。

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

Meter_totalcycleenergy 的数据类型在我的数据库中是浮动的。

标签: azure-stream-analyticsstream-analytics

解决方案


您可以使用is not null. 例如:

select *
from input
where meter_totalcycleenergy is not null

推荐阅读