I just created an Azure Stream Analytics job and configured the Inputs and Outputs, and this Stream Analytics job is taking Azure IoT hub as the Input which receives the data from an Azure IoT Dev Kit MXChip. But I am getting an error in the Input job topology details as below.
[4:10:13 PM] Fields referenced in query not found in input events
Fields Expected: TIME
Fields found: MESSAGEID, HUMIDITY
Missing fields: TIME
Below is my query.
WITH BasicOutput AS
(
SELECT
messageId,
System.TIMESTAMP AS TIME,
deviceId,
temperature,
humidity,
pressure,
pointInfo,
IoTHub,
EventEnqueuedUtcTime,
EventProcessedUtcTime,
PartitionId,
count(*) AS Count
FROM
Input TIMESTAMP By TIME
GROUP BY TUMBLINGWINDOW(minute, 2),
messageId,
deviceId,
temperature,
humidity,
pressure,
pointInfo,
IoTHub,
EventEnqueuedUtcTime,
EventProcessedUtcTime,
PartitionId
)
SELECT * INTO SQLServerOutput FROM BasicOutput
SELECT * INTO AzureFunctionOutput FROM BasicOutput
Have you ever faced this issue? Any help is really appreciated.
I just did some search in Google and find out this document. After reading the same I updated my query as follows.
WITH BasicOutput AS
(
SELECT
messageId,
deviceId,
temperature,
humidity,
pressure,
pointInfo,
IoTHub,
EventEnqueuedUtcTime,
EventProcessedUtcTime,
PartitionId,
COUNT(*) AS Count
FROM
Input TIMESTAMP By EventEnqueuedUtcTime
GROUP BY TUMBLINGWINDOW(second, 2),
messageId,
deviceId,
temperature,
humidity,
pressure,
pointInfo,
IoTHub,
EventEnqueuedUtcTime,
EventProcessedUtcTime,
PartitionId
)
SELECT * INTO SQLServerOutput FROM BasicOutput
SELECT * INTO AzureFunctionOutput FROM BasicOutput
I removed the System.TIMESTAMP AS TIME,
from my select and add TIMESTAMP By EventEnqueuedUtcTime
. It started working after this change.