Я пытаюсь написать запрос в ASA (Azure поток Analytics), где вход является сообщение JSON строка, которая выглядит как этотРабота с аналитикой потока имеет ошибки проверки: работа превысит максимальное количество приемников концентраторов событий.
{
"DeviceId": "Device3",
"DateTime": "2016-09-05T13:23:04.5444423",
"Value": [ 1, 0, 1, 0, 0, 1, 0 ]
}
И то, что я хочу сделать, это выполнить UNPIVOT так приходит данные по форме
create table LightBeacon (
DeviceId int primary key not null,
EventDateTime datetime not null,
LightBeaconId varchar(25) not null,
LightBeaconState SmallInt not null
)
Но кажется, что ASA не поддерживает функцию SQL UNPIVOT и там оставили с несколькими отборных заявлений как
with
DataUnArray as (
SELECT DeviceId, DateTime as EventDateTime
, GetArrayElement(Value, 0) as LigthBeacon01
, GetArrayElement(Value, 1) as LigthBeacon02
, GetArrayElement(Value, 2) as LigthBeacon03
, GetArrayElement(Value, 3) as LigthBeacon04
, GetArrayElement(Value, 4) as LigthBeacon05
, GetArrayElement(Value, 5) as LigthBeacon06
, GetArrayElement(Value, 6) as LigthBeacon07
FROM DataIoT
where DeviceId = 'Device3'),
DataUnpivot as (
select DeviceId, EventDateTime, 'LigthBeacon01' as LigthBeaconId, LigthBeacon01 as LigthBeaconState from DataUnArray
Union All select DeviceId, EventDateTime, 'LigthBeacon02' as LigthBeaconId, LigthBeacon02 as LigthBeaconState from DataUnArray
Union All select DeviceId, EventDateTime, 'LigthBeacon03' as LigthBeaconId, LigthBeacon03 as LigthBeaconState from DataUnArray
Union All select DeviceId, EventDateTime, 'LigthBeacon04' as LigthBeaconId, LigthBeacon04 as LigthBeaconState from DataUnArray
Union All select DeviceId, EventDateTime, 'LigthBeacon05' as LigthBeaconId, LigthBeacon05 as LigthBeaconState from DataUnArray
Union All select DeviceId, EventDateTime, 'LigthBeacon06' as LigthBeaconId, LigthBeacon06 as LigthBeaconState from DataUnArray
Union All select DeviceId, EventDateTime, 'LigthBeacon07' as LigthBeaconId, LigthBeacon07 as LigthBeaconState from DataUnArray
)
select DeviceId, EventDateTime, LigthBeaconId, LigthBeaconState
into DataLakeCSV
from DataUnpivot
АС Query не удается начать со следующей ошибкой:
Stream Analytics job has validation errors: Job will exceed the maximum amount of Event Hub Receivers
Если я уменьшить его до 5 маяка - это работает !!! Итак, как я могу написать запрос ASA, который может обрабатывать более 5 столбцов в univot?
\ Bjørn
Это Работает - идеально. Я переписал код с помощью GetArrayElements, который сделал его простым и даже более мощным. –