Stream Analytics作业具有验证错误:作业将超过事件中心接收器的最大数量. [英] Stream Analytics job has validation errors: Job will exceed the maximum amount of Event Hub Receivers.

查看:100
本文介绍了Stream Analytics作业具有验证错误:作业将超过事件中心接收器的最大数量.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个流分析查询,从IOT Hub访问数据,以下是查询:

I have a stream analytics query, accessing data from IOT Hub, following is the query:

WITH data AS (
   SELECT * FROM IoTTelemetryStream
),

AggregationStep AS 
(
     SELECT
        Stream.EventEnqueuedUtcTime as tumblingWindowEnd,
        deviceid as DeviceId,
        AVG (PanelVoltage) AS [AveragePanelVoltage],
        AVG (PanelCurrent) AS [AveragePanelCurrent],
        AVG (BatteryVoltage) AS [AverageBatteryVoltage],
        AVG (BatteryCurrent) AS [AverageBatteryCurrent],
        AVG (OutputVoltage) AS [AverageOutputVoltage],
        AVG (OutputCurrent) AS [AverageOutputCurrent],
        AVG(cast(PanelCurrent as float) * cast(BatteryVoltage as float) * 1.031) as [AveragePanelPower],
        AVG(cast(OutputVoltage as float) * cast(OutputCurrent as float)) as [AverageOutputPower]
     FROM data Stream
     GROUP BY DeviceId,Stream.EventEnqueuedUtcTime, TumblingWindow(Minute, 30)
),
FillInMissingValuesStep AS
(
      SELECT
            TopOne() OVER (ORDER BY tumblingWindowEnd DESC) AS lastEvent
     FROM AggregationStep
     GROUP BY HOPPINGWINDOW(Minute, 30, 5)
),

SelectingPanelOutputPower As(
select deviceid as DeviceId,OutputCurrent,Stream.EventEnqueuedUtcTime as [Time] from data Stream
where cast(OutputCurrent as float)>10
),

AnomalyDetectionStep AS
(
      SELECT
            lastEvent.DeviceId,
            lastEvent.tumblingWindowEnd as anomalyTime,
            system.timestamp as anomalyDetectedTime,
            lastEvent.AveragePanelVoltage as AveragePanelVoltage,
            ANOMALYDETECTION(lastEvent.AveragePanelVoltage) OVER (LIMIT DURATION(minute, 10)) as PVScores,
            lastEvent.AveragePanelCurrent as AveragePanelCurrent,
            ANOMALYDETECTION(lastEvent.AveragePanelCurrent) OVER (LIMIT DURATION(minute, 10)) as PCScores,
            lastEvent.AverageBatteryVoltage as AverageBatteryVoltage,
            ANOMALYDETECTION(lastEvent.AverageBatteryVoltage) OVER (LIMIT DURATION(minute, 10)) as BVScores,
            lastEvent.AverageBatteryCurrent as AverageBatteryCurrent,
            ANOMALYDETECTION(lastEvent.AverageBatteryCurrent) OVER (LIMIT DURATION(minute, 10)) as BCScores,
            lastEvent.AverageOutputVoltage as AverageOutputVoltage,
            ANOMALYDETECTION(lastEvent.AverageOutputVoltage) OVER (LIMIT DURATION(minute, 10)) as OVScores,
            lastEvent.AverageOutputCurrent as AverageOutputCurrent,
            ANOMALYDETECTION(lastEvent.AverageOutputCurrent) OVER (LIMIT DURATION(minute, 10)) as OCScores,
            lastEvent.AveragePanelPower as AveragePanelPower,
            ANOMALYDETECTION(lastEvent.AveragePanelPower) OVER (LIMIT DURATION(minute, 10)) as PPScores,
            lastEvent.AverageOutputPower as AverageOutputPower,
            ANOMALYDETECTION(lastEvent.AverageOutputPower) OVER (LIMIT DURATION(minute, 10)) as OPScores
      FROM FillInMissingValuesStep
),

