Skip to content

Commit

Permalink
describe: Fix Scope channels (#5189)
Browse files Browse the repository at this point in the history
Fix is an issue with compile/describe where the channels inside of a
Scope were not getting properly described.
  • Loading branch information
mattnibs authored Jul 25, 2024
1 parent 07d8eb7 commit f728ad3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions compiler/describe/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ func describeAggs(seq dag.Seq, parents []field.List) []field.List {

func describeOpAggs(op dag.Op, parents []field.List) []field.List {
switch op := op.(type) {
case *dag.Scope:
return describeAggs(op.Body, parents)
case *dag.Fork:
var aggs []field.List
for _, p := range op.Paths {
Expand Down
2 changes: 2 additions & 0 deletions compiler/optimizer/optimizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,8 @@ func (o *Optimizer) propagateSortKeyOp(op dag.Op, parents []order.SortKey) ([]or
case *dag.PoolScan, *dag.Lister, *dag.SeqScan, *dag.DefaultScan:
out, err := o.sortKeyOfSource(op)
return []order.SortKey{out}, err
case *dag.Scope:
return o.propagateSortKey(op.Body, parents)
default:
out, err := o.analyzeSortKey(op, parent)
return []order.SortKey{out}, err
Expand Down
13 changes: 12 additions & 1 deletion service/ztests/query-describe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ inputs:
- name: scope.zed
data: |
type port = uint16
from test1
from test1 | fork (=> pass => yield "bar")
outputs:
- name: stdout
Expand Down Expand Up @@ -181,6 +181,17 @@ outputs:
"inferred": false
},
"channels": [
{
"aggregation_keys": null,
"sort": {
"order": "desc",
"keys": [
[
"ts"
]
]
}
},
{
"aggregation_keys": null,
"sort": null
Expand Down

0 comments on commit f728ad3

Please sign in to comment.