Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions compiler/ast/op.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ type (
Args []Expr `json:"args"`
Loc `json:"loc"`
}
CountOp struct {
Kind string `json:"kind" unpack:""`
Expr *RecordExpr `json:"expr"`
Loc `json:"loc"`
}
CutOp struct {
Kind string `json:"kind" unpack:""`
Args Assignments `json:"args"`
Expand Down Expand Up @@ -348,6 +353,7 @@ func (*AggregateOp) opNode() {}
func (*AssertOp) opNode() {}
func (*AssignmentOp) opNode() {}
func (*CallOp) opNode() {}
func (*CountOp) opNode() {}
func (*CutOp) opNode() {}
func (*DebugOp) opNode() {}
func (*Delete) opNode() {}
Expand Down
1 change: 1 addition & 0 deletions compiler/ast/unpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var unpacker = unpack.New(
CastValue{},
CondExpr{},
ConstDecl{},
CountOp{},
CutOp{},
DateTypeHack{},
DebugOp{},
Expand Down
6 changes: 6 additions & 0 deletions compiler/dag/op.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ type (
CombineOp struct {
Kind string `json:"kind" unpack:""`
}
CountOp struct {
Kind string `json:"kind" unpack:""`
Alias string `json:"alias"`
Expr Expr `json:"expr"`
}
CutOp struct {
Kind string `json:"kind" unpack:""`
Args []Assignment `json:"args"`
Expand Down Expand Up @@ -205,6 +210,7 @@ type (

func (*AggregateOp) opNode() {}
func (*CombineOp) opNode() {}
func (*CountOp) opNode() {}
func (*CutOp) opNode() {}
func (*DistinctOp) opNode() {}
func (*DropOp) opNode() {}
Expand Down
1 change: 1 addition & 0 deletions compiler/dag/unpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var unpacker = unpack.New(
CombineOp{},
CommitMetaScan{},
CondExpr{},
CountOp{},
CutOp{},
DefaultScan{},
DeleterScan{},
Expand Down
2 changes: 2 additions & 0 deletions compiler/optimizer/demand.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ func demandForSimpleOp(op dag.Op, downstream demand.Demand) demand.Demand {
return d
case *dag.CombineOp:
return downstream
case *dag.CountOp:
return demand.Union(downstream, demandForExpr(op.Expr))
case *dag.CutOp:
return demandForAssignments(op.Args, demand.None())
case *dag.DistinctOp:
Expand Down
2 changes: 2 additions & 0 deletions compiler/optimizer/parallelize.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ func (o *Optimizer) concurrentPath(seq dag.Seq, sortKeys order.SortKeys) (length
return k, sortExprsForSortKeys(sortKeys), true, nil
}
return k, nil, false, nil
case *dag.CountOp:
return k, nil, true, nil
case *dag.SortOp:
if len(op.Exprs) == 0 {
// No analysis for sort without expression since we can't
Expand Down
Loading