I was noticing some weird results with the bracket queries in Mr. Plotter, so I investigated. This led me to make the following queries against BTrDB in a certain production cluster (details communicated to @immesys offline):
The stream bdff2d37-9f9d-553a-8f2d-e8240e48c622 is a stream with data, and things work as expected.
The stream 3c122dcf-c0ff-5da0-bf4b-31b4309ef446 exists but has no data. For this stream, the nearest queries always return the point (time = 0, value = 0) even if it's an invalid answer for the query at hand.
The same behavior actually happens if there is no valid "nearest" point (e.g., no points after that timestamp)
This is bad because if I make a nearest query at a negative timestamp, I can't tell from the answer (0, 0) whether there was actually no data after that time, or whether the point is at (0, 0). I suggest that you revise the API by returning an error, rather than returning (0, 0). Alternatively, you could choose to return a point outside of the valid range to signal an error, or add a "no such point" flag to the returned protobuf.
I was noticing some weird results with the bracket queries in Mr. Plotter, so I investigated. This led me to make the following queries against BTrDB in a certain production cluster (details communicated to @immesys offline):
The stream bdff2d37-9f9d-553a-8f2d-e8240e48c622 is a stream with data, and things work as expected.
The stream 3c122dcf-c0ff-5da0-bf4b-31b4309ef446 exists but has no data. For this stream, the nearest queries always return the point (time = 0, value = 0) even if it's an invalid answer for the query at hand.
The same behavior actually happens if there is no valid "nearest" point (e.g., no points after that timestamp)
This is bad because if I make a nearest query at a negative timestamp, I can't tell from the answer (0, 0) whether there was actually no data after that time, or whether the point is at (0, 0). I suggest that you revise the API by returning an error, rather than returning (0, 0). Alternatively, you could choose to return a point outside of the valid range to signal an error, or add a "no such point" flag to the returned protobuf.