refactor(query/influxql): use ast compile function from flux (#11749)
parent
8b20b52f51
commit
204d919a92
2
go.mod
2
go.mod
|
@ -61,7 +61,7 @@ require (
|
|||
github.com/hashicorp/vault v0.11.5
|
||||
github.com/hashicorp/vault-plugin-secrets-kv v0.0.0-20181106190520-2236f141171e // indirect
|
||||
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
|
||||
github.com/influxdata/flux v0.17.1-0.20190205175833-b620e9e516e0
|
||||
github.com/influxdata/flux v0.17.1-0.20190206222814-dd6fe23672b0
|
||||
github.com/influxdata/influxql v0.0.0-20180925231337-1cbfca8e56b6
|
||||
github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368
|
||||
github.com/jefferai/jsonx v0.0.0-20160721235117-9cc31c3135ee // indirect
|
||||
|
|
4
go.sum
4
go.sum
|
@ -222,8 +222,8 @@ github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28=
|
|||
github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/influxdata/flux v0.17.1-0.20190205175833-b620e9e516e0 h1:c873bPxIBoueJLsPebzIaHVdCkCcqsXiwRBjXyYkpwk=
|
||||
github.com/influxdata/flux v0.17.1-0.20190205175833-b620e9e516e0/go.mod h1:0f5Yrm4VPSd/Ne6jIVOVtPo0MFe6jpLCr6vdaZYp7wY=
|
||||
github.com/influxdata/flux v0.17.1-0.20190206222814-dd6fe23672b0 h1:p9URQhkT1GG4vMdKjg2f9IhJqg/swNx+gFwrmbCBFmQ=
|
||||
github.com/influxdata/flux v0.17.1-0.20190206222814-dd6fe23672b0/go.mod h1:0f5Yrm4VPSd/Ne6jIVOVtPo0MFe6jpLCr6vdaZYp7wY=
|
||||
github.com/influxdata/goreleaser v0.97.0-influx/go.mod h1:MnjA0e0Uq6ISqjG1WxxMAl+3VS1QYjILSWVnMYDxasE=
|
||||
github.com/influxdata/influxql v0.0.0-20180925231337-1cbfca8e56b6 h1:CFx+pP90q/qg3spoiZjf8donE4WpAdjeJfPOcoNqkWo=
|
||||
github.com/influxdata/influxql v0.0.0-20180925231337-1cbfca8e56b6/go.mod h1:KpVI7okXjK6PRi3Z5B+mtKZli+R1DnZgb3N+tzevNgo=
|
||||
|
|
|
@ -5,8 +5,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/influxdata/flux"
|
||||
"github.com/influxdata/flux/interpreter"
|
||||
"github.com/influxdata/flux/semantic"
|
||||
platform "github.com/influxdata/influxdb"
|
||||
)
|
||||
|
||||
|
@ -57,25 +55,7 @@ func (c *Compiler) Compile(ctx context.Context) (*flux.Spec, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
semPkg, err := semantic.New(astPkg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
itrp := interpreter.NewInterpreter()
|
||||
universe := flux.Prelude()
|
||||
|
||||
sideEffects, err := itrp.Eval(semPkg, universe, flux.StdLib())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
spec, err := flux.ToSpec(sideEffects, now)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return spec, nil
|
||||
return flux.CompileAST(ctx, astPkg, now)
|
||||
}
|
||||
func (c *Compiler) CompilerType() flux.CompilerType {
|
||||
return CompilerType
|
||||
|
|
Loading…
Reference in New Issue