OutputSet AS
(
    SELECT
      DeviceId,
      anomalyTime,
      anomalyDetectedTime,
      AveragePanelVoltage,
      CAST(GetRecordPropertyValue(PVScores, 'BiLevelChangeScore') as float) as [PV Bi Level Change],
      AveragePanelCurrent,
      CAST(GetRecordPropertyValue(PCScores, 'BiLevelChangeScore') as float) as [PC Bi Level Change],
      AverageBatteryVoltage,
      CAST(GetRecordPropertyValue(BVScores, 'BiLevelChangeScore') as float) as [BV Bi Level Change],
      CAST(GetRecordPropertyValue(BVScores, 'SlowNegTrendScore') as float) as [BV Slow Neg Trend Score],
      AverageBatteryCurrent,
      CAST(GetRecordPropertyValue(BCScores, 'BiLevelChangeScore') as float) as [BC Bi Level Change],
      AverageOutputVoltage,
      CAST(GetRecordPropertyValue(OVScores, 'BiLevelChangeScore') as float) as [OV Bi Level Change],
      AverageOutputCurrent,
      CAST(GetRecordPropertyValue(OCScores, 'BiLevelChangeScore') as float) as [OC Bi Level Change],
      AveragePanelPower,
      CAST(GetRecordPropertyValue(PPScores, 'BiLevelChangeScore') as float) as [PP Bi Level Change],
      AverageOutputPower,
      CAST(GetRecordPropertyValue(OPScores, 'BiLevelChangeScore') as float) as [OP Bi Level Change]
    FROM AnomalyDetectionStep
),
output AS(
SELECT
     DeviceId,
     'Panel Voltage Bi Level Change' as ReadingType,
     OutputSet.[PV Bi Level Change] as Reading,
     '3.25' as Threshold,
     'Panel Voltage Bi Level Change ' as RuleOutput,
     anomalyTime AS [Time]
FROM OutputSet
WHERE
     OutputSet.[PV Bi Level Change] IS NOT null AND OutputSet.[PV Bi Level Change] > 3.25
UNION ALL

SELECT
     DeviceId,
     'Panel Current Bi Level Change' as ReadingType,
     OutputSet.[PV Bi Level Change] as Reading,
     '3.25' as Threshold,
     'Panel Current Bi Level Change ' as RuleOutput,
     anomalyTime AS [Time]
FROM OutputSet
WHERE
     OutputSet.[PC Bi Level Change] IS NOT null AND OutputSet.[PC Bi Level Change] > 3.25
UNION ALL

SELECT
     DeviceId,
     'Battery Voltage Bi Level Change' as ReadingType,
     OutputSet.[BV Bi Level Change] as Reading,
     '3.25' as Threshold,
     'Battery Voltage Bi Level Change ' as RuleOutput,
     anomalyTime AS [Time]
FROM OutputSet
WHERE
     OutputSet.[BV Bi Level Change] IS NOT null AND OutputSet.[BV Bi Level Change] > 3.25
UNION ALL

SELECT
     DeviceId,
     'Battery Current Bi Level Change' as ReadingType,
     OutputSet.[BC Bi Level Change] as Reading,
     '3.25' as Threshold,
     'Battery Current Bi Level Change ' as RuleOutput,
     anomalyTime AS [Time]
FROM OutputSet
WHERE
     OutputSet.[BC Bi Level Change] IS NOT null AND OutputSet.[BC Bi Level Change] > 3.25
UNION ALL

SELECT
     DeviceId,
     'Battery Voltage Slow Neg Trend Score' as ReadingType,
     OutputSet.[BV Slow Neg Trend Score] as Reading,
     '3.25' as Threshold,
     'Battery Voltage Slow Neg Trend Score' as RuleOutput,
     anomalyTime AS [Time]
FROM OutputSet
WHERE
     OutputSet.[BV Slow Neg Trend Score] IS NOT null AND OutputSet.[BV Slow Neg Trend Score] > 3.25
UNION ALL

SELECT
     DeviceId,
     'Output Voltage Bi Level Change' as ReadingType,
     OutputSet.[OV Bi Level Change] as Reading,
     '3.25' as Threshold,
     'Output Voltage Bi Level Change' as RuleOutput,
     anomalyTime AS [Time]
FROM OutputSet
WHERE
     OutputSet.[OV Bi Level Change] IS NOT null AND OutputSet.[OV Bi Level Change] > 3.25
UNION ALL

SELECT
     DeviceId,
     'Output Current Bi Level Change' as ReadingType,
     OutputSet.[OC Bi Level Change] as Reading,
     '3.25' as Threshold,
     'Output Current Bi Level Change' as RuleOutput,
     anomalyTime AS [Time]
FROM OutputSet
WHERE
     OutputSet.[OC Bi Level Change] IS NOT null AND OutputSet.[OC Bi Level Change] > 3.25
UNION ALL

SELECT
     DeviceId,
     'Output Power Bi Level Change' as ReadingType,
     OutputSet.[OP Bi Level Change] as Reading,
     '3.25' as Threshold,
     'Output Power Bi Level Change' as RuleOutput,
     anomalyTime AS [Time]
FROM OutputSet
WHERE
     OutputSet.[OP Bi Level Change] IS NOT null AND OutputSet.[OP Bi Level Change] > 3.25
UNION ALL

SELECT
     DeviceId,
     'Panel Power Bi Level Change' as ReadingType,
     OutputSet.[PP Bi Level Change] as Reading,
     '3.25' as Threshold,
     'Panel Power Bi Level Change' as RuleOutput,
     anomalyTime AS [Time]
FROM OutputSet
--WHERE
  --   OutputSet.[PP Bi Level Change] IS NOT null AND OutputSet.[PP Bi Level Change] > 3.25
UNION ALL

SELECT
     DeviceId,
     'Output Current' as ReadingType,
     OutputCurrent as Reading,
     '10' as Threshold,
     'Output Current' as RuleOutput,
     [Time]
FROM SelectingPanelOutputPower
)

--select * into opt from output

SELECT *
INTO DeviceRulesMonitoring
FROM output

SELECT *
INTO DeviceRulesHub
FROM output

在测试时会给出正确的结果.但是当我启动Stream Analytics时,它显示错误"Stream Analytics作业具有验证错误:该作业将超过Event Hub接收器的最大数量."

While testing it is giving proper results. But when i starts the Stream Analytics, it is showing the error "Stream Analytics job has validation errors: Job will exceed the maximum amount of Event Hub Receivers."


推荐答案

能否请您遵循本文档中提到的这些最佳做法:
Can you please follow these best practices mentioned in this document: https://docs.microsoft.com/en-us/azure/stream-analytics/stream-analytics-event-hub-consumer-groups to avoid this error. For performance reasons, stream analytics may use multiple receivers. You can avoid this error by following the best practices mentioned in the above link.


这篇关于Stream Analytics作业具有验证错误:作业将超过事件中心接收器的最大数量.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