From bdf1626a5459ba514f68d0a883f15b7f037dcfa5 Mon Sep 17 00:00:00 2001 From: Noah Treuhaft Date: Tue, 8 Oct 2024 20:27:59 -0400 Subject: [PATCH] Remove redundant error checks in compiler/kernel These checks already exist in compiler/semantic. --- compiler/kernel/expr.go | 3 --- compiler/kernel/op.go | 12 +----------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/compiler/kernel/expr.go b/compiler/kernel/expr.go index 65fcc44e8f..6040578190 100644 --- a/compiler/kernel/expr.go +++ b/compiler/kernel/expr.go @@ -508,9 +508,6 @@ func (b *Builder) compileMapExpr(m *dag.MapExpr) (expr.Evaluator, error) { } func (b *Builder) compileOverExpr(over *dag.OverExpr) (expr.Evaluator, error) { - if over.Body == nil { - return nil, errors.New("over expression requires a lateral query body") - } names, lets, err := b.compileDefs(over.Defs) if err != nil { return nil, err diff --git a/compiler/kernel/op.go b/compiler/kernel/op.go index 215222b544..32b26c6665 100644 --- a/compiler/kernel/op.go +++ b/compiler/kernel/op.go @@ -157,16 +157,9 @@ func (b *Builder) compileLeaf(o dag.Op, parent zbuf.Puller) (zbuf.Puller, error) cutter := expr.NewCutter(b.zctx(), lhs, rhs) return op.NewApplier(b.rctx, parent, cutter, b.resetters), nil case *dag.Drop: - if len(v.Args) == 0 { - return nil, errors.New("drop: no fields given") - } fields := make(field.List, 0, len(v.Args)) for _, e := range v.Args { - field, ok := e.(*dag.This) - if !ok { - return nil, errors.New("drop: arg not a field") - } - fields = append(fields, field.Path) + fields = append(fields, e.(*dag.This).Path) } dropper := expr.NewDropper(b.zctx(), fields) return op.NewApplier(b.rctx, parent, dropper, expr.Resetters{}), nil @@ -389,9 +382,6 @@ func (b *Builder) compileDefs(defs []dag.Def) ([]string, []expr.Evaluator, error } func (b *Builder) compileOver(parent zbuf.Puller, over *dag.Over) (zbuf.Puller, error) { - if len(over.Defs) != 0 && over.Body == nil { - return nil, errors.New("internal error: over operator has defs but no body") - } b.resetResetters() withNames, withExprs, err := b.compileDefs(over.Defs) if err != nil {