influxdata / influxdata/influxdb
Flux metaquery causes "invalid memory address or nil pointer dereference"
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
If I run this query in cloud, I get a panic:
import "influxdata/influxdb/schema"
import "strings"
bucket = "apps"
schema.tagValues(bucket: bucket, tag: "_measurement")
|> map(fn: (r) => {
meas = r._value
fields = schema.fieldKeys(bucket: bucket, predicate: (r) => r._measurement == meas) |> findColumn(column: "_value", fn: (key) => true)
joinedFields = strings.joinStr(arr: fields, v: ", ")
tags = schema.tagKeys(bucket: bucket, predicate: (r) => r._measurement == meas)
|> filter(fn: (r) => r._value != "_start" and r._value != "_stop" and r._value != "_measurement" and r._value != "_field")
|> findColumn(column: "_value", fn: (key) => true)
joinedTags = strings.joinStr(arr: tags, v: ", ")
return {measurement: r._value, fields: joinedFields, tags: joinedTags}
})
|> group(columns: ["measurement"])
I get this panic: runtime error: invalid memory address or nil pointer dereference
It seems to work for some buckets, but not for others.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the supplied Flux query in a bucket where it panics and comparing it with a bucket where it succeeds. Focus on the nested schema.tagValues, schema.fieldKeys, schema.tagKeys, findColumn, and strings.joinStr calls, then inspect the resulting panic details. Done means the query no longer produces an invalid memory address or nil pointer dereference for affected buckets.
Written by the indexing model from the issue text.
Assessment
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100