My goal is to create a SWQL query to pull the # of clients over time and I keep getting divide by zero errors. After doing some troubleshooting, it turns out DOWNSAMPLE is causing the errors. Here's the SWQL query I was using:
SELECT DOWNSAMPLE(HAP.ObservationTimestamp) AS time, SUM(HAP.Clients) AS Clients FROM Orion.Packages.Wireless.HistoricalAccessPoints HAP WHERE HAP.ObservationTimestamp BETWEEN '2021-01-27T16:51:45.447Z' AND '2021-01-29T16:51:45.447Z' GROUP BY HAP.ObservationTimestamp ORDER BY HAP.ObservationTimestamp ASC;
Here's an example of the output after removing DOWNSAMPLE function:
2021-01-27 11:54:59.03 | 0 |
2021-01-27 11:55:01.03 | 0 |
2021-01-27 11:55:01.06 | 0 |
2021-01-27 11:55:03.327 | 0 |
2021-01-27 11:55:03.42 | 0 |
2021-01-27 11:55:03.513 | 0 |
2021-01-27 11:55:03.967 | 1 |
2021-01-27 11:55:05 | 0 |
2021-01-27 11:55:05.06 | 0 |
2021-01-27 11:55:05.107 | 0 |
2021-01-27 11:55:05.343 | 0 |
2021-01-27 11:55:05.517 | 0 |
2021-01-27 11:55:06.093 | 0 |
2021-01-27 11:55:06.373 | 0 |
2021-01-27 11:55:07.58 | 0 |
I noticed that on 2021-01-27 11:55:05, it doesn't have the .### value in the timestamp. Could this be the issue that's causing DOWNSAMPLE to throw divide by zero errors? Is this a potential bug?
I was going to submit an issue via Github but it wouldn't let me due to not making any contributions to the Orion SDK... Any suggestions on what I should to in the meaning time?