Flux query does not return results if wider time range is selected

Hi,
We are facing some issue with influxdb flux query,
whenever we query the bucket and the time range selected is for example: past 7d
I get the query results, but when I select past 30d there is no result from query.
As past 7d query shows the data, this data should also be a part of the last 30d .
influxdb version: v2.7.1
The query that we used is :
import “influxdata/influxdb/schema”
from(bucket: “test”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“message_id”] == “msg_01”)
|> schema.fieldsAsCols()
|> yield()

Hello @FaizPatel,
Welcome!
Can you please share a screen shot of the output of the 7 day and the 30 day query please?
And any error messages?
You’re right that doesn’t make any sense.

Hi @Anaisdg , attached both query screenshots.


Hi @Anaisdg Any update ?

Hello @FaizPatel,
I apologize for the delay. I was out of office for the last week. I appreciate your patience.
Well that doesn’t make any sense does it. I can’t see anything that you’re doing wrong. Are you able to query for data without the fieldsAscols? Very strange behavior. I haven’t seen that before. Are you sure there isn’t a typo in your filters? I imagine you checked for that already (and are just changing the drop down), but that’s my best bet.
@scott have you ever seen something like this?

I haven’t seen this before. Something else I’d do just to rule it out is to update InfluxDB to the latest version (2.7.6). This is weird behavior. I’m curios, have you tried running these queries against the raw query API? If you do, you’ll need to replace the dashboard variable timestamps replaced with scalar time stamps.

1 Like

Hi @scott

  • updating to the latest version also didn’t solve the issue

  • I did not get what do you mean by raw query API, can you please clarify that and how we can check it ?

  • There was a change in datatype in one of the fields, we had read in one of the posts that change in datatype might cause such issue.

    • we tried deleting the points where there was a change in datatype, still the query has the same issue.
    • We tried overwriting those points but couldn’t as it gave field type conflict.

Instead of using the InfluxDB UI, try using the InfluxDB HTTP query API directly. I’m wondering if the UI is suppressing an error or if results are being returned that the UI doesn’t fully understand how to parse.

This could cause this issue, but the query should return an error. That’s why I suggest querying the HTTP API instead of using the InfluxDB UI. I think the UI may be suppressing an error.

@scott we tried running the same queries with the Raw query API

Ok, thanks for this :point_up:. These are great details. Can you successfully query data up to the point where it changed type as well? If you can, but a query range that should return both types doesn’t return anything, I think the typing is the cause of the problem. If that’s the case, this would be worth creating an issue on the InfluxDB GitHub repo.

Hi @scott , we can query data upto the point where it changes the datatype,
I have created an issue on github .
query doesn’t return result / returns partial result, when there is change in datatype of a field in that time range. · Issue #24938 · influxdata/influxdb (github.com)