azure-stream-analytics - 如何在流分析中检查 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 的数据类型在我的数据库中是浮动的。
解决方案
您可以使用is not null
. 例如:
select *
from input
where meter_totalcycleenergy is not null
推荐阅读
- servicenow - 为 ServiceNow 中的每条记录选择第一个非空字段
- pandas - 数据帧数组
- android-studio - 当我在 bluestacks 中运行它时,麦克风在我的应用程序中不起作用
- javascript - 如何使组件始终位于 react-leaflet 地图之上?
- javascript - 逐行分隔数组
- typescript - 隐藏 Mongoose 对象 Typescript 的属性
- node.js - MongoServerSelectionError:连接 ECONNREFUSED 127.0.0.1:27107
- express - 如何在猫鼬中填充对象数组
- micronaut - Micronaut:同一应用程序的多种安全配置
- c# - 如何在 c# 中将 OpenQA.Selenium.Chrome.ChromeDriver 保存到文件中