我在我的租户中部署了以下示例:
从MeasurementCreated创建上下文HourlyAvgMeasurementDeviceContext分区measurement.source.value;
@Name("Creating_hourly_measurement")
context HourlyAvgMeasurementDeviceContext
insert into CreateMeasurement
select
m.measurement.source as source,
current_timestamp().toDate() as time,
"c8y_AverageTemperatureMeasurement" as type,
{
"c8y_AverageTemperatureMeasurement.T.value", avg(cast(getNumber(m, "c8y_TemperatureMeasurement.T.value"), double)),
"c8y_AverageTemperatureMeasurement.T.unit", getString(m, "c8y_TemperatureMeasurement.T.unit")
} as fragments
from MeasurementCreated.win:time(1 hours) m
where getObject(m, "c8y_TemperatureMeasurement") is not null
output last every 1 hours;
之后我想得到一个小时内的平均温度值(最好是单位),如下所示:
Select event.c8y_AverageTemperatureMeasurement.T.value from CreateMeasurement event;
但是在将查询部署为时出现错误:
错误开始语句:无法验证选择子句表达式“event.c8y_AverageTemperatureMeasure ...(47个字符)”:无法将属性“event.c8y_AverageTemperatureMeasurement.T.value”解析为流或流中的嵌套属性[选择事件。 c8y_AverageTemperatureMeasurement.T.value 来自 CreateMeasurement 事件
你能帮忙吗?