Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
658 views
in Technique[技术] by (71.8m points)

timestamp - Azure Stream Analytics - LAG function works fine on test, but not on query

I have the following query:

WITH currentVector AS (
SELECT 
    UnitId, [Read], ReadTime,
    --If it is the first read in the last 6 days
    CASE
        WHEN LAG(UnitId) OVER (PARTITION BY UnitId LIMIT DURATION(day, 6)) IS NULL 
        THEN 1 ELSE 0 END [IsFirstRead], 
FROM IoTServerEventHub
TIMESTAMP BY ReadTime
) 

SELECT 
    UnitId, [Read], ReadTime,
    CASE 
        WHEN [IsFirstRead] = 0 
        THEN 1
        ELSE 0
    END IsValid
INTO DestinationEventHub
FROM currentVector

When I test this query in Azure portal - it works fine. If I have 2 reads and ReadTime is more than 6 days between them (even more than 1 year between one read and the next read) - both reads are marked as "first in 6 days". But, when I run this query in production - the first read is marked as first, but the second read is marked as not first, although more than 6 days separate between them, and timestamp is by ReadTime and not by System.

Any reason why?

Thanks!

question from:https://stackoverflow.com/questions/65864894/azure-stream-analytics-lag-function-works-fine-on-test-but-not-on-query

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...