Replies: 2 comments 3 replies
-
Based on my understanding of your request, there are two main criteria. First, for each window of 21 data points, if the speed value in the 11th data point is different from that in the 10th data point, the entire window of 21 data points needs to be outputted. Second, when the total number of data points is less than 21, for each window of 14 data points, if the speed value in the fourth data point is different from that in the third data point, the entire window of 14 data points needs to be outputted. |
Beta Was this translation helpful? Give feedback.
-
For the first solution above, which is to use additional rules, I think your sql statement could be written like this:
|
Beta Was this translation helpful? Give feedback.
-
Hello,
Is it possible for this SQL statement:
(1)
select * from demo GROUP BY COUNTWINDOW(14,1) HAVING COLLECT(speed)[3]- COLLECT(speed)[2] !=0
To only capture the first event triggered?
Referring to SQL statement below:
(2)
select * from demo GROUP BY COUNTWINDOW(21,1) HAVING COLLECT(speed)[10]- COLLECT(speed)[9] !=0
This sql statement will capture data if like the stream is as below:
The yellow will be captured as there is a speed change in event 1
Because of the size of the countwindow, the following below won't be captured. The speed change happens at event 3(too early)
Is it possible for this SQL statement to be modified to also catch the scenario where there is a speed change, but it occurs too early and there is not enough data points for it to work with 'GROUP BY COUNTWINDOW(21,1)'
One solution I had is to use additional rules and sql statements, like the first one I had mentioned.
With this SQL statement I could use to help(would also need other sql statements:
(1)
select * from demo GROUP BY COUNTWINDOW(14,1) HAVING COLLECT(speed)[3]- COLLECT(speed)[2] !=0
The issue for me, is that it will continue to capture events. I would only need it to capture the first. Then it should stop functioning.
Second solution Another would be if I could combine, one or more sql statements in the same rule.
Could I combine the following:
(1)
select * from demo GROUP BY COUNTWINDOW(14,1) HAVING COLLECT(speed)[3]- COLLECT(speed)[2] !=0 (with this sql only capturing the first event that is triggered)
And
(2)
select * from demo GROUP BY COUNTWINDOW(21,1) HAVING COLLECT(speed)[10]- COLLECT(speed)[9] !=0
Therefore, I would be hoping I could capture data points from a stream as such below
Yellow highlight is what would get captured, first section captured would come from (1) SQL statement
And next section captured would come from (2) SQL statement.
Beta Was this translation helpful? Give feedback.
All reactions