diff --git a/cli/lakeflags/flags.go b/cli/lakeflags/flags.go index 7109c834d8..a5e49504da 100644 --- a/cli/lakeflags/flags.go +++ b/cli/lakeflags/flags.go @@ -75,7 +75,7 @@ func (l *Flags) Open(ctx context.Context) (api.Interface, error) { } lk, err := api.OpenLocalLake(ctx, zap.Must(zap.NewProduction()), uri.String()) if errors.Is(err, lake.ErrNotExist) { - return nil, fmt.Errorf("%w\n(hint: run 'zed init' to initialize lake at this location)", err) + return nil, fmt.Errorf("%w\n(hint: run 'super db init' to initialize lake at this location)", err) } return lk, err } diff --git a/cmd/super/compile/command.go b/cmd/super/compile/command.go new file mode 100644 index 0000000000..c399d91824 --- /dev/null +++ b/cmd/super/compile/command.go @@ -0,0 +1,59 @@ +package compile + +import ( + "flag" + + "github.com/brimdata/super/cmd/super/root" + "github.com/brimdata/super/pkg/charm" +) + +var spec = &charm.Spec{ + Name: "compile", + Usage: "compile [ options ] spq|sql", + Short: "compile a local query for inspection and debugging", + Long: ` +This command parses a query and emits the resulting abstract syntax +tree (AST) or runtime directed acyclic graph (DAG) in the output format desired. +Use "-dag" to specify the DAG form; otherwise, the AST form is assumed. + +The query text may be either SQL or SPQ. To force parsing as SQL, +use the "-sql" flag. + +The "-C" option causes the output to be shown as query language source +instead of the AST. This is particularly helpful to see how SQP queries +in their abbreviated form are translated into the exanded, pedantic form +of piped SQL. The DAG can also be formatted as query-style text +but the resulting text is informational only and does not conform to +any query syntax. When "-C" is specified, the result is sent to stdout +and the "-f" and "-o" options have no effect. + +This command is often used for dev and test but +is also useful to advanced users for understanding how SQL and SPQ syntax is +parsed into an AST or compiled into a runtime DAG. +`, + New: New, +} + +func init() { + root.Super.Add(spec) +} + +type Command struct { + *root.Command + shared Shared +} + +func New(parent charm.Command, f *flag.FlagSet) (charm.Command, error) { + c := &Command{Command: parent.(*root.Command)} + c.shared.SetFlags(f) + return c, nil +} + +func (c *Command) Run(args []string) error { + ctx, cleanup, err := c.Init(&c.shared.OutputFlags) + if err != nil { + return err + } + defer cleanup() + return c.shared.Run(ctx, args, nil, false) +} diff --git a/cmd/super/compile/shared.go b/cmd/super/compile/shared.go new file mode 100644 index 0000000000..dab65aba51 --- /dev/null +++ b/cmd/super/compile/shared.go @@ -0,0 +1,126 @@ +package compile + +import ( + "context" + "errors" + "flag" + "fmt" + + "github.com/brimdata/super" + "github.com/brimdata/super/cli/lakeflags" + "github.com/brimdata/super/cli/outputflags" + "github.com/brimdata/super/cli/queryflags" + "github.com/brimdata/super/compiler" + "github.com/brimdata/super/compiler/data" + "github.com/brimdata/super/compiler/describe" + "github.com/brimdata/super/compiler/parser" + "github.com/brimdata/super/lake" + "github.com/brimdata/super/pkg/storage" + "github.com/brimdata/super/runtime" + "github.com/brimdata/super/zbuf" + "github.com/brimdata/super/zfmt" + "github.com/brimdata/super/zio" + "github.com/brimdata/super/zson" +) + +type Shared struct { + dag bool + includes queryflags.Includes + optimize bool + parallel int + query bool + sql bool + OutputFlags outputflags.Flags +} + +func (s *Shared) SetFlags(fs *flag.FlagSet) { + fs.BoolVar(&s.dag, "dag", false, "display output as DAG (implied by -O or -P)") + fs.Var(&s.includes, "I", "source file containing query text (may be repeated)") + fs.BoolVar(&s.optimize, "O", false, "display optimized DAG") + fs.IntVar(&s.parallel, "P", 0, "display parallelized DAG") + fs.BoolVar(&s.query, "C", false, "display DAG or AST as query text") + fs.BoolVar(&s.sql, "sql", false, "force a strict SQL intepretation of the query text") + s.OutputFlags.SetFlags(fs) +} + +func (s *Shared) Run(ctx context.Context, args []string, lakeFlags *lakeflags.Flags, desc bool) error { + if len(s.includes) == 0 && len(args) == 0 { + return errors.New("no query specified") + } + if len(args) > 1 { + return errors.New("too many arguments") + } + var lk *lake.Root + if lakeFlags != nil { + lakeAPI, err := lakeFlags.Open(ctx) + if err != nil { + return err + } + lk = lakeAPI.Root() + } + var query string + if len(args) == 1 { + query = args[0] + } + seq, sset, err := compiler.Parse(query, s.includes...) + if err != nil { + return err + } + if s.optimize || s.parallel > 0 || desc { + s.dag = true + } + if !s.dag { + if s.query { + fmt.Println(zfmt.AST(seq)) + return nil + } + return s.writeValue(ctx, seq) + } + runtime, err := compiler.NewJob(runtime.DefaultContext(), seq, data.NewSource(nil, lk), nil) + if err != nil { + if list, ok := err.(parser.ErrorList); ok { + list.SetSourceSet(sset) + } + return err + } + if desc { + description, err := describe.AnalyzeDAG(ctx, runtime.Entry(), data.NewSource(nil, lk), nil) + if err != nil { + return err + } + return s.writeValue(ctx, description) + } + if s.parallel > 0 { + if err := runtime.Optimize(); err != nil { + return err + } + if err := runtime.Parallelize(s.parallel); err != nil { + return err + } + } else if s.optimize { + if err := runtime.Optimize(); err != nil { + return err + } + } + if s.query { + fmt.Println(zfmt.DAG(runtime.Entry())) + return nil + } + return s.writeValue(ctx, runtime.Entry()) +} + +func (s *Shared) writeValue(ctx context.Context, v any) error { + val, err := zson.MarshalZNG(v) + if err != nil { + return err + } + writer, err := s.OutputFlags.Open(ctx, storage.NewLocalEngine()) + if err != nil { + return err + } + err = zio.CopyWithContext(ctx, writer, zbuf.NewArray([]super.Value{val})) + if closeErr := writer.Close(); err == nil { + err = closeErr + } + return err +} diff --git a/cmd/super/db/auth/command.go b/cmd/super/db/auth/command.go index dc187cf91b..d0e7f938a0 100644 --- a/cmd/super/db/auth/command.go +++ b/cmd/super/db/auth/command.go @@ -33,5 +33,5 @@ func New(parent charm.Command, f *flag.FlagSet) (charm.Command, error) { } func (c *Command) Run(args []string) error { - return charm.ErrNoRun + return charm.NoRun(args) } diff --git a/cmd/super/db/command.go b/cmd/super/db/command.go index a5580535d8..a36fe74c74 100644 --- a/cmd/super/db/command.go +++ b/cmd/super/db/command.go @@ -34,14 +34,5 @@ func New(parent charm.Command, f *flag.FlagSet) (charm.Command, error) { } func (c *Command) Run(args []string) error { - //XXX - _, cancel, err := c.Init() - if err != nil { - return err - } - defer cancel() - if len(args) == 0 { - return charm.NeedHelp - } - return charm.ErrNoRun + return charm.NoRun(args) } diff --git a/cmd/super/db/compile/command.go b/cmd/super/db/compile/command.go new file mode 100644 index 0000000000..1a7d1a6a32 --- /dev/null +++ b/cmd/super/db/compile/command.go @@ -0,0 +1,51 @@ +package compile + +import ( + "flag" + + "github.com/brimdata/super/cmd/super/compile" + "github.com/brimdata/super/cmd/super/db" + "github.com/brimdata/super/pkg/charm" +) + +var spec = &charm.Spec{ + Name: "compile", + Usage: "compile [ options ] spq|sql", + Short: "compile a lake query for inspection and debugging", + Long: ` +The "super db compile" command is just like the "super compile" command except +it compiles the query for a SuperDB data lake instead of a local file system. +The primary difference here is that "from" operators on a lake work with data +stored in the lake whereas "from" operators on file system work with local files. +In both cases, "from" can also retrieve data from HTTP APIs via URL. + +See the "super compile" command help for futher information. +`, + New: New, +} + +func init() { + db.Spec.Add(spec) +} + +type Command struct { + parent *db.Command + shared compile.Shared + describe bool +} + +func New(parent charm.Command, f *flag.FlagSet) (charm.Command, error) { + c := &Command{parent: parent.(*db.Command)} + c.shared.SetFlags(f) + f.BoolVar(&c.describe, "describe", false, "emit describe endpoint results for this query") + return c, nil +} + +func (c *Command) Run(args []string) error { + ctx, cleanup, err := c.parent.Init(&c.shared.OutputFlags) + if err != nil { + return err + } + defer cleanup() + return c.shared.Run(ctx, args, &c.parent.LakeFlags, c.describe) +} diff --git a/cmd/super/db/vector/command.go b/cmd/super/db/vector/command.go index 7bb5c8ea88..fcacf2799d 100644 --- a/cmd/super/db/vector/command.go +++ b/cmd/super/db/vector/command.go @@ -33,8 +33,5 @@ func New(parent charm.Command, f *flag.FlagSet) (charm.Command, error) { } func (c *Command) Run(args []string) error { - if len(args) == 0 { - return charm.NeedHelp - } - return charm.ErrNoRun + return charm.NoRun(args) } diff --git a/cmd/super/db/ztests/init-hint.yaml b/cmd/super/db/ztests/init-hint.yaml index 9a15b6d129..0483d2cb31 100644 --- a/cmd/super/db/ztests/init-hint.yaml +++ b/cmd/super/db/ztests/init-hint.yaml @@ -1,10 +1,10 @@ script: | - ! super db -lake=path/to/zed ls + ! super db -lake=path/to/superdb ls outputs: - name: stderr regexp: | .* lake does not exist - \(hint: run 'zed init' to initialize lake at this location\) + \(hint: run 'super db init' to initialize lake at this location\) - name: stdout data: "" diff --git a/cmd/super/dev/command.go b/cmd/super/dev/command.go index dabc0f92d7..da692b3c57 100644 --- a/cmd/super/dev/command.go +++ b/cmd/super/dev/command.go @@ -17,10 +17,18 @@ prints the list of known dev tools.`, New: New, } +type Command struct { + *root.Command +} + func init() { root.Super.Add(Spec) } func New(parent charm.Command, f *flag.FlagSet) (charm.Command, error) { - return parent.(*root.Command), nil + return &Command{Command: parent.(*root.Command)}, nil +} + +func (c *Command) Run(args []string) error { + return charm.NoRun(args) } diff --git a/cmd/super/dev/compile/command.go b/cmd/super/dev/compile/command.go deleted file mode 100644 index a4c84ff6e7..0000000000 --- a/cmd/super/dev/compile/command.go +++ /dev/null @@ -1,262 +0,0 @@ -package compile - -import ( - "context" - "encoding/json" - "flag" - "fmt" - "strings" - - "github.com/brimdata/super/cli/lakeflags" - "github.com/brimdata/super/cmd/super/dev" - "github.com/brimdata/super/cmd/super/root" - "github.com/brimdata/super/compiler" - "github.com/brimdata/super/compiler/ast" - "github.com/brimdata/super/compiler/ast/dag" - "github.com/brimdata/super/compiler/data" - "github.com/brimdata/super/compiler/describe" - "github.com/brimdata/super/compiler/parser" - "github.com/brimdata/super/lake" - "github.com/brimdata/super/pkg/charm" - "github.com/brimdata/super/runtime" - "github.com/brimdata/super/zfmt" -) - -var spec = &charm.Spec{ - Name: "compile", - Usage: "compile [ options ] zed", - Short: "inspect Zed language abstract syntax trees and compiler stages", - Long: ` -The "zed dev compile" command parses a Zed expression and prints the resulting abstract syntax -tree as JSON object to standard output. If you have installed the -shortcuts, "zc" is a short cut for the "zed dev compile" command. - -"zed dev compile" is a tool for dev and test, -and is also useful to advanced users for understanding how Zed syntax is -translated into an analytics requests sent to the "zed server" search endpoint. - -The -O flag is handy for turning on and off the compiler, which lets you see -how the parsed AST is transformed into a runtime object comprised of the -Zed kernel operators. -`, - New: New, -} - -func init() { - dev.Spec.Add(spec) -} - -type Command struct { - *root.Command - //XXX this doesn't work right because flags aren't shown in help... - // we should have a "super db compile" command and a "super compile" command - LakeFlags lakeflags.Flags - pigeon bool - proc bool - canon bool - semantic bool - optimize bool - describe bool - parallel int - n int - includes includes -} - -func New(parent charm.Command, f *flag.FlagSet) (charm.Command, error) { - c := &Command{Command: parent.(*root.Command)} - c.LakeFlags.SetFlags(f) - f.BoolVar(&c.pigeon, "pigeon", false, "run pigeon version of peg parser") - f.BoolVar(&c.proc, "proc", false, "run pigeon version of peg parser and marshal into ast.Op") - f.BoolVar(&c.semantic, "s", false, "display semantically analyzed AST (implies -proc)") - f.BoolVar(&c.optimize, "O", false, "display optimized, non-filter AST (implies -proc)") - f.IntVar(&c.parallel, "P", 0, "display parallelized AST (implies -proc)") - f.BoolVar(&c.canon, "C", false, "display AST in Zed canonical format (implies -proc)") - f.BoolVar(&c.describe, "D", false, "display describe summary of Zed query (implies -proc)") - f.Var(&c.includes, "I", "source file containing Zed query text (may be repeated)") - return c, nil -} - -type includes []string - -func (i includes) String() string { - return strings.Join(i, ",") -} - -func (i *includes) Set(value string) error { - *i = append(*i, value) - return nil -} - -func (c *Command) Run(args []string) error { - ctx, cleanup, err := c.Init() - if err != nil { - return err - } - defer cleanup() - if len(args) == 0 && len(c.includes) == 0 { - return charm.NeedHelp - } - c.n = 0 - if c.pigeon { - c.n++ - } - if c.proc { - c.n++ - } - if c.semantic { - c.n++ - } - if c.describe { - c.n++ - } - if c.optimize { - c.n++ - } - if c.parallel > 0 { - c.n++ - } - if c.n == 0 { - if c.canon { - c.proc = true - } else { - c.pigeon = true - } - } - src := strings.Join(args, " ") - var lk *lake.Root - if c.semantic || c.optimize || c.parallel != 0 || c.describe { - lakeAPI, err := c.LakeFlags.Open(ctx) - if err == nil { - lk = lakeAPI.Root() - } - } - return c.parse(ctx, src, lk) -} - -func (c *Command) header(msg string) { - if c.n > 1 { - bars := strings.Repeat("=", len(msg)) - fmt.Printf("/%s\\\n", bars) - fmt.Printf("|%s|\n", msg) - fmt.Printf("\\%s/\n", bars) - } -} - -func (c *Command) parse(ctx context.Context, z string, lk *lake.Root) error { - seq, sset, err := compiler.Parse(z, c.includes...) - if err != nil { - return err - } - if c.pigeon { - b, err := json.Marshal(seq) - if err != nil { - return err - } - c.header("pigeon") - fmt.Println(normalize(b)) - } - if c.proc { - c.header("proc") - c.writeAST(seq) - } - if !c.semantic && !c.optimize && c.parallel == 0 && !c.describe { - return nil - } - runtime, err := compiler.NewJob(runtime.DefaultContext(), seq, data.NewSource(nil, lk), nil) - if err != nil { - if list, ok := err.(parser.ErrorList); ok { - list.SetSourceSet(sset) - } - return err - } - if c.semantic { - c.header("semantic") - c.writeDAG(runtime.Entry()) - } - if c.describe { - c.header("describe") - c.writeDescribe(ctx, runtime.Entry(), lk) - } - if c.optimize { - if err := runtime.Optimize(); err != nil { - return err - } - c.header("optimized") - c.writeDAG(runtime.Entry()) - } - if c.parallel > 0 { - if err := runtime.Optimize(); err != nil { - return err - } - if err := runtime.Parallelize(c.parallel); err != nil { - return err - } - c.header("parallelized") - c.writeDAG(runtime.Entry()) - } - return nil -} - -func (c *Command) writeAST(seq ast.Seq) { - s, err := astFmt(seq, c.canon) - if err != nil { - fmt.Println(err) - } else { - fmt.Println(s) - } -} - -func (c *Command) writeDAG(seq dag.Seq) { - s, err := dagFmt(seq, c.canon) - if err != nil { - fmt.Println(err) - } else { - fmt.Println(s) - } -} - -func (c *Command) writeDescribe(ctx context.Context, seq dag.Seq, lk *lake.Root) { - info, err := describe.AnalyzeDAG(ctx, seq, data.NewSource(nil, lk), nil) - if err != nil { - fmt.Println(err) - return - } - out, err := json.MarshalIndent(info, "", " ") - if err != nil { - fmt.Println(err) - } else { - fmt.Println(string(out)) - } -} - -func normalize(b []byte) (string, error) { - var v interface{} - err := json.Unmarshal(b, &v) - if err != nil { - return "", err - } - out, err := json.MarshalIndent(v, "", " ") - return string(out), err -} - -func astFmt(seq ast.Seq, canon bool) (string, error) { - if canon { - return zfmt.AST(seq), nil - } - seqJSON, err := json.Marshal(seq) - if err != nil { - return "", err - } - return normalize(seqJSON) -} - -func dagFmt(seq dag.Seq, canon bool) (string, error) { - if canon { - return zfmt.DAG(seq), nil - } - dagJSON, err := json.Marshal(seq) - if err != nil { - return "", err - } - return normalize(dagJSON) -} diff --git a/cmd/super/dev/dig/command.go b/cmd/super/dev/dig/command.go index 0add1636b4..d92ccbf6fe 100644 --- a/cmd/super/dev/dig/command.go +++ b/cmd/super/dev/dig/command.go @@ -4,7 +4,6 @@ import ( "flag" "github.com/brimdata/super/cmd/super/dev" - "github.com/brimdata/super/cmd/super/root" "github.com/brimdata/super/pkg/charm" ) @@ -23,13 +22,13 @@ func init() { } type Command struct { - *root.Command + *dev.Command } func New(parent charm.Command, f *flag.FlagSet) (charm.Command, error) { - return &Command{Command: parent.(*root.Command)}, nil + return &Command{Command: parent.(*dev.Command)}, nil } func (c *Command) Run(args []string) error { - return charm.NeedHelp + return charm.NoRun(args) } diff --git a/cmd/super/dev/vector/command.go b/cmd/super/dev/vector/command.go index be6da34fde..142024d61f 100644 --- a/cmd/super/dev/vector/command.go +++ b/cmd/super/dev/vector/command.go @@ -4,7 +4,6 @@ import ( "flag" "github.com/brimdata/super/cmd/super/dev" - "github.com/brimdata/super/cmd/super/root" "github.com/brimdata/super/pkg/charm" ) @@ -17,10 +16,18 @@ vector runs various tests of the vector cache and runtime as specified by its su New: New, } +type Command struct { + *dev.Command +} + func init() { dev.Spec.Add(Spec) } func New(parent charm.Command, f *flag.FlagSet) (charm.Command, error) { - return parent.(*root.Command), nil + return &Command{Command: parent.(*dev.Command)}, nil +} + +func (c *Command) Run(args []string) error { + return charm.NoRun(args) } diff --git a/cmd/super/dev/vector/copy/command.go b/cmd/super/dev/vector/copy/command.go index 75eab0a899..baa5d5616c 100644 --- a/cmd/super/dev/vector/copy/command.go +++ b/cmd/super/dev/vector/copy/command.go @@ -7,7 +7,6 @@ import ( "github.com/brimdata/super" "github.com/brimdata/super/cli/outputflags" "github.com/brimdata/super/cmd/super/dev/vector" - "github.com/brimdata/super/cmd/super/root" "github.com/brimdata/super/pkg/charm" "github.com/brimdata/super/pkg/storage" "github.com/brimdata/super/runtime/vam" @@ -34,12 +33,12 @@ func init() { } type Command struct { - *root.Command + *vector.Command outputFlags outputflags.Flags } func newCommand(parent charm.Command, f *flag.FlagSet) (charm.Command, error) { - c := &Command{Command: parent.(*root.Command)} + c := &Command{Command: parent.(*vector.Command)} c.outputFlags.SetFlags(f) return c, nil } diff --git a/cmd/super/dev/vector/project/command.go b/cmd/super/dev/vector/project/command.go index 5c6a0efca6..b927711ee4 100644 --- a/cmd/super/dev/vector/project/command.go +++ b/cmd/super/dev/vector/project/command.go @@ -7,7 +7,6 @@ import ( "github.com/brimdata/super" "github.com/brimdata/super/cli/outputflags" "github.com/brimdata/super/cmd/super/dev/vector" - "github.com/brimdata/super/cmd/super/root" "github.com/brimdata/super/pkg/charm" "github.com/brimdata/super/pkg/field" "github.com/brimdata/super/pkg/storage" @@ -37,12 +36,12 @@ func init() { } type Command struct { - *root.Command + *vector.Command outputFlags outputflags.Flags } func newCommand(parent charm.Command, f *flag.FlagSet) (charm.Command, error) { - c := &Command{Command: parent.(*root.Command)} + c := &Command{Command: parent.(*vector.Command)} c.outputFlags.SetFlags(f) return c, nil } diff --git a/cmd/super/dev/vector/query/command.go b/cmd/super/dev/vector/query/command.go index b1231029c8..94b02287f9 100644 --- a/cmd/super/dev/vector/query/command.go +++ b/cmd/super/dev/vector/query/command.go @@ -7,7 +7,6 @@ import ( "github.com/brimdata/super" "github.com/brimdata/super/cli/outputflags" "github.com/brimdata/super/cmd/super/dev/vector" - "github.com/brimdata/super/cmd/super/root" "github.com/brimdata/super/compiler" "github.com/brimdata/super/pkg/charm" "github.com/brimdata/super/pkg/storage" @@ -38,12 +37,12 @@ func init() { } type Command struct { - *root.Command + *vector.Command outputFlags outputflags.Flags } func newCommand(parent charm.Command, f *flag.FlagSet) (charm.Command, error) { - c := &Command{Command: parent.(*root.Command)} + c := &Command{Command: parent.(*vector.Command)} c.outputFlags.SetFlags(f) return c, nil } diff --git a/cmd/super/dev/vector/search/command.go b/cmd/super/dev/vector/search/command.go index f80375a1a0..8620ec1bb4 100644 --- a/cmd/super/dev/vector/search/command.go +++ b/cmd/super/dev/vector/search/command.go @@ -9,7 +9,6 @@ import ( "github.com/brimdata/super/cli/outputflags" "github.com/brimdata/super/cli/poolflags" "github.com/brimdata/super/cmd/super/dev/vector" - "github.com/brimdata/super/cmd/super/root" "github.com/brimdata/super/compiler" "github.com/brimdata/super/compiler/data" "github.com/brimdata/super/pkg/charm" @@ -30,14 +29,14 @@ func init() { } type Command struct { - *root.Command + *vector.Command outputFlags outputflags.Flags poolFlags poolflags.Flags lakeFlags lakeflags.Flags } func newCommand(parent charm.Command, f *flag.FlagSet) (charm.Command, error) { - c := &Command{Command: parent.(*root.Command)} + c := &Command{Command: parent.(*vector.Command)} c.outputFlags.SetFlags(f) c.poolFlags.SetFlags(f) c.lakeFlags.SetFlags(f) diff --git a/cmd/super/dev/vng/command.go b/cmd/super/dev/vng/command.go index 1ecd3dec74..7be8b83dfb 100644 --- a/cmd/super/dev/vng/command.go +++ b/cmd/super/dev/vng/command.go @@ -10,7 +10,6 @@ import ( "github.com/brimdata/super" "github.com/brimdata/super/cli/outputflags" "github.com/brimdata/super/cmd/super/dev" - "github.com/brimdata/super/cmd/super/root" "github.com/brimdata/super/pkg/charm" "github.com/brimdata/super/pkg/storage" @@ -34,12 +33,12 @@ func init() { } type Command struct { - *root.Command + *dev.Command outputFlags outputflags.Flags } func New(parent charm.Command, f *flag.FlagSet) (charm.Command, error) { - c := &Command{Command: parent.(*root.Command)} + c := &Command{Command: parent.(*dev.Command)} c.outputFlags.SetFlags(f) return c, nil } diff --git a/cmd/super/main.go b/cmd/super/main.go index f7c493170a..bd03539945 100644 --- a/cmd/super/main.go +++ b/cmd/super/main.go @@ -4,9 +4,11 @@ import ( "fmt" "os" + _ "github.com/brimdata/super/cmd/super/compile" _ "github.com/brimdata/super/cmd/super/db/auth" _ "github.com/brimdata/super/cmd/super/db/branch" _ "github.com/brimdata/super/cmd/super/db/compact" + _ "github.com/brimdata/super/cmd/super/db/compile" _ "github.com/brimdata/super/cmd/super/db/create" _ "github.com/brimdata/super/cmd/super/db/delete" _ "github.com/brimdata/super/cmd/super/db/drop" @@ -25,7 +27,6 @@ import ( _ "github.com/brimdata/super/cmd/super/db/vacuum" _ "github.com/brimdata/super/cmd/super/db/vector" _ "github.com/brimdata/super/cmd/super/dev" - _ "github.com/brimdata/super/cmd/super/dev/compile" _ "github.com/brimdata/super/cmd/super/dev/dig/frames" _ "github.com/brimdata/super/cmd/super/dev/dig/slice" _ "github.com/brimdata/super/cmd/super/dev/vector/copy" diff --git a/compiler/parser/README.md b/compiler/parser/README.md index 696f423de4..1b5c79d562 100644 --- a/compiler/parser/README.md +++ b/compiler/parser/README.md @@ -16,7 +16,7 @@ parser (parser.go). ## Testing -The `super dev compile` command can be used for easily testing the output of +The `super compile` command can be used for easily testing the output of the Zed parser. ## Development diff --git a/compiler/parser/ztests/complex-type.yaml b/compiler/parser/ztests/complex-type.yaml index 7f79af178f..c7e735e327 100644 --- a/compiler/parser/ztests/complex-type.yaml +++ b/compiler/parser/ztests/complex-type.yaml @@ -1,9 +1,9 @@ script: | - super dev compile -C 'yield <{a:int64}>' - super dev compile -C 'yield <[int64]>' - super dev compile -C 'yield <|[int64]|>' - super dev compile -C 'yield <|{int64:string}|>' - super dev compile -C 'yield ' + super compile -C 'yield <{a:int64}>' + super compile -C 'yield <[int64]>' + super compile -C 'yield <|[int64]|>' + super compile -C 'yield <|{int64:string}|>' + super compile -C 'yield ' outputs: - name: stdout diff --git a/compiler/parser/ztests/from.yaml b/compiler/parser/ztests/from.yaml index 829753c148..3a526afded 100644 --- a/compiler/parser/ztests/from.yaml +++ b/compiler/parser/ztests/from.yaml @@ -1,13 +1,13 @@ script: | - super dev compile -C 'from ( pool a => x pool b)' + super compile -C 'from ( pool a => x pool b)' echo === No spaces around parentheses. - super dev compile -C 'from(file a)' - super dev compile -C 'from(get http://a)' - super dev compile -C 'from(pool a)' + super compile -C 'from(file a)' + super compile -C 'from(get http://a)' + super compile -C 'from(pool a)' echo === No space before vertical bar. - super dev compile -C 'file a| b' - super dev compile -C 'get http://a| b' - super dev compile -C 'from a| b' + super compile -C 'file a| b' + super compile -C 'get http://a| b' + super compile -C 'from a| b' outputs: - name: stdout diff --git a/compiler/parser/ztests/over-expr.yaml b/compiler/parser/ztests/over-expr.yaml index 1066a05043..abc5ce3814 100644 --- a/compiler/parser/ztests/over-expr.yaml +++ b/compiler/parser/ztests/over-expr.yaml @@ -1,14 +1,14 @@ script: | echo === aggregation and locals - super dev compile -C 'collect(over a with b=c | d)' + super compile -C 'collect(over a with b=c | d)' echo === cast - super dev compile -C 'uint8(over a | b)' + super compile -C 'uint8(over a | b)' echo === expression - super dev compile -C 'yield (over a | b)' + super compile -C 'yield (over a | b)' echo === function - super dev compile -C 'quiet(over a | b)' + super compile -C 'quiet(over a | b)' echo === grep - super dev compile -C 'grep(/regexp/, over a | b)' + super compile -C 'grep(/regexp/, over a | b)' outputs: - name: stdout diff --git a/compiler/ztests/const-source.yaml b/compiler/ztests/const-source.yaml index 0f750fee2e..21f1ca9c83 100644 --- a/compiler/ztests/const-source.yaml +++ b/compiler/ztests/const-source.yaml @@ -1,15 +1,15 @@ script: | - export ZED_LAKE=test + export SUPER_DB_LAKE=test super db init -q super db create -q test - super dev compile -s -C 'const POOL = "test" from POOL' | sed -e "s/[a-zA-Z0-9]\{27\}/XXX/" + super db compile -dag -C 'const POOL = "test" from POOL' | sed -e "s/[a-zA-Z0-9]\{27\}/XXX/" echo "===" - super dev compile -s -C 'const FILE = "A.zson" file FILE' + super db compile -dag -C 'const FILE = "A.zson" file FILE' echo "===" - super dev compile -s -C 'const URL = "http://brimdata.io" get URL' - ! super dev compile -s -C 'const POOL = 3.14 from POOL' - ! super dev compile -s -C 'const FILE = 127.0.0.1 file FILE' - ! super dev compile -s -C 'const URL = true get URL' + super db compile -dag -C 'const URL = "http://brimdata.io" get URL' + ! super db compile -dag -C 'const POOL = 3.14 from POOL' + ! super db compile -dag -C 'const FILE = 127.0.0.1 file FILE' + ! super db compile -dag -C 'const URL = true get URL' outputs: - name: stdout diff --git a/compiler/ztests/dot-in-pool.yaml b/compiler/ztests/dot-in-pool.yaml index 528af1cc71..4327382346 100644 --- a/compiler/ztests/dot-in-pool.yaml +++ b/compiler/ztests/dot-in-pool.yaml @@ -1,5 +1,5 @@ script: | - export ZED_LAKE=test + export SUPER_DB_LAKE=test super db init -q super db create -q foo.bar super db use -q foo.bar diff --git a/compiler/ztests/from-error.yaml b/compiler/ztests/from-error.yaml index d90cb2ff7e..8ed1f56978 100644 --- a/compiler/ztests/from-error.yaml +++ b/compiler/ztests/from-error.yaml @@ -1,16 +1,15 @@ script: | - ! super dev compile -lake='' -C -s 'from p' + ! super compile -C -dag 'from p' + export SUPER_DB_LAKE=test + super db init -q + ! super db compile -C -dag 'from test' echo === >&2 - export ZED_LAKE=test - super db init - ! super dev compile -C -s 'from test' + ! super db compile -C -dag 'from test*' echo === >&2 - ! super dev compile -C -s 'from test*' - echo === >&2 - ! super dev compile -C -s 'from /test/' + ! super db compile -C -dag 'from /test/' echo === >&2 super db create -q test - ! super dev compile -C -s 'from (pool * => count())' + ! super db compile -C -dag 'from (pool * => count())' outputs: - name: stderr @@ -18,7 +17,6 @@ outputs: "from pool" cannot be used without a lake at line 1, column 1: from p ~~~~~~ - === test: pool not found at line 1, column 6: from test ~~~~ diff --git a/compiler/ztests/head.yaml b/compiler/ztests/head.yaml index d6f01283f9..4bb728d6cd 100644 --- a/compiler/ztests/head.yaml +++ b/compiler/ztests/head.yaml @@ -1,10 +1,10 @@ script: | - super dev compile -C -s 'head 1' + super compile -C -dag 'head 1' echo === - super dev compile -C -s 'const x=1 head x + 1' - ! super dev compile -C -s 'head 1.' - ! super dev compile -C -s 'head "1"' - ! super dev compile -C -s 'head x' + super compile -C -dag 'const x=1 head x + 1' + ! super compile -C -dag 'head 1.' + ! super compile -C -dag 'head "1"' + ! super compile -C -dag 'head x' outputs: - name: stdout diff --git a/compiler/ztests/join-desc.yaml b/compiler/ztests/join-desc.yaml index 6e53ccb8d0..3931ff9bb3 100644 --- a/compiler/ztests/join-desc.yaml +++ b/compiler/ztests/join-desc.yaml @@ -1,6 +1,6 @@ script: | super -z -I file.zed > file.zson - export ZED_LAKE=test + export SUPER_DB_LAKE=test super db init -q super db create -q -use -orderby likes:desc people super db load -q people.zson diff --git a/compiler/ztests/join-subquery.yaml b/compiler/ztests/join-subquery.yaml index 365b733fc0..4664629daa 100644 --- a/compiler/ztests/join-subquery.yaml +++ b/compiler/ztests/join-subquery.yaml @@ -1,7 +1,7 @@ script: | - super dev compile -C 'file a | join (file b) on c' + super compile -C 'file a | join (file b) on c' echo === - super dev compile -C -s 'file a | join (file b) on c' + super compile -C -dag 'file a | join (file b) on c' outputs: - name: stdout diff --git a/compiler/ztests/load.yaml b/compiler/ztests/load.yaml index 1862098aa1..c8c516eb1f 100644 --- a/compiler/ztests/load.yaml +++ b/compiler/ztests/load.yaml @@ -1,5 +1,5 @@ script: | - export ZED_LAKE=test + export SUPER_DB_LAKE=test super db init -q super db create -q samples super db load -q -use samples schools.zson diff --git a/compiler/ztests/merge-filters.yaml b/compiler/ztests/merge-filters.yaml index 38c9a255b4..c9a62b4f49 100644 --- a/compiler/ztests/merge-filters.yaml +++ b/compiler/ztests/merge-filters.yaml @@ -1,11 +1,11 @@ script: | - super dev compile -C -O 'where a | where b' + super compile -C -O 'where a | where b' echo === - super dev compile -C -O 'from ( file a => where b | where c file d => where e | where f ) | where g' + super compile -C -O 'from ( file a => where b | where c file d => where e | where f ) | where g' echo === - super dev compile -C -O 'over a => ( where b | where c )' + super compile -C -O 'over a => ( where b | where c )' echo === - super dev compile -C -O 'fork ( => where a | where b => where c | where d )' + super compile -C -O 'fork ( => where a | where b => where c | where d )' outputs: - name: stdout diff --git a/compiler/ztests/par-count.yaml b/compiler/ztests/par-count.yaml index cdef411335..a63e05b246 100644 --- a/compiler/ztests/par-count.yaml +++ b/compiler/ztests/par-count.yaml @@ -1,10 +1,10 @@ script: | - export ZED_LAKE=test + export SUPER_DB_LAKE=test super db init -q super db create -q -orderby ts test - super dev compile -C -P 2 "from test | count() by y" | sed -e 's/pool .*/.../' + super db compile -C -P 2 "from test | count() by y" | sed -e 's/pool .*/.../' echo === - super dev compile -C -P 2 "from test | count()" | sed -e 's/pool .*/.../' + super db compile -C -P 2 "from test | count()" | sed -e 's/pool .*/.../' outputs: - name: stdout diff --git a/compiler/ztests/par-groupby-func.yaml b/compiler/ztests/par-groupby-func.yaml index 6f054a0d12..b50ed71937 100644 --- a/compiler/ztests/par-groupby-func.yaml +++ b/compiler/ztests/par-groupby-func.yaml @@ -1,8 +1,8 @@ script: | - export ZED_LAKE=test + export SUPER_DB_LAKE=test super db init -q super db create -q -orderby s:asc test - super dev compile -P 2 -C "from test | union(s) by n:=len(s)" | sed -e 's/pool .*/.../' + super db compile -P 2 -C "from test | union(s) by n:=len(s)" | sed -e 's/pool .*/.../' outputs: - name: stdout diff --git a/compiler/ztests/par-join.yaml b/compiler/ztests/par-join.yaml index 9c03bcaa99..47dbe27731 100644 --- a/compiler/ztests/par-join.yaml +++ b/compiler/ztests/par-join.yaml @@ -1,10 +1,10 @@ script: | - export ZED_LAKE=test + export SUPER_DB_LAKE=test super db init -q super db create -q -orderby ts test # At the time of writing, the where operator is necessary because a pool scan # is parallelized only when followed by another operator. - super dev compile -C -P 2 "from test | join (from test | where true) on a=b" | sed -e 's/pool .*/.../' + super db compile -C -P 2 "from test | join (from test | where true) on a=b" | sed -e 's/pool .*/.../' outputs: - name: stdout diff --git a/compiler/ztests/par-layout-dataflow.yaml b/compiler/ztests/par-layout-dataflow.yaml index 93ea449d30..dad53f22a8 100644 --- a/compiler/ztests/par-layout-dataflow.yaml +++ b/compiler/ztests/par-layout-dataflow.yaml @@ -1,11 +1,11 @@ script: | - export ZED_LAKE=test + export SUPER_DB_LAKE=test super db init -q super db create -q -orderby ts:asc ASC super db create -q -orderby ts:desc DESC - super dev compile -C -P 2 "from ASC | cut x:=ts,ts:=1" | sed -e 's/pool .*/.../' + super db compile -C -P 2 "from ASC | cut x:=ts,ts:=1" | sed -e 's/pool .*/.../' echo === - super dev compile -C -P 2 "from DESC | cut x:=ts,ts:=1" | sed -e 's/pool .*/.../' + super db compile -C -P 2 "from DESC | cut x:=ts,ts:=1" | sed -e 's/pool .*/.../' outputs: - name: stdout diff --git a/compiler/ztests/par-pushdown.yaml b/compiler/ztests/par-pushdown.yaml index f12ea3da37..73f14e1d35 100644 --- a/compiler/ztests/par-pushdown.yaml +++ b/compiler/ztests/par-pushdown.yaml @@ -1,8 +1,8 @@ script: | - export ZED_LAKE=test + export SUPER_DB_LAKE=test super db init -q super db create -q -orderby ts test - super dev compile -P 3 "from test | x==1" | super -z -c 'over this | kind=="Scatter" | over paths | yield this[0].filter.kind' - + super db compile -P 3 "from test | x==1" | super -z -c 'over this | kind=="Scatter" | over paths | yield this[0].filter.kind' - outputs: - name: stdout diff --git a/compiler/ztests/par-put-ts-rename-count.yaml b/compiler/ztests/par-put-ts-rename-count.yaml index b9538d17c0..46d8d014ce 100644 --- a/compiler/ztests/par-put-ts-rename-count.yaml +++ b/compiler/ztests/par-put-ts-rename-count.yaml @@ -1,6 +1,6 @@ skip: we no longer parallelize now when we clobber the sort key. issue 2756 -script: super dev compile -C -P 2 "from 'pool-ts' | put ts:=foo | rename foo:=boo | count()" +script: super compile -C -P 2 "from 'pool-ts' | put ts:=foo | rename foo:=boo | count()" outputs: - name: stdout diff --git a/compiler/ztests/par-put-ts-rename-sort.yaml b/compiler/ztests/par-put-ts-rename-sort.yaml index 6cdba99a75..9869cf0f51 100644 --- a/compiler/ztests/par-put-ts-rename-sort.yaml +++ b/compiler/ztests/par-put-ts-rename-sort.yaml @@ -1,6 +1,6 @@ skip: we no longer parallelize now when we clobber the sort key. issue 2756 -script: super dev compile -C -P 2 "from 'pool-ts' | put ts:=foo | rename foo:=boo | sort" +script: super compile -C -P 2 "from 'pool-ts' | put ts:=foo | rename foo:=boo | sort" outputs: - name: stdout diff --git a/compiler/ztests/par-put-ts-rename.yaml b/compiler/ztests/par-put-ts-rename.yaml index 9e475a79e1..57dd0a0b70 100644 --- a/compiler/ztests/par-put-ts-rename.yaml +++ b/compiler/ztests/par-put-ts-rename.yaml @@ -1,6 +1,6 @@ skip: we no longer parallelize now when we clobber the sort key. issue 2756 -script: super dev compile -C -P 2 "from 'pool-ts' | put ts:=foo | rename foo:=boo" +script: super compile -C -P 2 "from 'pool-ts' | put ts:=foo | rename foo:=boo" outputs: - name: stdout diff --git a/compiler/ztests/par-ts.yaml b/compiler/ztests/par-ts.yaml index 69acf4268e..4976f69337 100644 --- a/compiler/ztests/par-ts.yaml +++ b/compiler/ztests/par-ts.yaml @@ -1,27 +1,27 @@ script: | - export ZED_LAKE=test + export SUPER_DB_LAKE=test super db init -q super db create -q -orderby ts test echo "" - super dev compile -C -P 2 "from test | cut ts, y, z | put x := y | rename y := z" | sed -e 's/pool .*/.../' + super db compile -C -P 2 "from test | cut ts, y, z | put x := y | rename y := z" | sed -e 's/pool .*/.../' echo "" - super dev compile -C -P 2 "from test | cut ts, foo:=x | uniq" | sed -e 's/pool .*/.../' + super db compile -C -P 2 "from test | cut ts, foo:=x | uniq" | sed -e 's/pool .*/.../' echo "" - super dev compile -C -P 2 "from test | drop x | uniq" | sed -e 's/pool .*/.../' + super db compile -C -P 2 "from test | drop x | uniq" | sed -e 's/pool .*/.../' echo "" - super dev compile -C -P 2 "from test | count() by y, every(1h)" | sed -e 's/pool .*/.../' + super db compile -C -P 2 "from test | count() by y, every(1h)" | sed -e 's/pool .*/.../' echo "" - super dev compile -C -P 2 "from test | put x:=y | countdistinct(x) by y | uniq" | sed -e 's/pool .*/.../' + super db compile -C -P 2 "from test | put x:=y | countdistinct(x) by y | uniq" | sed -e 's/pool .*/.../' echo "" - super dev compile -C -P 2 "from test | put x:=foo | rename foo:=boo | uniq" | sed -e 's/pool .*/.../' + super db compile -C -P 2 "from test | put x:=foo | rename foo:=boo | uniq" | sed -e 's/pool .*/.../' echo "" - super dev compile -C -P 2 "from test | put a:=1 | tail" | sed -e 's/pool .*/.../' + super db compile -C -P 2 "from test | put a:=1 | tail" | sed -e 's/pool .*/.../' echo "" - super dev compile -C -P 2 "from test | sort | uniq" | sed -e 's/pool .*/.../' + super db compile -C -P 2 "from test | sort | uniq" | sed -e 's/pool .*/.../' echo "" - super dev compile -C -P 2 "from test | sort x | uniq" | sed -e 's/pool .*/.../' + super db compile -C -P 2 "from test | sort x | uniq" | sed -e 's/pool .*/.../' echo "" - super dev compile -C -P 2 "from test | uniq" | sed -e 's/pool .*/.../' + super db compile -C -P 2 "from test | uniq" | sed -e 's/pool .*/.../' outputs: - name: stdout diff --git a/compiler/ztests/pushdown.yaml b/compiler/ztests/pushdown.yaml index a2aaae27aa..d820eabb89 100644 --- a/compiler/ztests/pushdown.yaml +++ b/compiler/ztests/pushdown.yaml @@ -1,18 +1,18 @@ script: | - export ZED_LAKE=test + export SUPER_DB_LAKE=test super db init -q super db create -q -orderby ts pool-ts - super dev compile -C -O "from 'pool-ts' | x=='hello' or x==1.0" | sed -e 's/lister .*/lister/' -e 's/seqscan .*filter/seqscan filter/' + super db compile -C -O "from 'pool-ts' | x=='hello' or x==1.0" | sed -e 's/lister .*/lister/' -e 's/seqscan .*filter/seqscan filter/' echo === - super dev compile -C -O "from 'pool-ts' | x > 1 y <= 1.0" | sed -e 's/lister .*/lister/' -e 's/seqscan .*filter/seqscan filter/' + super db compile -C -O "from 'pool-ts' | x > 1 y <= 1.0" | sed -e 's/lister .*/lister/' -e 's/seqscan .*filter/seqscan filter/' echo === - super dev compile -C -O "from 'pool-ts' | x=='hello' or x!=1.0" | sed -e 's/lister .*/lister/' -e 's/seqscan .*filter/seqscan filter/' + super db compile -C -O "from 'pool-ts' | x=='hello' or x!=1.0" | sed -e 's/lister .*/lister/' -e 's/seqscan .*filter/seqscan filter/' echo === - super dev compile -C -O "from 'pool-ts' | x=='hello' or !(y==2 or y==3)" | sed -e 's/lister .*/lister/' -e 's/seqscan .*filter/seqscan filter/' + super db compile -C -O "from 'pool-ts' | x=='hello' or !(y==2 or y==3)" | sed -e 's/lister .*/lister/' -e 's/seqscan .*filter/seqscan filter/' echo === - super dev compile -C -O "from 'pool-ts' | ts >= 0 and ts <= 2" | sed -e 's/lister .*pruner/lister pruner/' -e 's/seqscan .*pruner/seqscan pruner/' + super db compile -C -O "from 'pool-ts' | ts >= 0 and ts <= 2" | sed -e 's/lister .*pruner/lister pruner/' -e 's/seqscan .*pruner/seqscan pruner/' echo === - super dev compile -C -O "from 'pool-ts' | ts >= 0 and ts <= 2 and x=='hello'"| sed -e 's/lister .*pruner/lister pruner/' -e 's/seqscan .*pruner/seqscan pruner/' + super db compile -C -O "from 'pool-ts' | ts >= 0 and ts <= 2 and x=='hello'"| sed -e 's/lister .*pruner/lister pruner/' -e 's/seqscan .*pruner/seqscan pruner/' outputs: - name: stdout diff --git a/compiler/ztests/remove-passops.yaml b/compiler/ztests/remove-passops.yaml index ac70225278..2dc99db9bf 100644 --- a/compiler/ztests/remove-passops.yaml +++ b/compiler/ztests/remove-passops.yaml @@ -1,4 +1,4 @@ -script: super dev compile -O -C 'x>1 | pass | pass | x>2 | pass' +script: super compile -O -C 'x>1 | pass | pass | x>2 | pass' outputs: - name: stdout diff --git a/compiler/ztests/sem-groupby-input-dir.yaml b/compiler/ztests/sem-groupby-input-dir.yaml index e03aa40799..fd8c9ef648 100644 --- a/compiler/ztests/sem-groupby-input-dir.yaml +++ b/compiler/ztests/sem-groupby-input-dir.yaml @@ -1,8 +1,8 @@ script: | - export ZED_LAKE=test + export SUPER_DB_LAKE=test super db init -q super db create -q -orderby ts pool-ts - super dev compile -C -O "from 'pool-ts'| count() by every(1h)" | sed -e 's/pool .*/.../' + super db compile -C -O "from 'pool-ts'| count() by every(1h)" | sed -e 's/pool .*/.../' outputs: - name: stdout diff --git a/compiler/ztests/summarize-lhs-error.yaml b/compiler/ztests/summarize-lhs-error.yaml index 8283bc5292..84815fdd56 100644 --- a/compiler/ztests/summarize-lhs-error.yaml +++ b/compiler/ztests/summarize-lhs-error.yaml @@ -1,7 +1,7 @@ script: | - ! super dev compile -s 'count() by this[a] := key' - ! super dev compile -s 'this[a] := count() by key' - ! super dev compile -s 'this[a] := count()' + ! super compile -dag 'count() by this[a] := key' + ! super compile -dag 'this[a] := count() by key' + ! super compile -dag 'this[a] := count()' outputs: - name: stderr diff --git a/compiler/ztests/tail.yaml b/compiler/ztests/tail.yaml index eac1ed04b1..aefff3b78a 100644 --- a/compiler/ztests/tail.yaml +++ b/compiler/ztests/tail.yaml @@ -1,10 +1,10 @@ script: | - super dev compile -C -s 'tail 1' + super compile -C -dag 'tail 1' echo === - super dev compile -C -s 'const x=1 tail x + 1' - ! super dev compile -C -s 'tail 1.' - ! super dev compile -C -s 'tail "1"' - ! super dev compile -C -s 'tail x' + super compile -C -dag 'const x=1 tail x + 1' + ! super compile -C -dag 'tail 1.' + ! super compile -C -dag 'tail "1"' + ! super compile -C -dag 'tail x' outputs: - name: stdout diff --git a/compiler/ztests/udf-implied-where.yaml b/compiler/ztests/udf-implied-where.yaml index 52d2c11868..6febdd3383 100644 --- a/compiler/ztests/udf-implied-where.yaml +++ b/compiler/ztests/udf-implied-where.yaml @@ -1,5 +1,5 @@ script: | - super dev compile -C -s 'func h(e): ( has(e) ) h(foo)' + super compile -C -dag 'func h(e): ( has(e) ) h(foo)' outputs: - name: stdout diff --git a/docs/language/ztests/language-operators-1.yaml b/docs/language/ztests/language-operators-1.yaml index d212f8dca5..ef4b4bb11b 100644 --- a/docs/language/ztests/language-operators-1.yaml +++ b/docs/language/ztests/language-operators-1.yaml @@ -7,7 +7,7 @@ # ============================================================================ script: | - super dev compile -C 'widget | count() by color | COLOR := upper(color)' + super compile -C 'widget | count() by color | COLOR := upper(color)' outputs: - name: stdout diff --git a/pkg/charm/charm.go b/pkg/charm/charm.go index a8a7f31071..b21875ecec 100644 --- a/pkg/charm/charm.go +++ b/pkg/charm/charm.go @@ -80,3 +80,10 @@ func (s *Spec) Exec(args []string) error { } return err } + +func NoRun(args []string) error { + if len(args) == 0 { + return NeedHelp + } + return ErrNoRun +} diff --git a/runtime/sam/op/ztests/cut-dynamic-field.yaml b/runtime/sam/op/ztests/cut-dynamic-field.yaml index d470c45acd..56fb2b73f8 100644 --- a/runtime/sam/op/ztests/cut-dynamic-field.yaml +++ b/runtime/sam/op/ztests/cut-dynamic-field.yaml @@ -18,7 +18,7 @@ script: | echo "// ===" echo {} | super -z -c 'cut this[doesnotexist] := "world"' - # semantic error cases - ! super dev compile -s 'op foo(): ( yield "error" ) cut this[foo] := "hello world"' + ! super compile -dag 'op foo(): ( yield "error" ) cut this[foo] := "hello world"' outputs: - name: stdout diff --git a/runtime/sam/op/ztests/put-dynamic-field.yaml b/runtime/sam/op/ztests/put-dynamic-field.yaml index 93f04299a3..28085915bf 100644 --- a/runtime/sam/op/ztests/put-dynamic-field.yaml +++ b/runtime/sam/op/ztests/put-dynamic-field.yaml @@ -16,7 +16,7 @@ script: | echo "// ===" echo {} | super -z -c 'this[doesnotexist] := "world"' - # semantic error cases - ! super dev compile -s 'op foo(): ( yield "error" ) put this[foo] := "hello world"' + ! super compile -dag 'op foo(): ( yield "error" ) put this[foo] := "hello world"' outputs: - name: stdout diff --git a/runtime/sam/op/ztests/user-errors.yaml b/runtime/sam/op/ztests/user-errors.yaml index dbd81cd616..91a13aca90 100644 --- a/runtime/sam/op/ztests/user-errors.yaml +++ b/runtime/sam/op/ztests/user-errors.yaml @@ -1,6 +1,6 @@ script: | - ! super dev compile -s -I error-duplicate-parameters.zed - ! super dev compile -s -I error-const-lhs.zed + ! super compile -dag -I error-duplicate-parameters.zed + ! super compile -dag -I error-const-lhs.zed inputs: - name: error-duplicate-parameters.zed diff --git a/service/ztests/s3/drop.yaml b/service/ztests/s3/drop.yaml index 9af7486536..4da2fc8151 100644 --- a/service/ztests/s3/drop.yaml +++ b/service/ztests/s3/drop.yaml @@ -6,7 +6,7 @@ script: | echo === super db drop -lake $SUPER_DB_LAKE -p test echo === - super db ls -lake $ZED_LAKE + super db ls -lake $SUPER_DB_LAKE echo === inputs: diff --git a/zfmt/ztests/debug.yaml b/zfmt/ztests/debug.yaml index 56d1457f17..cb866860f2 100644 --- a/zfmt/ztests/debug.yaml +++ b/zfmt/ztests/debug.yaml @@ -1,6 +1,6 @@ script: | - super dev compile -C 'debug f"debug: {this}" | head 1' - super dev compile -s -C 'debug f"debug: {this}" | head 1' + super compile -C 'debug f"debug: {this}" | head 1' + super compile -dag -C 'debug f"debug: {this}" | head 1' outputs: - name: stdout diff --git a/zfmt/ztests/decls.yaml b/zfmt/ztests/decls.yaml index a027871c1f..6579235d2b 100644 --- a/zfmt/ztests/decls.yaml +++ b/zfmt/ztests/decls.yaml @@ -1,7 +1,7 @@ script: | - super dev compile -C -I test.spq + super compile -C -I test.spq echo "===" - super dev compile -s -C -I test.spq + super compile -dag -C -I test.spq inputs: - name: test.spq diff --git a/zfmt/ztests/f-string.yaml b/zfmt/ztests/f-string.yaml index b3547079db..4565b3ced8 100644 --- a/zfmt/ztests/f-string.yaml +++ b/zfmt/ztests/f-string.yaml @@ -1,5 +1,5 @@ script: | - super dev compile -C 'yield f"hello {f"world"}"' + super compile -C 'yield f"hello {f"world"}"' outputs: - name: stdout diff --git a/zfmt/ztests/from.yaml b/zfmt/ztests/from.yaml index 7ea7003608..11a9cbce80 100644 --- a/zfmt/ztests/from.yaml +++ b/zfmt/ztests/from.yaml @@ -1,25 +1,25 @@ script: | - super dev compile -C 'file path' + super compile -C 'file path' echo === - super dev compile -C 'file path format f' + super compile -C 'file path format f' echo === - super dev compile -C 'get http://host/path' + super compile -C 'get http://host/path' echo === - super dev compile -C 'get http://host/path format f' + super compile -C 'get http://host/path format f' echo === - super dev compile -C 'from foo' + super compile -C 'from foo' echo === - super dev compile -C 'from foo*' + super compile -C 'from foo*' echo === - super dev compile -C 'from /foo/' + super compile -C 'from /foo/' echo === - super dev compile -C 'from ( file path get http://host/path pool name )' + super compile -C 'from ( file path get http://host/path pool name )' echo === - super dev compile -C 'from ( file path format f get http://host/path format g pool name )' + super compile -C 'from ( file path format f get http://host/path format g pool name )' echo === - super dev compile -C 'from ( file path => head get http://host/path => head pool name => head )' + super compile -C 'from ( file path => head get http://host/path => head pool name => head )' echo === - super dev compile -C 'from ( file path format f => head get http://host/path format g => head pool name => head )' + super compile -C 'from ( file path format f => head get http://host/path format g => head pool name => head )' outputs: - name: stdout diff --git a/zfmt/ztests/get.yaml b/zfmt/ztests/get.yaml index 18d201c150..0fa649d620 100644 --- a/zfmt/ztests/get.yaml +++ b/zfmt/ztests/get.yaml @@ -1,9 +1,9 @@ script: | - super dev compile -C 'get http://host/path' + super compile -C 'get http://host/path' echo === - super dev compile -C 'get http://host/path format f method m headers {a:["b"]} body b' + super compile -C 'get http://host/path format f method m headers {a:["b"]} body b' echo === - super dev compile -C 'get http://host/path method "m|" body "b|"' + super compile -C 'get http://host/path method "m|" body "b|"' outputs: - name: stdout data: | diff --git a/zfmt/ztests/implied-assignment.yaml b/zfmt/ztests/implied-assignment.yaml index b79203d3cf..2116cfff6e 100644 --- a/zfmt/ztests/implied-assignment.yaml +++ b/zfmt/ztests/implied-assignment.yaml @@ -1,7 +1,7 @@ script: | - super dev compile -C 'x:=1' - super dev compile -C 'x:=1,y:=lower(s)' - super dev compile -C 'x:=count(),sum(x)' + super compile -C 'x:=1' + super compile -C 'x:=1,y:=lower(s)' + super compile -C 'x:=count(),sum(x)' outputs: - name: stdout diff --git a/zfmt/ztests/join.yaml b/zfmt/ztests/join.yaml index 07bda583e2..2f122d8cd1 100644 --- a/zfmt/ztests/join.yaml +++ b/zfmt/ztests/join.yaml @@ -1,7 +1,7 @@ script: | - super dev compile -C "join (file test.zson) on x=x p:=a" + super compile -C "join (file test.zson) on x=x p:=a" echo === - super dev compile -C -s "join (file test.zson) on x=x p:=a" + super compile -C -dag "join (file test.zson) on x=x p:=a" outputs: - name: stdout diff --git a/zfmt/ztests/output.yaml b/zfmt/ztests/output.yaml index 974fe53c22..58e77b924d 100644 --- a/zfmt/ztests/output.yaml +++ b/zfmt/ztests/output.yaml @@ -1,7 +1,7 @@ script: | - super dev compile -C -s 'fork (=> output foo => pass)' + super compile -C -dag 'fork (=> output foo => pass)' echo '// ===' - super dev compile -C -s 'switch x (case "foo" => output foo case "bar" => pass)' + super compile -C -dag 'switch x (case "foo" => output foo case "bar" => pass)' outputs: - name: stdout diff --git a/zfmt/ztests/over.yaml b/zfmt/ztests/over.yaml index 63878bdfbb..3814ceb5e2 100644 --- a/zfmt/ztests/over.yaml +++ b/zfmt/ztests/over.yaml @@ -1,7 +1,7 @@ script: | - super dev compile -C -I test.zed + super compile -C -I test.zed echo === - super dev compile -s -C -I test.zed + super compile -dag -C -I test.zed inputs: - name: test.zed diff --git a/zfmt/ztests/parallel.yaml b/zfmt/ztests/parallel.yaml index 0213ab65e9..a26b200711 100644 --- a/zfmt/ztests/parallel.yaml +++ b/zfmt/ztests/parallel.yaml @@ -1,5 +1,5 @@ script: | - super dev compile -s -C 'file bar | foo | fork (=> count() by x:=this["@foo"] => sum(x) => put a:=b*c) | cut cake | sort -r x' + super compile -dag -C 'file bar | foo | fork (=> count() by x:=this["@foo"] => sum(x) => put a:=b*c) | cut cake | sort -r x' outputs: - name: stdout diff --git a/zfmt/ztests/precedence-dag.yaml b/zfmt/ztests/precedence-dag.yaml index ae532c8162..a6cd7d1a88 100644 --- a/zfmt/ztests/precedence-dag.yaml +++ b/zfmt/ztests/precedence-dag.yaml @@ -3,7 +3,7 @@ # same code path. script: | while read -r line; do - super dev compile -s -C $line + super compile -dag -C "$line" done < inputs.spq inputs: diff --git a/zfmt/ztests/precedence.yaml b/zfmt/ztests/precedence.yaml index b18dc78c24..6beae73916 100644 --- a/zfmt/ztests/precedence.yaml +++ b/zfmt/ztests/precedence.yaml @@ -1,6 +1,6 @@ script: | while read -r line; do - super dev compile -C $line + super compile -C "$line" done < inputs.spq inputs: diff --git a/zfmt/ztests/switch.yaml b/zfmt/ztests/switch.yaml index c729692a70..dfb95cb525 100644 --- a/zfmt/ztests/switch.yaml +++ b/zfmt/ztests/switch.yaml @@ -1,11 +1,11 @@ script: | - super dev compile -C 'switch ( case grep("a") => head case grep("c") => tail )' + super compile -C 'switch ( case grep("a") => head case grep("c") => tail )' echo === - super dev compile -C -s 'switch ( case grep("a") => head case grep("c") => tail )' + super compile -C -dag 'switch ( case grep("a") => head case grep("c") => tail )' echo === - super dev compile -C 'switch ( case grep("a") => head default => tail )' + super compile -C 'switch ( case grep("a") => head default => tail )' echo === - super dev compile -C -s 'switch ( case grep("a") => head default => tail )' + super compile -C -dag 'switch ( case grep("a") => head default => tail )' outputs: - name: stdout diff --git a/zfmt/ztests/type-value.yaml b/zfmt/ztests/type-value.yaml index 4f7d8e1f02..5b9f54e4e9 100644 --- a/zfmt/ztests/type-value.yaml +++ b/zfmt/ztests/type-value.yaml @@ -1,6 +1,6 @@ script: | - super dev compile -C "is() bar" - super dev compile -s -C "is(<(uint16,ip)>) 80" + super compile -C "is() bar" + super compile -dag -C "is(<(uint16,ip)>) 80" outputs: - name: stdout diff --git a/zfmt/ztests/yield-shortcut.yaml b/zfmt/ztests/yield-shortcut.yaml index 8c37d81c62..a1e9447279 100644 --- a/zfmt/ztests/yield-shortcut.yaml +++ b/zfmt/ztests/yield-shortcut.yaml @@ -1,15 +1,15 @@ script: | - super dev compile -C '{x:1,...y}' - super dev compile -C '[1,2,3]' - super dev compile -C '|["foo","bar"]|' - super dev compile -C '|{"foo":1,"bar":2}|' - super dev compile -C '<(int64,string)>(1)' + super compile -C '{x:1,...y}' + super compile -C '[1,2,3]' + super compile -C '|["foo","bar"]|' + super compile -C '|{"foo":1,"bar":2}|' + super compile -C '<(int64,string)>(1)' echo "===" - super dev compile -s -C '{x:1,...y}' - super dev compile -s -C '[1,2,3]' - super dev compile -s -C '|["foo","bar"]|' - super dev compile -s -C '|{"foo":1,"bar":2}|' - super dev compile -s -C '<(int64,string)>(1)' + super compile -dag -C '{x:1,...y}' + super compile -dag -C '[1,2,3]' + super compile -dag -C '|["foo","bar"]|' + super compile -dag -C '|{"foo":1,"bar":2}|' + super compile -dag -C '<(int64,string)>(1)' outputs: - name: stdout