influxdata / flux

Flux is a lightweight scripting language for querying databases (like InfluxDB) and working with data. It's part of InfluxDB 1.7 and 2.0, but can be run independently of those.
https://influxdata.com
MIT License
769 stars 153 forks source link

"missing table ID" error with Flux query #628

Closed wolffcm closed 1 month ago

wolffcm commented 5 years ago

Running flux in the platform REPL, I get an error missing table ID with a particular query:

> from(bucket: "telegraf")
|> range(start: -20s)
|> filter(fn: (r) => r._measurement == "cpu" and r._field == "usage_user")
|> yield(name: "1")
|> group(columns: ["cpu"])
Result: 1
Error: missing table ID

Interestingly the error seems to go away when I change the yield name to something else, like "foo".

It seems to be related to how we encode the result on the server side, in particular we seem to explicitly omit the table ID here: https://github.com/influxdata/flux/blob/master/csv/result.go#L903

However, if I update that logic to always set the table ID, I see a different error,

Result: 1
Error: missing value for group key column "_start"
affo commented 5 years ago

I was working on it, but I have to stop now.
I only report the trace I get when submitting that query:

csv encoder error: write tcp [::1]:9999->[::1]:62732: write: broken pipe", "errorVerbose": "write tcp [::1]:9999->[::1]:62732: write: broken pipe
csv encoder error
github.com/influxdata/flux/csv.wrapEncodingError
    /Users/lorenzoaffetti/code/influxdata/platform/vendor/github.com/influxdata/flux/csv/result.go:754
github.com/influxdata/flux/csv.(*ResultEncoder).Encode.func1
    /Users/lorenzoaffetti/code/influxdata/platform/vendor/github.com/influxdata/flux/csv/result.go:830
github.com/influxdata/flux/execute.(*result).Do
    /Users/lorenzoaffetti/code/influxdata/platform/vendor/github.com/influxdata/flux/execute/result.go:74
github.com/influxdata/flux/csv.(*ResultEncoder).Encode
    /Users/lorenzoaffetti/code/influxdata/platform/vendor/github.com/influxdata/flux/csv/result.go:771
github.com/influxdata/flux.(*DelimitedMultiResultEncoder).Encode
    /Users/lorenzoaffetti/code/influxdata/platform/vendor/github.com/influxdata/flux/result.go:217
github.com/influxdata/platform/query.ProxyQueryServiceBridge.Query
    /Users/lorenzoaffetti/code/influxdata/platform/query/bridges.go:47
github.com/influxdata/platform/query.(*ProxyQueryServiceBridge).Query
    <autogenerated>:1
github.com/influxdata/platform/http.(*FluxHandler).handlePostQuery
    /Users/lorenzoaffetti/code/influxdata/platform/http/query_handler.go:82
github.com/influxdata/platform/http.(*FluxHandler).handlePostQuery-fm
    /Users/lorenzoaffetti/code/influxdata/platform/http/query_handler.go:51
net/http.HandlerFunc.ServeHTTP
    /usr/local/Cellar/go/1.11.2/libexec/src/net/http/server.go:1964
github.com/julienschmidt/httprouter.(*Router).Handler.func1
    /Users/lorenzoaffetti/code/influxdata/platform/vendor/github.com/julienschmidt/httprouter/params_go17.go:26
github.com/julienschmidt/httprouter.(*Router).ServeHTTP
    /Users/lorenzoaffetti/code/influxdata/platform/vendor/github.com/julienschmidt/httprouter/router.go:334
github.com/influxdata/platform/http.(*APIHandler).ServeHTTP
    /Users/lorenzoaffetti/code/influxdata/platform/http/api_handler.go:207
github.com/influxdata/platform/http.(*AuthenticationHandler).ServeHTTP
    /Users/lorenzoaffetti/code/influxdata/platform/http/authentication_middleware.go:90
github.com/influxdata/platform/http.(*PlatformHandler).ServeHTTP
    /Users/lorenzoaffetti/code/influxdata/platform/http/platform_handler.go:59
github.com/influxdata/platform/http.(*Handler).ServeHTTP
    /Users/lorenzoaffetti/code/influxdata/platform/http/handler.go:166
net/http.serverHandler.ServeHTTP
    /usr/local/Cellar/go/1.11.2/libexec/src/net/http/server.go:2741
net/http.(*conn).serve
    /usr/local/Cellar/go/1.11.2/libexec/src/net/http/server.go:1847
runtime.goexit
    /usr/local/Cellar/go/1.11.2/libexec/src/runtime/asm_amd64.s:1333

My flux is pointing at master.

github-actions[bot] commented 1 month ago

This issue has had no recent activity and will be closed soon.