From 1c58b6f9bd01c996d8306fa63fa1c194e72e53f8 Mon Sep 17 00:00:00 2001 From: Joe Elliott Date: Tue, 3 Oct 2023 15:17:43 -0400 Subject: [PATCH 01/14] first pass add Signed-off-by: Joe Elliott --- pkg/traceql/ast.go | 6 +- pkg/traceql/ast_execute.go | 20 + pkg/traceql/ast_validate.go | 2 +- pkg/traceql/enum_operators.go | 15 + pkg/traceql/enum_operators_test.go | 10 + pkg/traceql/expr.y | 18 +- pkg/traceql/expr.y.go | 842 ++++++++++++++++------------- pkg/traceql/lexer.go | 8 +- 8 files changed, 533 insertions(+), 388 deletions(-) diff --git a/pkg/traceql/ast.go b/pkg/traceql/ast.go index 7bbe837564f..ced59a785d0 100644 --- a/pkg/traceql/ast.go +++ b/pkg/traceql/ast.go @@ -234,15 +234,15 @@ type SpansetOperation struct { func (o SpansetOperation) extractConditions(request *FetchSpansRequest) { switch o.Op { - case OpSpansetDescendant, OpSpansetAncestor: + case OpSpansetDescendant, OpSpansetAncestor, OpSpansetNotDescendant, OpSpansetNotAncestor: request.Conditions = append(request.Conditions, Condition{ Attribute: NewIntrinsic(IntrinsicStructuralDescendant), }) - case OpSpansetChild, OpSpansetParent: + case OpSpansetChild, OpSpansetParent, OpSpansetNotChild, OpSpansetNotParent: request.Conditions = append(request.Conditions, Condition{ Attribute: NewIntrinsic(IntrinsicStructuralChild), }) - case OpSpansetSibling: + case OpSpansetSibling, OpSpansetNotSibling: request.Conditions = append(request.Conditions, Condition{ Attribute: NewIntrinsic(IntrinsicStructuralSibling), }) diff --git a/pkg/traceql/ast_execute.go b/pkg/traceql/ast_execute.go index ece3651045a..fb05ca46aed 100644 --- a/pkg/traceql/ast_execute.go +++ b/pkg/traceql/ast_execute.go @@ -101,6 +101,8 @@ func (o SpansetOperation) evaluate(input []*Spanset) (output []*Spanset, err err } case OpSpansetDescendant: + fallthrough + case OpSpansetNotDescendant: spans, err := o.joinSpansets(lhs, rhs, func(l, r Span) bool { return r.DescendantOf(l) }) @@ -114,9 +116,13 @@ func (o SpansetOperation) evaluate(input []*Spanset) (output []*Spanset, err err matchingSpanset := input[i].clone() matchingSpanset.Spans = append([]Span(nil), spans...) output = append(output, matchingSpanset) + } else if o.Op == OpSpansetNotDescendant { + output = lhs // jpe - clone? } case OpSpansetAncestor: + fallthrough + case OpSpansetNotAncestor: spans, err := o.joinSpansets(lhs, rhs, func(l, r Span) bool { // In case of ancestor the lhs becomes descendant of rhs return l.DescendantOf(r) @@ -131,9 +137,13 @@ func (o SpansetOperation) evaluate(input []*Spanset) (output []*Spanset, err err matchingSpanset := input[i].clone() matchingSpanset.Spans = append([]Span(nil), spans...) output = append(output, matchingSpanset) + } else if o.Op == OpSpansetNotAncestor { + output = lhs } case OpSpansetChild: + fallthrough + case OpSpansetNotChild: spans, err := o.joinSpansets(lhs, rhs, func(l, r Span) bool { return r.ChildOf(l) }) @@ -147,9 +157,13 @@ func (o SpansetOperation) evaluate(input []*Spanset) (output []*Spanset, err err matchingSpanset := input[i].clone() matchingSpanset.Spans = append([]Span(nil), spans...) output = append(output, matchingSpanset) + } else if o.Op == OpSpansetNotChild { + output = lhs } case OpSpansetParent: + fallthrough + case OpSpansetNotParent: spans, err := o.joinSpansets(lhs, rhs, func(l, r Span) bool { // In case of parent the lhs becomes child of rhs return l.ChildOf(r) @@ -164,9 +178,13 @@ func (o SpansetOperation) evaluate(input []*Spanset) (output []*Spanset, err err matchingSpanset := input[i].clone() matchingSpanset.Spans = append([]Span(nil), spans...) output = append(output, matchingSpanset) + } else if o.Op == OpSpansetNotParent { // jpe - consolidate + output = lhs } case OpSpansetSibling: + fallthrough + case OpSpansetNotSibling: spans, err := o.joinSpansets(lhs, rhs, func(l, r Span) bool { return r.SiblingOf(l) }) @@ -180,6 +198,8 @@ func (o SpansetOperation) evaluate(input []*Spanset) (output []*Spanset, err err matchingSpanset := input[i].clone() matchingSpanset.Spans = append([]Span(nil), spans...) output = append(output, matchingSpanset) + } else if o.Op == OpSpansetNotSibling { + output = lhs } default: diff --git a/pkg/traceql/ast_validate.go b/pkg/traceql/ast_validate.go index ead581e9d6d..5a489713373 100644 --- a/pkg/traceql/ast_validate.go +++ b/pkg/traceql/ast_validate.go @@ -180,7 +180,7 @@ func (o BinaryOperation) validate() error { } switch o.Op { - case OpSpansetChild, + case OpSpansetChild, // jpe - should this exist? should we add the not operators? OpSpansetParent, OpSpansetDescendant, OpSpansetAncestor, diff --git a/pkg/traceql/enum_operators.go b/pkg/traceql/enum_operators.go index dab6673e113..661c448ca59 100644 --- a/pkg/traceql/enum_operators.go +++ b/pkg/traceql/enum_operators.go @@ -30,6 +30,11 @@ const ( OpSpansetAnd OpSpansetUnion OpSpansetSibling + OpSpansetNotChild + OpSpansetNotParent + OpSpansetNotDescendant + OpSpansetNotAncestor + OpSpansetNotSibling ) func (op Operator) isBoolean() bool { @@ -163,6 +168,16 @@ func (op Operator) String() string { return "~" case OpSpansetUnion: return "||" + case OpSpansetNotChild: + return "!>" + case OpSpansetNotParent: + return "!<" + case OpSpansetNotDescendant: + return "!>>" + case OpSpansetNotAncestor: + return "!<<" + case OpSpansetNotSibling: + return "!~" } return fmt.Sprintf("operator(%d)", op) diff --git a/pkg/traceql/enum_operators_test.go b/pkg/traceql/enum_operators_test.go index d69404c8c61..f97b1c20eb0 100644 --- a/pkg/traceql/enum_operators_test.go +++ b/pkg/traceql/enum_operators_test.go @@ -35,6 +35,11 @@ func TestOperatorIsBoolean(t *testing.T) { {OpSpansetAnd, false}, {OpSpansetUnion, false}, {OpSpansetSibling, false}, + {OpSpansetNotChild, false}, + {OpSpansetNotParent, false}, + {OpSpansetNotDescendant, false}, + {OpSpansetNotAncestor, false}, + {OpSpansetNotSibling, false}, } for _, tc := range tt { @@ -148,6 +153,11 @@ func TestOperatorUnaryTypesValid(t *testing.T) { {OpSpansetAnd, TypeInt, false}, {OpSpansetUnion, TypeInt, false}, {OpSpansetSibling, TypeInt, false}, + {OpSpansetNotChild, TypeInt, false}, + {OpSpansetNotParent, TypeInt, false}, + {OpSpansetNotDescendant, TypeInt, false}, + {OpSpansetNotAncestor, TypeInt, false}, + {OpSpansetNotSibling, TypeInt, false}, // not {OpNot, TypeBoolean, true}, {OpNot, TypeInt, false}, diff --git a/pkg/traceql/expr.y b/pkg/traceql/expr.y index d3f3ef90cb1..f7a7e52d45c 100644 --- a/pkg/traceql/expr.y +++ b/pkg/traceql/expr.y @@ -84,7 +84,7 @@ import ( // Operators are listed with increasing precedence. %left PIPE %left AND OR -%left EQ NEQ LT LTE GT GTE NRE RE DESC ANCE TILDE +%left EQ NEQ LT LTE GT GTE NRE RE DESC ANCE SIBL NOT_DESC NOT_CHILD NOT_ANCE NOT_PARENT %left ADD SUB %left NOT %left MUL DIV MOD @@ -111,7 +111,12 @@ spansetPipelineExpression: // shares the same operators as spansetExpression. sp | spansetPipelineExpression DESC spansetPipelineExpression { $$ = newSpansetOperation(OpSpansetDescendant, $1, $3) } | spansetPipelineExpression ANCE spansetPipelineExpression { $$ = newSpansetOperation(OpSpansetAncestor, $1, $3) } | spansetPipelineExpression OR spansetPipelineExpression { $$ = newSpansetOperation(OpSpansetUnion, $1, $3) } - | spansetPipelineExpression TILDE spansetPipelineExpression { $$ = newSpansetOperation(OpSpansetSibling, $1, $3) } + | spansetPipelineExpression SIBL spansetPipelineExpression { $$ = newSpansetOperation(OpSpansetSibling, $1, $3) } + | spansetPipelineExpression NOT_CHILD spansetPipelineExpression { $$ = newSpansetOperation(OpSpansetNotChild, $1, $3) } + | spansetPipelineExpression NOT_PARENT spansetPipelineExpression { $$ = newSpansetOperation(OpSpansetNotParent, $1, $3) } + | spansetPipelineExpression NOT_DESC spansetPipelineExpression { $$ = newSpansetOperation(OpSpansetNotDescendant, $1, $3) } + | spansetPipelineExpression NOT_ANCE spansetPipelineExpression { $$ = newSpansetOperation(OpSpansetNotAncestor, $1, $3) } + | spansetPipelineExpression NRE spansetPipelineExpression { $$ = newSpansetOperation(OpSpansetNotSibling, $1, $3) } | wrappedSpansetPipeline { $$ = $1 } ; @@ -155,7 +160,14 @@ spansetExpression: // shares the same operators as scalarPipelineExpression. spl | spansetExpression DESC spansetExpression { $$ = newSpansetOperation(OpSpansetDescendant, $1, $3) } | spansetExpression ANCE spansetExpression { $$ = newSpansetOperation(OpSpansetAncestor, $1, $3) } | spansetExpression OR spansetExpression { $$ = newSpansetOperation(OpSpansetUnion, $1, $3) } - | spansetExpression TILDE spansetExpression { $$ = newSpansetOperation(OpSpansetSibling, $1, $3) } + | spansetExpression SIBL spansetExpression { $$ = newSpansetOperation(OpSpansetSibling, $1, $3) } + + | spansetExpression NOT_CHILD spansetExpression { $$ = newSpansetOperation(OpSpansetNotChild, $1, $3) } + | spansetExpression NOT_PARENT spansetExpression { $$ = newSpansetOperation(OpSpansetNotParent, $1, $3) } + | spansetExpression NOT_DESC spansetExpression { $$ = newSpansetOperation(OpSpansetNotDescendant, $1, $3) } + | spansetExpression NOT_ANCE spansetExpression { $$ = newSpansetOperation(OpSpansetNotAncestor, $1, $3) } + | spansetExpression NRE spansetExpression { $$ = newSpansetOperation(OpSpansetNotSibling, $1, $3) } + | spansetFilter { $$ = $1 } ; diff --git a/pkg/traceql/expr.y.go b/pkg/traceql/expr.y.go index 44f54531929..00dedc531f0 100644 --- a/pkg/traceql/expr.y.go +++ b/pkg/traceql/expr.y.go @@ -105,14 +105,18 @@ const NRE = 57400 const RE = 57401 const DESC = 57402 const ANCE = 57403 -const TILDE = 57404 -const ADD = 57405 -const SUB = 57406 -const NOT = 57407 -const MUL = 57408 -const DIV = 57409 -const MOD = 57410 -const POW = 57411 +const SIBL = 57404 +const NOT_DESC = 57405 +const NOT_CHILD = 57406 +const NOT_ANCE = 57407 +const NOT_PARENT = 57408 +const ADD = 57409 +const SUB = 57410 +const NOT = 57411 +const MUL = 57412 +const DIV = 57413 +const MOD = 57414 +const POW = 57415 var yyToknames = [...]string{ "$end", @@ -176,7 +180,11 @@ var yyToknames = [...]string{ "RE", "DESC", "ANCE", - "TILDE", + "SIBL", + "NOT_DESC", + "NOT_CHILD", + "NOT_ANCE", + "NOT_PARENT", "ADD", "SUB", "NOT", @@ -196,125 +204,135 @@ var yyExca = [...]int{ -1, 1, 1, -1, -2, 0, - -1, 203, - 13, 57, - -2, 65, + -1, 223, + 13, 67, + -2, 75, } const yyPrivate = 57344 -const yyLast = 684 +const yyLast = 752 var yyAct = [...]int{ - 72, 5, 201, 2, 6, 8, 7, 181, 18, 235, - 68, 45, 44, 168, 169, 55, 170, 171, 172, 181, - 63, 64, 141, 65, 66, 67, 68, 13, 146, 142, - 117, 28, 239, 118, 121, 119, 141, 48, 132, 134, - 135, 136, 137, 138, 139, 238, 182, 183, 173, 174, - 175, 176, 177, 178, 180, 179, 144, 236, 28, 168, - 169, 229, 170, 171, 172, 181, 170, 171, 172, 181, - 164, 166, 142, 76, 184, 185, 186, 228, 63, 64, - 227, 65, 66, 67, 68, 65, 66, 67, 68, 226, - 156, 158, 159, 160, 161, 162, 163, 50, 51, 190, - 52, 53, 54, 55, 207, 208, 50, 51, 200, 52, - 53, 54, 55, 193, 194, 195, 196, 197, 52, 53, - 54, 55, 145, 148, 198, 173, 174, 175, 176, 177, - 178, 180, 179, 191, 192, 198, 168, 169, 149, 170, - 171, 172, 181, 17, 117, 133, 231, 118, 121, 119, - 199, 203, 205, 36, 41, 125, 116, 38, 115, 37, - 38, 114, 37, 39, 40, 42, 39, 40, 42, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - 220, 221, 222, 223, 224, 199, 56, 57, 58, 59, - 60, 61, 113, 112, 70, 69, 62, 63, 64, 230, - 65, 66, 67, 68, 45, 189, 45, 205, 49, 237, - 182, 183, 173, 174, 175, 176, 177, 178, 180, 179, - 109, 110, 111, 168, 169, 188, 170, 171, 172, 181, - 48, 143, 48, 79, 80, 81, 85, 105, 187, 71, - 73, 78, 77, 84, 82, 83, 87, 86, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 101, 100, 102, 103, 104, 108, 106, 107, 36, 41, - 47, 16, 38, 4, 37, 12, 10, 165, 39, 40, - 42, 120, 234, 1, 79, 80, 81, 85, 105, 0, - 0, 73, 74, 75, 84, 82, 83, 87, 86, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 99, 101, 100, 102, 103, 104, 108, 106, 107, 182, - 183, 173, 174, 175, 176, 177, 178, 180, 179, 233, - 0, 0, 168, 169, 0, 170, 171, 172, 181, 0, - 0, 29, 34, 74, 75, 31, 0, 30, 31, 232, - 30, 32, 33, 35, 32, 33, 35, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 182, 183, 173, 174, - 175, 176, 177, 178, 180, 179, 225, 0, 0, 168, - 169, 0, 170, 171, 172, 181, 182, 183, 173, 174, - 175, 176, 177, 178, 180, 179, 206, 0, 0, 168, - 169, 0, 170, 171, 172, 181, 0, 0, 0, 0, - 0, 0, 0, 182, 183, 173, 174, 175, 176, 177, - 178, 180, 179, 167, 43, 3, 168, 169, 0, 170, - 171, 172, 181, 182, 183, 173, 174, 175, 176, 177, - 178, 180, 179, 146, 0, 0, 168, 169, 0, 170, - 171, 172, 181, 0, 124, 126, 127, 128, 129, 130, - 131, 0, 182, 183, 173, 174, 175, 176, 177, 178, - 180, 179, 0, 0, 0, 168, 169, 0, 170, 171, - 172, 181, 56, 57, 58, 59, 60, 61, 0, 0, - 0, 0, 0, 63, 64, 0, 65, 66, 67, 68, - 56, 57, 58, 59, 60, 61, 0, 0, 0, 0, - 0, 50, 51, 0, 52, 53, 54, 55, 19, 20, - 21, 0, 17, 0, 122, 0, 19, 20, 21, 0, - 17, 0, 204, 0, 19, 20, 21, 0, 17, 0, - 202, 0, 0, 0, 19, 20, 21, 0, 17, 0, - 9, 0, 23, 26, 24, 25, 27, 14, 123, 15, - 23, 26, 24, 25, 27, 14, 140, 15, 23, 26, - 24, 25, 27, 14, 0, 15, 22, 0, 23, 26, - 24, 25, 27, 14, 22, 15, 0, 19, 20, 21, - 0, 17, 22, 122, 19, 20, 21, 0, 0, 0, - 157, 0, 22, 29, 34, 46, 11, 31, 0, 30, - 0, 0, 0, 32, 33, 35, 0, 0, 0, 0, - 0, 23, 26, 24, 25, 27, 0, 0, 23, 26, - 24, 25, 27, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 22, 0, 0, 0, 0, - 0, 0, 22, 0, 0, 147, 150, 151, 152, 153, - 154, 155, 79, 80, 81, 85, 0, 0, 0, 149, - 0, 0, 84, 82, 83, 87, 86, 88, 89, 90, - 91, 92, 93, 94, + 82, 5, 221, 2, 6, 8, 7, 18, 201, 78, + 65, 55, 54, 162, 86, 28, 188, 189, 255, 190, + 191, 192, 201, 190, 191, 192, 201, 13, 259, 258, + 127, 161, 249, 128, 131, 129, 248, 58, 75, 76, + 77, 78, 247, 147, 149, 150, 151, 152, 153, 154, + 155, 156, 157, 158, 159, 202, 203, 193, 194, 195, + 196, 197, 198, 200, 199, 73, 74, 28, 75, 76, + 77, 78, 188, 189, 168, 190, 191, 192, 201, 246, + 184, 186, 227, 228, 204, 205, 206, 62, 63, 64, + 65, 256, 66, 67, 68, 69, 70, 71, 254, 213, + 176, 178, 179, 180, 181, 182, 183, 73, 74, 165, + 75, 76, 77, 78, 60, 61, 220, 62, 63, 64, + 65, 169, 88, 161, 214, 215, 216, 217, 210, 17, + 135, 148, 126, 125, 218, 202, 203, 193, 194, 195, + 196, 197, 198, 200, 199, 19, 20, 21, 124, 17, + 218, 132, 188, 189, 123, 190, 191, 192, 201, 162, + 219, 122, 211, 212, 127, 80, 79, 128, 131, 129, + 223, 87, 225, 119, 120, 121, 253, 251, 57, 23, + 26, 24, 25, 27, 14, 133, 15, 166, 250, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 219, 209, 22, 208, 207, + 16, 72, 4, 202, 203, 193, 194, 195, 196, 197, + 198, 200, 199, 59, 55, 12, 55, 225, 10, 257, + 188, 189, 185, 190, 191, 192, 201, 164, 56, 11, + 130, 73, 74, 1, 75, 76, 77, 78, 0, 0, + 58, 0, 58, 89, 90, 91, 95, 115, 0, 81, + 83, 0, 0, 94, 92, 93, 97, 96, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 111, 110, 112, 113, 114, 118, 116, 117, 0, 0, + 0, 60, 61, 0, 62, 63, 64, 65, 167, 170, + 171, 172, 173, 174, 175, 0, 252, 0, 89, 90, + 91, 95, 115, 0, 0, 83, 84, 85, 94, 92, + 93, 97, 96, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 111, 110, 112, 113, 114, + 118, 116, 117, 202, 203, 193, 194, 195, 196, 197, + 198, 200, 199, 245, 0, 0, 0, 0, 0, 0, + 188, 189, 0, 190, 191, 192, 201, 19, 20, 21, + 0, 84, 85, 177, 43, 0, 42, 226, 52, 0, + 44, 45, 47, 50, 48, 51, 49, 0, 0, 0, + 202, 203, 193, 194, 195, 196, 197, 198, 200, 199, + 187, 23, 26, 24, 25, 27, 0, 188, 189, 0, + 190, 191, 192, 201, 202, 203, 193, 194, 195, 196, + 197, 198, 200, 199, 0, 0, 0, 0, 0, 22, + 0, 188, 189, 0, 190, 191, 192, 201, 0, 202, + 203, 193, 194, 195, 196, 197, 198, 200, 199, 0, + 0, 0, 0, 0, 0, 0, 188, 189, 0, 190, + 191, 192, 201, 202, 203, 193, 194, 195, 196, 197, + 198, 200, 199, 166, 0, 0, 0, 0, 0, 0, + 188, 189, 0, 190, 191, 192, 201, 193, 194, 195, + 196, 197, 198, 200, 199, 0, 0, 0, 0, 0, + 0, 0, 188, 189, 0, 190, 191, 192, 201, 0, + 0, 0, 66, 67, 68, 69, 70, 71, 0, 66, + 67, 68, 69, 70, 71, 0, 0, 73, 74, 0, + 75, 76, 77, 78, 60, 61, 0, 62, 63, 64, + 65, 19, 20, 21, 0, 17, 0, 224, 0, 19, + 20, 21, 0, 17, 0, 222, 0, 19, 20, 21, + 31, 17, 30, 9, 40, 0, 32, 33, 35, 38, + 36, 39, 37, 0, 0, 23, 26, 24, 25, 27, + 14, 0, 15, 23, 26, 24, 25, 27, 14, 163, + 15, 23, 26, 24, 25, 27, 14, 0, 15, 0, + 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, + 0, 22, 19, 20, 21, 160, 17, 0, 132, 22, + 0, 0, 0, 0, 0, 0, 41, 46, 0, 0, + 43, 0, 42, 0, 52, 0, 44, 45, 47, 50, + 48, 51, 49, 0, 0, 0, 23, 26, 24, 25, + 27, 0, 29, 34, 0, 0, 31, 0, 30, 0, + 40, 0, 32, 33, 35, 38, 36, 39, 37, 41, + 46, 0, 0, 43, 22, 42, 0, 52, 0, 44, + 45, 47, 50, 48, 51, 49, 29, 34, 53, 3, + 31, 0, 30, 0, 40, 0, 32, 33, 35, 38, + 36, 39, 37, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 134, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 89, 90, 91, 95, 0, 0, 0, 169, 0, 0, + 94, 92, 93, 97, 96, 98, 99, 100, 101, 102, + 103, 104, } var yyPact = [...]int{ - 538, -1000, -18, 291, -1000, 103, -1000, -1000, -1000, 538, - -1000, 448, -1000, 134, 183, 182, -1000, 228, -1000, -1000, - -1000, -1000, 214, 181, 180, 149, 146, 144, 512, 143, - 143, 143, 143, 143, 143, 143, 133, 133, 133, 133, - 133, 133, 133, 553, 23, 218, 43, 109, 430, 657, - 126, 126, 126, 126, 126, 126, -1000, -1000, -1000, -1000, - -1000, -1000, 588, 588, 588, 588, 588, 588, 588, 279, - 279, -1000, 412, 279, 279, 279, -1000, -1000, -1000, -1000, + 551, -1000, -34, 636, -1000, 619, -1000, -1000, -1000, 551, + -1000, 467, -1000, 40, 154, 153, -1000, 248, -1000, -1000, + -1000, -1000, 167, 149, 142, 136, 121, 120, 139, 118, + 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, + 118, 119, 119, 119, 119, 119, 119, 119, 119, 119, + 119, 119, 119, 602, 110, 576, 224, 96, 460, 725, + 109, 109, 109, 109, 109, 109, -1000, -1000, -1000, -1000, + -1000, -1000, 361, 361, 361, 361, 361, 361, 361, 303, + 303, -1000, 389, 303, 303, 303, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, - -1000, -1000, -1000, -1000, -1000, 234, 221, 201, 95, -1000, - -1000, -1000, 100, 279, 279, 279, 279, 103, -1000, -1000, - -1000, -1000, 581, 96, 294, 528, -1000, -1000, -1000, -1000, - 294, -1000, 106, 133, -1000, -1000, -1000, -1000, 106, -1000, - -1000, -1000, 512, -1000, -1000, -1000, -1000, 34, -1000, 520, - 52, 52, -54, -54, -54, -54, -43, 588, 19, 19, - -59, -59, -59, -59, 383, 91, 160, -1000, 279, 279, - 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, - 279, 279, 279, 279, 363, 0, 0, 41, 32, 29, - 13, 195, 142, -1000, 336, 316, 269, -4, 218, 15, - 44, 9, 528, -1000, 520, -20, -1000, -1000, 279, 0, - 0, -62, -62, -62, -50, -50, -50, -50, -50, -50, - -50, -50, -62, 73, 73, -1000, -1000, -1000, -1000, -1000, - -3, -16, -1000, -1000, -1000, -1000, -1000, 160, -1000, -1000, + -1000, -1000, -1000, -1000, -1000, 205, 204, 202, 124, -1000, + -1000, -1000, 86, 303, 303, 303, 303, 619, -1000, -1000, + -1000, -1000, 606, 104, 506, 543, -1000, -1000, -1000, -1000, + 506, -1000, -1000, -1000, -1000, -1000, -1000, 320, 119, -1000, + -1000, -1000, -1000, 320, -1000, -1000, -1000, -1000, -1000, -1000, + -1000, -1000, 139, -1000, -1000, -1000, -1000, 47, -1000, 535, + 17, 17, -63, -63, -63, -63, -2, 361, -32, -32, + -64, -64, -64, -64, 364, 69, 413, -1000, 303, 303, + 303, 303, 303, 303, 303, 303, 303, 303, 303, 303, + 303, 303, 303, 303, 340, -47, -47, 31, -6, -12, + -16, 184, 173, -1000, 293, 163, 85, 5, 576, 174, + 78, 18, 543, -1000, 535, -36, -1000, -1000, 303, -47, + -47, -65, -65, -65, -51, -51, -51, -51, -51, -51, + -51, -51, -65, 435, 435, -1000, -1000, -1000, -1000, -1000, + -19, -20, -1000, -1000, -1000, -1000, -1000, 413, -1000, -1000, } var yyPgo = [...]int{ - 0, 283, 6, 281, 5, 277, 1, 424, 276, 2, - 275, 4, 196, 273, 605, 27, 271, 270, 8, 0, - 73, 242, 241, + 0, 243, 6, 240, 5, 232, 1, 688, 228, 2, + 225, 4, 211, 212, 238, 27, 210, 178, 7, 0, + 14, 171, 122, } var yyR1 = [...]int{ 0, 1, 1, 1, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 8, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 2, 3, 4, 5, 5, 6, 6, + 7, 7, 7, 7, 7, 7, 7, 7, 8, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 2, 3, + 4, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 10, 10, 11, 12, 12, 12, 12, 12, 12, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 16, 17, 15, 15, @@ -330,8 +348,9 @@ var yyR1 = [...]int{ var yyR2 = [...]int{ 0, 1, 1, 1, 3, 3, 3, 3, 3, 3, - 3, 3, 1, 3, 1, 1, 1, 1, 3, 3, - 3, 3, 3, 4, 3, 4, 1, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 1, 3, 1, + 1, 1, 1, 3, 3, 3, 3, 3, 4, 3, + 4, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 2, 3, 3, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, @@ -348,23 +367,25 @@ var yyChk = [...]int{ -1000, -1, -9, -7, -13, -6, -11, -2, -4, 12, -8, -14, -10, -15, 45, 47, -16, 10, -18, 6, - 7, 8, 64, 40, 42, 43, 41, 44, 49, 50, - 56, 54, 60, 61, 51, 62, 50, 56, 54, 60, - 61, 51, 62, -7, -9, -6, -14, -17, -15, -12, - 63, 64, 66, 67, 68, 69, 52, 53, 54, 55, - 56, 57, -12, 63, 64, 66, 67, 68, 69, 12, - 12, 11, -19, 12, 64, 65, -20, -21, -22, 5, + 7, 8, 68, 40, 42, 43, 41, 44, 49, 50, + 56, 54, 60, 61, 51, 62, 64, 66, 63, 65, + 58, 50, 56, 54, 60, 61, 51, 62, 64, 66, + 63, 65, 58, -7, -9, -6, -14, -17, -15, -12, + 67, 68, 70, 71, 72, 73, 52, 53, 54, 55, + 56, 57, -12, 67, 68, 70, 71, 72, 73, 12, + 12, 11, -19, 12, 68, 69, -20, -21, -22, 5, 6, 7, 16, 17, 15, 8, 19, 18, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 32, 34, 35, 36, 9, 38, 39, 37, 6, 7, 8, 12, 12, 12, 12, 12, -6, -11, -2, -3, -4, 12, 46, -7, 12, -7, -7, -7, -7, - -7, -7, -6, 12, -6, -6, -6, -6, -6, -6, + -7, -7, -7, -7, -7, -7, -7, -6, 12, -6, + -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, 13, 13, 49, 13, 13, 13, 13, -14, -20, 12, -14, -14, -14, -14, -14, -14, -15, 12, -15, -15, - -15, -15, -15, -15, -19, -5, -19, 11, 63, 64, - 66, 67, 68, 52, 53, 54, 55, 56, 57, 59, - 58, 69, 50, 51, -19, -19, -19, 4, 4, 4, + -15, -15, -15, -15, -19, -5, -19, 11, 67, 68, + 70, 71, 72, 52, 53, 54, 55, 56, 57, 59, + 58, 73, 50, 51, -19, -19, -19, 4, 4, 4, 4, 38, 39, 13, -19, -19, -19, -19, -6, -15, 12, -9, 12, -18, 12, -9, 13, 13, 14, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, @@ -373,30 +394,32 @@ var yyChk = [...]int{ } var yyDef = [...]int{ - 0, -2, 1, 2, 3, 14, 15, 16, 17, 0, - 12, 0, 36, 0, 0, 0, 55, 0, 65, 66, - 67, 68, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -2, 1, 2, 3, 19, 20, 21, 22, 0, + 17, 0, 46, 0, 0, 0, 65, 0, 75, 76, + 77, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 40, 41, 42, 43, - 44, 45, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 37, 0, 0, 0, 0, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 50, 51, 52, 53, + 54, 55, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 47, 0, 0, 0, 0, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 0, 0, 0, 0, 69, - 70, 71, 0, 0, 0, 0, 0, 18, 19, 20, - 21, 22, 0, 0, 5, 0, 6, 7, 8, 9, - 10, 11, 29, 0, 30, 31, 32, 33, 34, 35, - 4, 13, 0, 28, 48, 56, 58, 46, 47, 0, - 49, 50, 51, 52, 53, 54, 39, 0, 59, 60, - 61, 62, 63, 64, 0, 0, 26, 38, 0, 0, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 0, 0, 0, 0, 79, + 80, 81, 0, 0, 0, 0, 0, 23, 24, 25, + 26, 27, 0, 0, 5, 0, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 34, 0, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 4, 18, 0, 33, 58, 66, 68, 56, 57, 0, + 59, 60, 61, 62, 63, 64, 49, 0, 69, 70, + 71, 72, 73, 74, 0, 0, 31, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 94, 95, 0, 0, 0, - 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, - 0, 0, 0, -2, 0, 0, 23, 25, 0, 78, - 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, - 89, 90, 91, 92, 93, 77, 125, 126, 127, 128, - 0, 0, 73, 74, 75, 76, 24, 27, 129, 130, + 0, 0, 0, 0, 0, 104, 105, 0, 0, 0, + 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -2, 0, 0, 28, 30, 0, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 87, 135, 136, 137, 138, + 0, 0, 83, 84, 85, 86, 29, 32, 139, 140, } var yyTok1 = [...]int{ @@ -410,7 +433,8 @@ var yyTok2 = [...]int{ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, } var yyTok3 = [...]int{ 0, @@ -820,716 +844,776 @@ yydefault: yyVAL.spansetPipelineExpression = newSpansetOperation(OpSpansetSibling, yyDollar[1].spansetPipelineExpression, yyDollar[3].spansetPipelineExpression) } case 12: - yyDollar = yyS[yypt-1 : yypt+1] + yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:115 { - yyVAL.spansetPipelineExpression = yyDollar[1].wrappedSpansetPipeline + yyVAL.spansetPipelineExpression = newSpansetOperation(OpSpansetNotChild, yyDollar[1].spansetPipelineExpression, yyDollar[3].spansetPipelineExpression) } case 13: yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:116 + { + yyVAL.spansetPipelineExpression = newSpansetOperation(OpSpansetNotParent, yyDollar[1].spansetPipelineExpression, yyDollar[3].spansetPipelineExpression) + } + case 14: + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:117 + { + yyVAL.spansetPipelineExpression = newSpansetOperation(OpSpansetNotDescendant, yyDollar[1].spansetPipelineExpression, yyDollar[3].spansetPipelineExpression) + } + case 15: + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:118 + { + yyVAL.spansetPipelineExpression = newSpansetOperation(OpSpansetNotAncestor, yyDollar[1].spansetPipelineExpression, yyDollar[3].spansetPipelineExpression) + } + case 16: + yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:119 + { + yyVAL.spansetPipelineExpression = newSpansetOperation(OpSpansetNotSibling, yyDollar[1].spansetPipelineExpression, yyDollar[3].spansetPipelineExpression) + } + case 17: + yyDollar = yyS[yypt-1 : yypt+1] +//line pkg/traceql/expr.y:120 + { + yyVAL.spansetPipelineExpression = yyDollar[1].wrappedSpansetPipeline + } + case 18: + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:124 { yyVAL.wrappedSpansetPipeline = yyDollar[2].spansetPipeline } - case 14: + case 19: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:122 +//line pkg/traceql/expr.y:127 { yyVAL.spansetPipeline = newPipeline(yyDollar[1].spansetExpression) } - case 15: + case 20: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:123 +//line pkg/traceql/expr.y:128 { yyVAL.spansetPipeline = newPipeline(yyDollar[1].scalarFilter) } - case 16: + case 21: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:124 +//line pkg/traceql/expr.y:129 { yyVAL.spansetPipeline = newPipeline(yyDollar[1].groupOperation) } - case 17: + case 22: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:125 +//line pkg/traceql/expr.y:130 { yyVAL.spansetPipeline = newPipeline(yyDollar[1].selectOperation) } - case 18: + case 23: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:126 +//line pkg/traceql/expr.y:131 { yyVAL.spansetPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].spansetExpression) } - case 19: + case 24: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:127 +//line pkg/traceql/expr.y:132 { yyVAL.spansetPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].scalarFilter) } - case 20: + case 25: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:128 +//line pkg/traceql/expr.y:133 { yyVAL.spansetPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].groupOperation) } - case 21: + case 26: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:129 +//line pkg/traceql/expr.y:134 { yyVAL.spansetPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].coalesceOperation) } - case 22: + case 27: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:130 +//line pkg/traceql/expr.y:135 { yyVAL.spansetPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].selectOperation) } - case 23: + case 28: yyDollar = yyS[yypt-4 : yypt+1] -//line pkg/traceql/expr.y:134 +//line pkg/traceql/expr.y:139 { yyVAL.groupOperation = newGroupOperation(yyDollar[3].fieldExpression) } - case 24: + case 29: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:138 +//line pkg/traceql/expr.y:143 { yyVAL.coalesceOperation = newCoalesceOperation() } - case 25: + case 30: yyDollar = yyS[yypt-4 : yypt+1] -//line pkg/traceql/expr.y:142 +//line pkg/traceql/expr.y:147 { yyVAL.selectOperation = newSelectOperation(yyDollar[3].selectArgs) } - case 26: + case 31: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:146 +//line pkg/traceql/expr.y:151 { yyVAL.selectArgs = []FieldExpression{yyDollar[1].fieldExpression} } - case 27: + case 32: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:147 +//line pkg/traceql/expr.y:152 { yyVAL.selectArgs = append(yyDollar[1].selectArgs, yyDollar[3].fieldExpression) } - case 28: + case 33: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:151 +//line pkg/traceql/expr.y:156 { yyVAL.spansetExpression = yyDollar[2].spansetExpression } - case 29: + case 34: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:152 +//line pkg/traceql/expr.y:157 { yyVAL.spansetExpression = newSpansetOperation(OpSpansetAnd, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } - case 30: + case 35: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:153 +//line pkg/traceql/expr.y:158 { yyVAL.spansetExpression = newSpansetOperation(OpSpansetChild, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } - case 31: + case 36: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:154 +//line pkg/traceql/expr.y:159 { yyVAL.spansetExpression = newSpansetOperation(OpSpansetParent, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } - case 32: + case 37: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:155 +//line pkg/traceql/expr.y:160 { yyVAL.spansetExpression = newSpansetOperation(OpSpansetDescendant, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } - case 33: + case 38: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:156 +//line pkg/traceql/expr.y:161 { yyVAL.spansetExpression = newSpansetOperation(OpSpansetAncestor, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } - case 34: + case 39: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:157 +//line pkg/traceql/expr.y:162 { yyVAL.spansetExpression = newSpansetOperation(OpSpansetUnion, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } - case 35: + case 40: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:158 +//line pkg/traceql/expr.y:163 { yyVAL.spansetExpression = newSpansetOperation(OpSpansetSibling, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } - case 36: + case 41: + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:165 + { + yyVAL.spansetExpression = newSpansetOperation(OpSpansetNotChild, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + } + case 42: + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:166 + { + yyVAL.spansetExpression = newSpansetOperation(OpSpansetNotParent, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + } + case 43: + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:167 + { + yyVAL.spansetExpression = newSpansetOperation(OpSpansetNotDescendant, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + } + case 44: + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:168 + { + yyVAL.spansetExpression = newSpansetOperation(OpSpansetNotAncestor, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + } + case 45: + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:169 + { + yyVAL.spansetExpression = newSpansetOperation(OpSpansetNotSibling, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + } + case 46: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:159 +//line pkg/traceql/expr.y:171 { yyVAL.spansetExpression = yyDollar[1].spansetFilter } - case 37: + case 47: yyDollar = yyS[yypt-2 : yypt+1] -//line pkg/traceql/expr.y:163 +//line pkg/traceql/expr.y:175 { yyVAL.spansetFilter = newSpansetFilter(NewStaticBool(true)) } - case 38: + case 48: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:164 +//line pkg/traceql/expr.y:176 { yyVAL.spansetFilter = newSpansetFilter(yyDollar[2].fieldExpression) } - case 39: + case 49: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:168 +//line pkg/traceql/expr.y:180 { yyVAL.scalarFilter = newScalarFilter(yyDollar[2].scalarFilterOperation, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) } - case 40: + case 50: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:172 +//line pkg/traceql/expr.y:184 { yyVAL.scalarFilterOperation = OpEqual } - case 41: + case 51: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:173 +//line pkg/traceql/expr.y:185 { yyVAL.scalarFilterOperation = OpNotEqual } - case 42: + case 52: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:174 +//line pkg/traceql/expr.y:186 { yyVAL.scalarFilterOperation = OpLess } - case 43: + case 53: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:175 +//line pkg/traceql/expr.y:187 { yyVAL.scalarFilterOperation = OpLessEqual } - case 44: + case 54: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:176 +//line pkg/traceql/expr.y:188 { yyVAL.scalarFilterOperation = OpGreater } - case 45: + case 55: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:177 +//line pkg/traceql/expr.y:189 { yyVAL.scalarFilterOperation = OpGreaterEqual } - case 46: + case 56: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:184 +//line pkg/traceql/expr.y:196 { yyVAL.scalarPipelineExpressionFilter = newScalarFilter(yyDollar[2].scalarFilterOperation, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) } - case 47: + case 57: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:185 +//line pkg/traceql/expr.y:197 { yyVAL.scalarPipelineExpressionFilter = newScalarFilter(yyDollar[2].scalarFilterOperation, yyDollar[1].scalarPipelineExpression, yyDollar[3].static) } - case 48: + case 58: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:189 +//line pkg/traceql/expr.y:201 { yyVAL.scalarPipelineExpression = yyDollar[2].scalarPipelineExpression } - case 49: + case 59: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:190 +//line pkg/traceql/expr.y:202 { yyVAL.scalarPipelineExpression = newScalarOperation(OpAdd, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) } - case 50: + case 60: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:191 +//line pkg/traceql/expr.y:203 { yyVAL.scalarPipelineExpression = newScalarOperation(OpSub, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) } - case 51: + case 61: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:192 +//line pkg/traceql/expr.y:204 { yyVAL.scalarPipelineExpression = newScalarOperation(OpMult, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) } - case 52: + case 62: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:193 +//line pkg/traceql/expr.y:205 { yyVAL.scalarPipelineExpression = newScalarOperation(OpDiv, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) } - case 53: + case 63: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:194 +//line pkg/traceql/expr.y:206 { yyVAL.scalarPipelineExpression = newScalarOperation(OpMod, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) } - case 54: + case 64: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:195 +//line pkg/traceql/expr.y:207 { yyVAL.scalarPipelineExpression = newScalarOperation(OpPower, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) } - case 55: + case 65: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:196 +//line pkg/traceql/expr.y:208 { yyVAL.scalarPipelineExpression = yyDollar[1].wrappedScalarPipeline } - case 56: + case 66: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:200 +//line pkg/traceql/expr.y:212 { yyVAL.wrappedScalarPipeline = yyDollar[2].scalarPipeline } - case 57: + case 67: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:204 +//line pkg/traceql/expr.y:216 { yyVAL.scalarPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].aggregate) } - case 58: + case 68: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:208 +//line pkg/traceql/expr.y:220 { yyVAL.scalarExpression = yyDollar[2].scalarExpression } - case 59: + case 69: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:209 +//line pkg/traceql/expr.y:221 { yyVAL.scalarExpression = newScalarOperation(OpAdd, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) } - case 60: + case 70: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:210 +//line pkg/traceql/expr.y:222 { yyVAL.scalarExpression = newScalarOperation(OpSub, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) } - case 61: + case 71: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:211 +//line pkg/traceql/expr.y:223 { yyVAL.scalarExpression = newScalarOperation(OpMult, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) } - case 62: + case 72: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:212 +//line pkg/traceql/expr.y:224 { yyVAL.scalarExpression = newScalarOperation(OpDiv, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) } - case 63: + case 73: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:213 +//line pkg/traceql/expr.y:225 { yyVAL.scalarExpression = newScalarOperation(OpMod, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) } - case 64: + case 74: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:214 +//line pkg/traceql/expr.y:226 { yyVAL.scalarExpression = newScalarOperation(OpPower, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) } - case 65: + case 75: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:215 +//line pkg/traceql/expr.y:227 { yyVAL.scalarExpression = yyDollar[1].aggregate } - case 66: + case 76: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:216 +//line pkg/traceql/expr.y:228 { yyVAL.scalarExpression = NewStaticInt(yyDollar[1].staticInt) } - case 67: + case 77: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:217 +//line pkg/traceql/expr.y:229 { yyVAL.scalarExpression = NewStaticFloat(yyDollar[1].staticFloat) } - case 68: + case 78: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:218 +//line pkg/traceql/expr.y:230 { yyVAL.scalarExpression = NewStaticDuration(yyDollar[1].staticDuration) } - case 69: + case 79: yyDollar = yyS[yypt-2 : yypt+1] -//line pkg/traceql/expr.y:219 +//line pkg/traceql/expr.y:231 { yyVAL.scalarExpression = NewStaticInt(-yyDollar[2].staticInt) } - case 70: + case 80: yyDollar = yyS[yypt-2 : yypt+1] -//line pkg/traceql/expr.y:220 +//line pkg/traceql/expr.y:232 { yyVAL.scalarExpression = NewStaticFloat(-yyDollar[2].staticFloat) } - case 71: + case 81: yyDollar = yyS[yypt-2 : yypt+1] -//line pkg/traceql/expr.y:221 +//line pkg/traceql/expr.y:233 { yyVAL.scalarExpression = NewStaticDuration(-yyDollar[2].staticDuration) } - case 72: + case 82: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:225 +//line pkg/traceql/expr.y:237 { yyVAL.aggregate = newAggregate(aggregateCount, nil) } - case 73: + case 83: yyDollar = yyS[yypt-4 : yypt+1] -//line pkg/traceql/expr.y:226 +//line pkg/traceql/expr.y:238 { yyVAL.aggregate = newAggregate(aggregateMax, yyDollar[3].fieldExpression) } - case 74: + case 84: yyDollar = yyS[yypt-4 : yypt+1] -//line pkg/traceql/expr.y:227 +//line pkg/traceql/expr.y:239 { yyVAL.aggregate = newAggregate(aggregateMin, yyDollar[3].fieldExpression) } - case 75: + case 85: yyDollar = yyS[yypt-4 : yypt+1] -//line pkg/traceql/expr.y:228 +//line pkg/traceql/expr.y:240 { yyVAL.aggregate = newAggregate(aggregateAvg, yyDollar[3].fieldExpression) } - case 76: + case 86: yyDollar = yyS[yypt-4 : yypt+1] -//line pkg/traceql/expr.y:229 +//line pkg/traceql/expr.y:241 { yyVAL.aggregate = newAggregate(aggregateSum, yyDollar[3].fieldExpression) } - case 77: + case 87: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:236 +//line pkg/traceql/expr.y:248 { yyVAL.fieldExpression = yyDollar[2].fieldExpression } - case 78: + case 88: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:237 +//line pkg/traceql/expr.y:249 { yyVAL.fieldExpression = newBinaryOperation(OpAdd, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } - case 79: + case 89: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:238 +//line pkg/traceql/expr.y:250 { yyVAL.fieldExpression = newBinaryOperation(OpSub, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } - case 80: + case 90: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:239 +//line pkg/traceql/expr.y:251 { yyVAL.fieldExpression = newBinaryOperation(OpMult, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } - case 81: + case 91: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:240 +//line pkg/traceql/expr.y:252 { yyVAL.fieldExpression = newBinaryOperation(OpDiv, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } - case 82: + case 92: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:241 +//line pkg/traceql/expr.y:253 { yyVAL.fieldExpression = newBinaryOperation(OpMod, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } - case 83: + case 93: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:242 +//line pkg/traceql/expr.y:254 { yyVAL.fieldExpression = newBinaryOperation(OpEqual, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } - case 84: + case 94: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:243 +//line pkg/traceql/expr.y:255 { yyVAL.fieldExpression = newBinaryOperation(OpNotEqual, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } - case 85: + case 95: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:244 +//line pkg/traceql/expr.y:256 { yyVAL.fieldExpression = newBinaryOperation(OpLess, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } - case 86: + case 96: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:245 +//line pkg/traceql/expr.y:257 { yyVAL.fieldExpression = newBinaryOperation(OpLessEqual, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } - case 87: + case 97: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:246 +//line pkg/traceql/expr.y:258 { yyVAL.fieldExpression = newBinaryOperation(OpGreater, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } - case 88: + case 98: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:247 +//line pkg/traceql/expr.y:259 { yyVAL.fieldExpression = newBinaryOperation(OpGreaterEqual, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } - case 89: + case 99: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:248 +//line pkg/traceql/expr.y:260 { yyVAL.fieldExpression = newBinaryOperation(OpRegex, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } - case 90: + case 100: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:249 +//line pkg/traceql/expr.y:261 { yyVAL.fieldExpression = newBinaryOperation(OpNotRegex, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } - case 91: + case 101: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:250 +//line pkg/traceql/expr.y:262 { yyVAL.fieldExpression = newBinaryOperation(OpPower, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } - case 92: + case 102: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:251 +//line pkg/traceql/expr.y:263 { yyVAL.fieldExpression = newBinaryOperation(OpAnd, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } - case 93: + case 103: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:252 +//line pkg/traceql/expr.y:264 { yyVAL.fieldExpression = newBinaryOperation(OpOr, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } - case 94: + case 104: yyDollar = yyS[yypt-2 : yypt+1] -//line pkg/traceql/expr.y:253 +//line pkg/traceql/expr.y:265 { yyVAL.fieldExpression = newUnaryOperation(OpSub, yyDollar[2].fieldExpression) } - case 95: + case 105: yyDollar = yyS[yypt-2 : yypt+1] -//line pkg/traceql/expr.y:254 +//line pkg/traceql/expr.y:266 { yyVAL.fieldExpression = newUnaryOperation(OpNot, yyDollar[2].fieldExpression) } - case 96: + case 106: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:255 +//line pkg/traceql/expr.y:267 { yyVAL.fieldExpression = yyDollar[1].static } - case 97: + case 107: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:256 +//line pkg/traceql/expr.y:268 { yyVAL.fieldExpression = yyDollar[1].intrinsicField } - case 98: + case 108: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:257 +//line pkg/traceql/expr.y:269 { yyVAL.fieldExpression = yyDollar[1].attributeField } - case 99: + case 109: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:264 +//line pkg/traceql/expr.y:276 { yyVAL.static = NewStaticString(yyDollar[1].staticStr) } - case 100: + case 110: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:265 +//line pkg/traceql/expr.y:277 { yyVAL.static = NewStaticInt(yyDollar[1].staticInt) } - case 101: + case 111: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:266 +//line pkg/traceql/expr.y:278 { yyVAL.static = NewStaticFloat(yyDollar[1].staticFloat) } - case 102: + case 112: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:267 +//line pkg/traceql/expr.y:279 { yyVAL.static = NewStaticBool(true) } - case 103: + case 113: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:268 +//line pkg/traceql/expr.y:280 { yyVAL.static = NewStaticBool(false) } - case 104: + case 114: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:269 +//line pkg/traceql/expr.y:281 { yyVAL.static = NewStaticNil() } - case 105: + case 115: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:270 +//line pkg/traceql/expr.y:282 { yyVAL.static = NewStaticDuration(yyDollar[1].staticDuration) } - case 106: + case 116: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:271 +//line pkg/traceql/expr.y:283 { yyVAL.static = NewStaticStatus(StatusOk) } - case 107: + case 117: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:272 +//line pkg/traceql/expr.y:284 { yyVAL.static = NewStaticStatus(StatusError) } - case 108: + case 118: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:273 +//line pkg/traceql/expr.y:285 { yyVAL.static = NewStaticStatus(StatusUnset) } - case 109: + case 119: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:274 +//line pkg/traceql/expr.y:286 { yyVAL.static = NewStaticKind(KindUnspecified) } - case 110: + case 120: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:275 +//line pkg/traceql/expr.y:287 { yyVAL.static = NewStaticKind(KindInternal) } - case 111: + case 121: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:276 +//line pkg/traceql/expr.y:288 { yyVAL.static = NewStaticKind(KindServer) } - case 112: + case 122: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:277 +//line pkg/traceql/expr.y:289 { yyVAL.static = NewStaticKind(KindClient) } - case 113: + case 123: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:278 +//line pkg/traceql/expr.y:290 { yyVAL.static = NewStaticKind(KindProducer) } - case 114: + case 124: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:279 +//line pkg/traceql/expr.y:291 { yyVAL.static = NewStaticKind(KindConsumer) } - case 115: + case 125: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:283 +//line pkg/traceql/expr.y:295 { yyVAL.intrinsicField = NewIntrinsic(IntrinsicDuration) } - case 116: + case 126: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:284 +//line pkg/traceql/expr.y:296 { yyVAL.intrinsicField = NewIntrinsic(IntrinsicChildCount) } - case 117: + case 127: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:285 +//line pkg/traceql/expr.y:297 { yyVAL.intrinsicField = NewIntrinsic(IntrinsicName) } - case 118: + case 128: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:286 +//line pkg/traceql/expr.y:298 { yyVAL.intrinsicField = NewIntrinsic(IntrinsicStatus) } - case 119: + case 129: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:287 +//line pkg/traceql/expr.y:299 { yyVAL.intrinsicField = NewIntrinsic(IntrinsicStatusMessage) } - case 120: + case 130: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:288 +//line pkg/traceql/expr.y:300 { yyVAL.intrinsicField = NewIntrinsic(IntrinsicKind) } - case 121: + case 131: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:289 +//line pkg/traceql/expr.y:301 { yyVAL.intrinsicField = NewIntrinsic(IntrinsicParent) } - case 122: + case 132: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:290 +//line pkg/traceql/expr.y:302 { yyVAL.intrinsicField = NewIntrinsic(IntrinsicTraceRootSpan) } - case 123: + case 133: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:291 +//line pkg/traceql/expr.y:303 { yyVAL.intrinsicField = NewIntrinsic(IntrinsicTraceRootService) } - case 124: + case 134: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:292 +//line pkg/traceql/expr.y:304 { yyVAL.intrinsicField = NewIntrinsic(IntrinsicTraceDuration) } - case 125: + case 135: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:296 +//line pkg/traceql/expr.y:308 { yyVAL.attributeField = NewAttribute(yyDollar[2].staticStr) } - case 126: + case 136: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:297 +//line pkg/traceql/expr.y:309 { yyVAL.attributeField = NewScopedAttribute(AttributeScopeResource, false, yyDollar[2].staticStr) } - case 127: + case 137: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:298 +//line pkg/traceql/expr.y:310 { yyVAL.attributeField = NewScopedAttribute(AttributeScopeSpan, false, yyDollar[2].staticStr) } - case 128: + case 138: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:299 +//line pkg/traceql/expr.y:311 { yyVAL.attributeField = NewScopedAttribute(AttributeScopeNone, true, yyDollar[2].staticStr) } - case 129: + case 139: yyDollar = yyS[yypt-4 : yypt+1] -//line pkg/traceql/expr.y:300 +//line pkg/traceql/expr.y:312 { yyVAL.attributeField = NewScopedAttribute(AttributeScopeResource, true, yyDollar[3].staticStr) } - case 130: + case 140: yyDollar = yyS[yypt-4 : yypt+1] -//line pkg/traceql/expr.y:301 +//line pkg/traceql/expr.y:313 { yyVAL.attributeField = NewScopedAttribute(AttributeScopeSpan, true, yyDollar[3].staticStr) } diff --git a/pkg/traceql/lexer.go b/pkg/traceql/lexer.go index 6fac53b30ac..11f33c71b78 100644 --- a/pkg/traceql/lexer.go +++ b/pkg/traceql/lexer.go @@ -20,7 +20,7 @@ var tokens = map[string]int{ "=": EQ, "!=": NEQ, "=~": RE, - "!~": NRE, + "!~": NRE, // also "not sibling" ">": GT, ">=": GTE, "<": LT, @@ -49,7 +49,11 @@ var tokens = map[string]int{ "|": PIPE, ">>": DESC, "<<": ANCE, - "~": TILDE, + "~": SIBL, + "!>>": NOT_DESC, + "!>": NOT_CHILD, + "!<<": NOT_ANCE, + "!<": NOT_PARENT, "duration": IDURATION, "childCount": CHILDCOUNT, "name": NAME, From e06d862bfe37acad4bd651269aa79cbb16c8e937 Mon Sep 17 00:00:00 2001 From: Joe Elliott Date: Wed, 4 Oct 2023 08:55:44 -0400 Subject: [PATCH 02/14] fix and tests Signed-off-by: Joe Elliott --- Makefile | 2 +- pkg/traceql/ast_execute.go | 51 ++++++++++++---------- pkg/traceql/ast_execute_test.go | 75 +++++++++++++++++++++++++++++++++ pkg/traceql/lexer_test.go | 9 ++++ 4 files changed, 113 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index f57b75f3237..99c2198a2d4 100644 --- a/Makefile +++ b/Makefile @@ -160,7 +160,7 @@ lint: .PHONY: docker-component # Not intended to be used directly docker-component: check-component exe - docker build -t grafana/$(COMPONENT) --build-arg=TARGETARCH=$(GOARCH) -f ./cmd/$(COMPONENT)/Dockerfile . + docker build -t grafana/$(COMPONENT) --load --build-arg=TARGETARCH=$(GOARCH) -f ./cmd/$(COMPONENT)/Dockerfile . docker tag grafana/$(COMPONENT) $(COMPONENT) .PHONY: docker-component-debug diff --git a/pkg/traceql/ast_execute.go b/pkg/traceql/ast_execute.go index fb05ca46aed..4e4361d6a79 100644 --- a/pkg/traceql/ast_execute.go +++ b/pkg/traceql/ast_execute.go @@ -103,7 +103,7 @@ func (o SpansetOperation) evaluate(input []*Spanset) (output []*Spanset, err err case OpSpansetDescendant: fallthrough case OpSpansetNotDescendant: - spans, err := o.joinSpansets(lhs, rhs, func(l, r Span) bool { + spans, err := o.joinSpansets(lhs, rhs, o.Op == OpSpansetDescendant, func(l, r Span) bool { return r.DescendantOf(l) }) if err != nil { @@ -116,14 +116,12 @@ func (o SpansetOperation) evaluate(input []*Spanset) (output []*Spanset, err err matchingSpanset := input[i].clone() matchingSpanset.Spans = append([]Span(nil), spans...) output = append(output, matchingSpanset) - } else if o.Op == OpSpansetNotDescendant { - output = lhs // jpe - clone? } case OpSpansetAncestor: fallthrough case OpSpansetNotAncestor: - spans, err := o.joinSpansets(lhs, rhs, func(l, r Span) bool { + spans, err := o.joinSpansets(lhs, rhs, o.Op == OpSpansetAncestor, func(l, r Span) bool { // In case of ancestor the lhs becomes descendant of rhs return l.DescendantOf(r) }) @@ -137,14 +135,12 @@ func (o SpansetOperation) evaluate(input []*Spanset) (output []*Spanset, err err matchingSpanset := input[i].clone() matchingSpanset.Spans = append([]Span(nil), spans...) output = append(output, matchingSpanset) - } else if o.Op == OpSpansetNotAncestor { - output = lhs } case OpSpansetChild: fallthrough case OpSpansetNotChild: - spans, err := o.joinSpansets(lhs, rhs, func(l, r Span) bool { + spans, err := o.joinSpansets(lhs, rhs, o.Op == OpSpansetChild, func(l, r Span) bool { return r.ChildOf(l) }) if err != nil { @@ -157,14 +153,12 @@ func (o SpansetOperation) evaluate(input []*Spanset) (output []*Spanset, err err matchingSpanset := input[i].clone() matchingSpanset.Spans = append([]Span(nil), spans...) output = append(output, matchingSpanset) - } else if o.Op == OpSpansetNotChild { - output = lhs } case OpSpansetParent: fallthrough case OpSpansetNotParent: - spans, err := o.joinSpansets(lhs, rhs, func(l, r Span) bool { + spans, err := o.joinSpansets(lhs, rhs, o.Op == OpSpansetParent, func(l, r Span) bool { // In case of parent the lhs becomes child of rhs return l.ChildOf(r) }) @@ -178,14 +172,12 @@ func (o SpansetOperation) evaluate(input []*Spanset) (output []*Spanset, err err matchingSpanset := input[i].clone() matchingSpanset.Spans = append([]Span(nil), spans...) output = append(output, matchingSpanset) - } else if o.Op == OpSpansetNotParent { // jpe - consolidate - output = lhs } case OpSpansetSibling: fallthrough case OpSpansetNotSibling: - spans, err := o.joinSpansets(lhs, rhs, func(l, r Span) bool { + spans, err := o.joinSpansets(lhs, rhs, o.Op == OpSpansetSibling, func(l, r Span) bool { return r.SiblingOf(l) }) if err != nil { @@ -198,8 +190,6 @@ func (o SpansetOperation) evaluate(input []*Spanset) (output []*Spanset, err err matchingSpanset := input[i].clone() matchingSpanset.Spans = append([]Span(nil), spans...) output = append(output, matchingSpanset) - } else if o.Op == OpSpansetNotSibling { - output = lhs } default: @@ -213,7 +203,7 @@ func (o SpansetOperation) evaluate(input []*Spanset) (output []*Spanset, err err // joinSpansets compares all pairwise combinations of the inputs and returns the right-hand side // where the eval callback returns true. For now the behavior is only defined when there is exactly one // spanset on both sides and will return an error if multiple spansets are present. -func (o *SpansetOperation) joinSpansets(lhs, rhs []*Spanset, eval func(l, r Span) bool) ([]Span, error) { +func (o *SpansetOperation) joinSpansets(lhs, rhs []*Spanset, rhsPositive bool, eval func(l, r Span) bool) ([]Span, error) { if len(lhs) < 1 || len(rhs) < 1 { return nil, nil } @@ -222,25 +212,40 @@ func (o *SpansetOperation) joinSpansets(lhs, rhs []*Spanset, eval func(l, r Span return nil, errSpansetOperationMultiple } - return o.joinSpansAndReturnRHS(lhs[0].Spans, rhs[0].Spans, eval), nil + return o.joinSpansAndReturnRHS(lhs[0].Spans, rhs[0].Spans, rhsPositive, eval), nil } // joinSpansAndReturnRHS compares all pairwise combinations of the inputs and returns the right-hand side // spans where the eval callback returns true. Uses and internal buffer and output is only valid until // the next call. Destructively edits the RHS slice for performance. -func (o *SpansetOperation) joinSpansAndReturnRHS(lhs, rhs []Span, eval func(l, r Span) bool) []Span { +func (o *SpansetOperation) joinSpansAndReturnRHS(lhs, rhs []Span, rhsPositive bool, eval func(l, r Span) bool) []Span { if len(lhs) == 0 || len(rhs) == 0 { return nil } o.matchingSpansBuffer = o.matchingSpansBuffer[:0] - for _, r := range rhs { - for _, l := range lhs { - if eval(l, r) { - // Returns RHS + if rhsPositive { + for _, r := range rhs { + for _, l := range lhs { + if eval(l, r) { + // Returns RHS + o.matchingSpansBuffer = append(o.matchingSpansBuffer, r) + break + } + } + } + } else { + for _, r := range rhs { + matches := false + for _, l := range lhs { + if eval(l, r) { + matches = true + break + } + } + if !matches { o.matchingSpansBuffer = append(o.matchingSpansBuffer, r) - break } } } diff --git a/pkg/traceql/ast_execute_test.go b/pkg/traceql/ast_execute_test.go index 1fe1e62e6fe..248e871c505 100644 --- a/pkg/traceql/ast_execute_test.go +++ b/pkg/traceql/ast_execute_test.go @@ -415,6 +415,81 @@ func TestSpansetOperationEvaluate(t *testing.T) { }}, }, }, + { + "{ } !< { .child }", + []*Spanset{ + {Spans: []Span{ + newMockSpan([]byte{1}).WithAttrBool("parent", true).WithNestedSetInfo(0, 1, 4), + newMockSpan([]byte{2}).WithAttrBool("child", true).WithNestedSetInfo(1, 2, 3), + newMockSpan([]byte{2}).WithAttrBool("child", true).WithNestedSetInfo(0, 1, 4), + }}, + }, + []*Spanset{ + {Spans: []Span{ + newMockSpan([]byte{2}).WithAttrBool("child", true).WithNestedSetInfo(1, 2, 3), + }}, + }, + }, + { + "{ } !> { .parent }", + []*Spanset{ + {Spans: []Span{ + newMockSpan([]byte{1}).WithAttrBool("parent", true).WithNestedSetInfo(0, 1, 4), + newMockSpan([]byte{1}).WithAttrBool("parent", true).WithNestedSetInfo(1, 2, 3), + newMockSpan([]byte{2}).WithAttrBool("child", true).WithNestedSetInfo(1, 2, 3), + }}, + }, + []*Spanset{ + {Spans: []Span{ + newMockSpan([]byte{1}).WithAttrBool("parent", true).WithNestedSetInfo(0, 1, 4), + }}, + }, + }, + { + "{ } !<< { .child }", + []*Spanset{ + {Spans: []Span{ + newMockSpan([]byte{1}).WithAttrBool("parent", true).WithNestedSetInfo(0, 1, 4), + newMockSpan([]byte{2}).WithAttrBool("child", true).WithNestedSetInfo(1, 2, 3), + newMockSpan([]byte{2}).WithAttrBool("child", true).WithNestedSetInfo(0, 1, 4), + }}, + }, + []*Spanset{ + {Spans: []Span{ + newMockSpan([]byte{2}).WithAttrBool("child", true).WithNestedSetInfo(1, 2, 3), + }}, + }, + }, + { + "{ } !>> { .parent }", + []*Spanset{ + {Spans: []Span{ + newMockSpan([]byte{1}).WithAttrBool("parent", true).WithNestedSetInfo(0, 1, 4), + newMockSpan([]byte{1}).WithAttrBool("parent", true).WithNestedSetInfo(1, 2, 3), + newMockSpan([]byte{2}).WithAttrBool("child", true).WithNestedSetInfo(1, 2, 3), + }}, + }, + []*Spanset{ + {Spans: []Span{ + newMockSpan([]byte{1}).WithAttrBool("parent", true).WithNestedSetInfo(0, 1, 4), + }}, + }, + }, + { + "{ .child1 } !~ { .child2 }", + []*Spanset{ + {Spans: []Span{ + newMockSpan([]byte{1}).WithAttrBool("child1", true).WithNestedSetInfo(1, 2, 3), + newMockSpan([]byte{1}).WithAttrBool("child2", true).WithNestedSetInfo(1, 4, 5), + newMockSpan([]byte{1}).WithAttrBool("child2", true).WithNestedSetInfo(4, 5, 6), + }}, + }, + []*Spanset{ + {Spans: []Span{ + newMockSpan([]byte{1}).WithAttrBool("child2", true).WithNestedSetInfo(4, 5, 6), + }}, + }, + }, { // tests that child operators do not modify the spanset "{ } > { } > { } > { }", []*Spanset{ diff --git a/pkg/traceql/lexer_test.go b/pkg/traceql/lexer_test.go index 401fa1229bc..b0d9ff5789a 100644 --- a/pkg/traceql/lexer_test.go +++ b/pkg/traceql/lexer_test.go @@ -66,6 +66,14 @@ func TestLexerAttributes(t *testing.T) { })) } +func TestLexerOperators(t *testing.T) { + testLexer(t, ([]lexerTestCase{ + // duration + // {"!>", []int{NOT_CHILD}}, + {"!>>", []int{NOT_DESC}}, + })) +} + func TestLexerDuration(t *testing.T) { testLexer(t, ([]lexerTestCase{ // duration @@ -131,6 +139,7 @@ func testLexer(t *testing.T, tcs []lexerTestCase) { } actual = append(actual, tok) } + require.Equal(t, tc.expected, actual) }) } From 826397710bbbd5ae6b8ef9bace961de153516181 Mon Sep 17 00:00:00 2001 From: Joe Elliott Date: Fri, 6 Oct 2023 09:58:57 -0400 Subject: [PATCH 03/14] removed ancestor/descendant due to parsing issues Signed-off-by: Joe Elliott --- pkg/traceql/ast.go | 2 +- pkg/traceql/ast_execute.go | 8 +- pkg/traceql/ast_execute_test.go | 30 -- pkg/traceql/enum_operators.go | 6 - pkg/traceql/enum_operators_test.go | 4 - pkg/traceql/expr.y | 6 +- pkg/traceql/expr.y.go | 828 ++++++++++++++--------------- pkg/traceql/lexer.go | 2 - pkg/traceql/lexer_test.go | 8 - pkg/traceql/test_examples.yaml | 3 + 10 files changed, 405 insertions(+), 492 deletions(-) diff --git a/pkg/traceql/ast.go b/pkg/traceql/ast.go index ced59a785d0..d3bfc90f14d 100644 --- a/pkg/traceql/ast.go +++ b/pkg/traceql/ast.go @@ -234,7 +234,7 @@ type SpansetOperation struct { func (o SpansetOperation) extractConditions(request *FetchSpansRequest) { switch o.Op { - case OpSpansetDescendant, OpSpansetAncestor, OpSpansetNotDescendant, OpSpansetNotAncestor: + case OpSpansetDescendant, OpSpansetAncestor: request.Conditions = append(request.Conditions, Condition{ Attribute: NewIntrinsic(IntrinsicStructuralDescendant), }) diff --git a/pkg/traceql/ast_execute.go b/pkg/traceql/ast_execute.go index 4e4361d6a79..7de00ac5721 100644 --- a/pkg/traceql/ast_execute.go +++ b/pkg/traceql/ast_execute.go @@ -101,9 +101,7 @@ func (o SpansetOperation) evaluate(input []*Spanset) (output []*Spanset, err err } case OpSpansetDescendant: - fallthrough - case OpSpansetNotDescendant: - spans, err := o.joinSpansets(lhs, rhs, o.Op == OpSpansetDescendant, func(l, r Span) bool { + spans, err := o.joinSpansets(lhs, rhs, true, func(l, r Span) bool { return r.DescendantOf(l) }) if err != nil { @@ -119,9 +117,7 @@ func (o SpansetOperation) evaluate(input []*Spanset) (output []*Spanset, err err } case OpSpansetAncestor: - fallthrough - case OpSpansetNotAncestor: - spans, err := o.joinSpansets(lhs, rhs, o.Op == OpSpansetAncestor, func(l, r Span) bool { + spans, err := o.joinSpansets(lhs, rhs, true, func(l, r Span) bool { // In case of ancestor the lhs becomes descendant of rhs return l.DescendantOf(r) }) diff --git a/pkg/traceql/ast_execute_test.go b/pkg/traceql/ast_execute_test.go index 248e871c505..2dabc4699a4 100644 --- a/pkg/traceql/ast_execute_test.go +++ b/pkg/traceql/ast_execute_test.go @@ -445,36 +445,6 @@ func TestSpansetOperationEvaluate(t *testing.T) { }}, }, }, - { - "{ } !<< { .child }", - []*Spanset{ - {Spans: []Span{ - newMockSpan([]byte{1}).WithAttrBool("parent", true).WithNestedSetInfo(0, 1, 4), - newMockSpan([]byte{2}).WithAttrBool("child", true).WithNestedSetInfo(1, 2, 3), - newMockSpan([]byte{2}).WithAttrBool("child", true).WithNestedSetInfo(0, 1, 4), - }}, - }, - []*Spanset{ - {Spans: []Span{ - newMockSpan([]byte{2}).WithAttrBool("child", true).WithNestedSetInfo(1, 2, 3), - }}, - }, - }, - { - "{ } !>> { .parent }", - []*Spanset{ - {Spans: []Span{ - newMockSpan([]byte{1}).WithAttrBool("parent", true).WithNestedSetInfo(0, 1, 4), - newMockSpan([]byte{1}).WithAttrBool("parent", true).WithNestedSetInfo(1, 2, 3), - newMockSpan([]byte{2}).WithAttrBool("child", true).WithNestedSetInfo(1, 2, 3), - }}, - }, - []*Spanset{ - {Spans: []Span{ - newMockSpan([]byte{1}).WithAttrBool("parent", true).WithNestedSetInfo(0, 1, 4), - }}, - }, - }, { "{ .child1 } !~ { .child2 }", []*Spanset{ diff --git a/pkg/traceql/enum_operators.go b/pkg/traceql/enum_operators.go index 661c448ca59..fc072769e06 100644 --- a/pkg/traceql/enum_operators.go +++ b/pkg/traceql/enum_operators.go @@ -32,8 +32,6 @@ const ( OpSpansetSibling OpSpansetNotChild OpSpansetNotParent - OpSpansetNotDescendant - OpSpansetNotAncestor OpSpansetNotSibling ) @@ -172,10 +170,6 @@ func (op Operator) String() string { return "!>" case OpSpansetNotParent: return "!<" - case OpSpansetNotDescendant: - return "!>>" - case OpSpansetNotAncestor: - return "!<<" case OpSpansetNotSibling: return "!~" } diff --git a/pkg/traceql/enum_operators_test.go b/pkg/traceql/enum_operators_test.go index f97b1c20eb0..9f7ffb247f6 100644 --- a/pkg/traceql/enum_operators_test.go +++ b/pkg/traceql/enum_operators_test.go @@ -37,8 +37,6 @@ func TestOperatorIsBoolean(t *testing.T) { {OpSpansetSibling, false}, {OpSpansetNotChild, false}, {OpSpansetNotParent, false}, - {OpSpansetNotDescendant, false}, - {OpSpansetNotAncestor, false}, {OpSpansetNotSibling, false}, } @@ -155,8 +153,6 @@ func TestOperatorUnaryTypesValid(t *testing.T) { {OpSpansetSibling, TypeInt, false}, {OpSpansetNotChild, TypeInt, false}, {OpSpansetNotParent, TypeInt, false}, - {OpSpansetNotDescendant, TypeInt, false}, - {OpSpansetNotAncestor, TypeInt, false}, {OpSpansetNotSibling, TypeInt, false}, // not {OpNot, TypeBoolean, true}, diff --git a/pkg/traceql/expr.y b/pkg/traceql/expr.y index f7a7e52d45c..22072138540 100644 --- a/pkg/traceql/expr.y +++ b/pkg/traceql/expr.y @@ -84,7 +84,7 @@ import ( // Operators are listed with increasing precedence. %left PIPE %left AND OR -%left EQ NEQ LT LTE GT GTE NRE RE DESC ANCE SIBL NOT_DESC NOT_CHILD NOT_ANCE NOT_PARENT +%left EQ NEQ LT LTE GT GTE NRE RE DESC ANCE SIBL NOT_CHILD NOT_PARENT %left ADD SUB %left NOT %left MUL DIV MOD @@ -114,8 +114,6 @@ spansetPipelineExpression: // shares the same operators as spansetExpression. sp | spansetPipelineExpression SIBL spansetPipelineExpression { $$ = newSpansetOperation(OpSpansetSibling, $1, $3) } | spansetPipelineExpression NOT_CHILD spansetPipelineExpression { $$ = newSpansetOperation(OpSpansetNotChild, $1, $3) } | spansetPipelineExpression NOT_PARENT spansetPipelineExpression { $$ = newSpansetOperation(OpSpansetNotParent, $1, $3) } - | spansetPipelineExpression NOT_DESC spansetPipelineExpression { $$ = newSpansetOperation(OpSpansetNotDescendant, $1, $3) } - | spansetPipelineExpression NOT_ANCE spansetPipelineExpression { $$ = newSpansetOperation(OpSpansetNotAncestor, $1, $3) } | spansetPipelineExpression NRE spansetPipelineExpression { $$ = newSpansetOperation(OpSpansetNotSibling, $1, $3) } | wrappedSpansetPipeline { $$ = $1 } ; @@ -164,8 +162,6 @@ spansetExpression: // shares the same operators as scalarPipelineExpression. spl | spansetExpression NOT_CHILD spansetExpression { $$ = newSpansetOperation(OpSpansetNotChild, $1, $3) } | spansetExpression NOT_PARENT spansetExpression { $$ = newSpansetOperation(OpSpansetNotParent, $1, $3) } - | spansetExpression NOT_DESC spansetExpression { $$ = newSpansetOperation(OpSpansetNotDescendant, $1, $3) } - | spansetExpression NOT_ANCE spansetExpression { $$ = newSpansetOperation(OpSpansetNotAncestor, $1, $3) } | spansetExpression NRE spansetExpression { $$ = newSpansetOperation(OpSpansetNotSibling, $1, $3) } | spansetFilter { $$ = $1 } diff --git a/pkg/traceql/expr.y.go b/pkg/traceql/expr.y.go index 00dedc531f0..dcc0e11b6cf 100644 --- a/pkg/traceql/expr.y.go +++ b/pkg/traceql/expr.y.go @@ -106,17 +106,15 @@ const RE = 57401 const DESC = 57402 const ANCE = 57403 const SIBL = 57404 -const NOT_DESC = 57405 -const NOT_CHILD = 57406 -const NOT_ANCE = 57407 -const NOT_PARENT = 57408 -const ADD = 57409 -const SUB = 57410 -const NOT = 57411 -const MUL = 57412 -const DIV = 57413 -const MOD = 57414 -const POW = 57415 +const NOT_CHILD = 57405 +const NOT_PARENT = 57406 +const ADD = 57407 +const SUB = 57408 +const NOT = 57409 +const MUL = 57410 +const DIV = 57411 +const MOD = 57412 +const POW = 57413 var yyToknames = [...]string{ "$end", @@ -181,9 +179,7 @@ var yyToknames = [...]string{ "DESC", "ANCE", "SIBL", - "NOT_DESC", "NOT_CHILD", - "NOT_ANCE", "NOT_PARENT", "ADD", "SUB", @@ -204,222 +200,219 @@ var yyExca = [...]int{ -1, 1, 1, -1, -2, 0, - -1, 223, - 13, 67, - -2, 75, + -1, 215, + 13, 63, + -2, 71, } const yyPrivate = 57344 -const yyLast = 752 +const yyLast = 746 var yyAct = [...]int{ - 82, 5, 221, 2, 6, 8, 7, 18, 201, 78, - 65, 55, 54, 162, 86, 28, 188, 189, 255, 190, - 191, 192, 201, 190, 191, 192, 201, 13, 259, 258, - 127, 161, 249, 128, 131, 129, 248, 58, 75, 76, - 77, 78, 247, 147, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 202, 203, 193, 194, 195, - 196, 197, 198, 200, 199, 73, 74, 28, 75, 76, - 77, 78, 188, 189, 168, 190, 191, 192, 201, 246, - 184, 186, 227, 228, 204, 205, 206, 62, 63, 64, - 65, 256, 66, 67, 68, 69, 70, 71, 254, 213, - 176, 178, 179, 180, 181, 182, 183, 73, 74, 165, - 75, 76, 77, 78, 60, 61, 220, 62, 63, 64, - 65, 169, 88, 161, 214, 215, 216, 217, 210, 17, - 135, 148, 126, 125, 218, 202, 203, 193, 194, 195, - 196, 197, 198, 200, 199, 19, 20, 21, 124, 17, - 218, 132, 188, 189, 123, 190, 191, 192, 201, 162, - 219, 122, 211, 212, 127, 80, 79, 128, 131, 129, - 223, 87, 225, 119, 120, 121, 253, 251, 57, 23, - 26, 24, 25, 27, 14, 133, 15, 166, 250, 229, - 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - 240, 241, 242, 243, 244, 219, 209, 22, 208, 207, - 16, 72, 4, 202, 203, 193, 194, 195, 196, 197, - 198, 200, 199, 59, 55, 12, 55, 225, 10, 257, - 188, 189, 185, 190, 191, 192, 201, 164, 56, 11, - 130, 73, 74, 1, 75, 76, 77, 78, 0, 0, - 58, 0, 58, 89, 90, 91, 95, 115, 0, 81, - 83, 0, 0, 94, 92, 93, 97, 96, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 111, 110, 112, 113, 114, 118, 116, 117, 0, 0, - 0, 60, 61, 0, 62, 63, 64, 65, 167, 170, - 171, 172, 173, 174, 175, 0, 252, 0, 89, 90, - 91, 95, 115, 0, 0, 83, 84, 85, 94, 92, - 93, 97, 96, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 111, 110, 112, 113, 114, - 118, 116, 117, 202, 203, 193, 194, 195, 196, 197, - 198, 200, 199, 245, 0, 0, 0, 0, 0, 0, - 188, 189, 0, 190, 191, 192, 201, 19, 20, 21, - 0, 84, 85, 177, 43, 0, 42, 226, 52, 0, - 44, 45, 47, 50, 48, 51, 49, 0, 0, 0, - 202, 203, 193, 194, 195, 196, 197, 198, 200, 199, - 187, 23, 26, 24, 25, 27, 0, 188, 189, 0, - 190, 191, 192, 201, 202, 203, 193, 194, 195, 196, - 197, 198, 200, 199, 0, 0, 0, 0, 0, 22, - 0, 188, 189, 0, 190, 191, 192, 201, 0, 202, - 203, 193, 194, 195, 196, 197, 198, 200, 199, 0, - 0, 0, 0, 0, 0, 0, 188, 189, 0, 190, - 191, 192, 201, 202, 203, 193, 194, 195, 196, 197, - 198, 200, 199, 166, 0, 0, 0, 0, 0, 0, - 188, 189, 0, 190, 191, 192, 201, 193, 194, 195, - 196, 197, 198, 200, 199, 0, 0, 0, 0, 0, - 0, 0, 188, 189, 0, 190, 191, 192, 201, 0, - 0, 0, 66, 67, 68, 69, 70, 71, 0, 66, - 67, 68, 69, 70, 71, 0, 0, 73, 74, 0, - 75, 76, 77, 78, 60, 61, 0, 62, 63, 64, - 65, 19, 20, 21, 0, 17, 0, 224, 0, 19, - 20, 21, 0, 17, 0, 222, 0, 19, 20, 21, - 31, 17, 30, 9, 40, 0, 32, 33, 35, 38, - 36, 39, 37, 0, 0, 23, 26, 24, 25, 27, - 14, 0, 15, 23, 26, 24, 25, 27, 14, 163, - 15, 23, 26, 24, 25, 27, 14, 0, 15, 0, - 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, - 0, 22, 19, 20, 21, 160, 17, 0, 132, 22, - 0, 0, 0, 0, 0, 0, 41, 46, 0, 0, - 43, 0, 42, 0, 52, 0, 44, 45, 47, 50, - 48, 51, 49, 0, 0, 0, 23, 26, 24, 25, - 27, 0, 29, 34, 0, 0, 31, 0, 30, 0, - 40, 0, 32, 33, 35, 38, 36, 39, 37, 41, - 46, 0, 0, 43, 22, 42, 0, 52, 0, 44, - 45, 47, 50, 48, 51, 49, 29, 34, 53, 3, - 31, 0, 30, 0, 40, 0, 32, 33, 35, 38, - 36, 39, 37, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 134, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 89, 90, 91, 95, 0, 0, 0, 169, 0, 0, - 94, 92, 93, 97, 96, 98, 99, 100, 101, 102, - 103, 104, + 78, 5, 213, 2, 6, 8, 7, 18, 193, 74, + 61, 51, 50, 154, 247, 180, 181, 82, 182, 183, + 184, 193, 182, 183, 184, 193, 28, 251, 13, 250, + 123, 158, 153, 124, 127, 125, 241, 240, 54, 153, + 239, 141, 143, 144, 145, 146, 147, 148, 149, 150, + 151, 194, 195, 185, 186, 187, 188, 189, 190, 192, + 191, 156, 71, 72, 73, 74, 180, 181, 28, 182, + 183, 184, 193, 160, 248, 154, 176, 178, 238, 205, + 196, 197, 198, 69, 70, 157, 71, 72, 73, 74, + 58, 59, 60, 61, 246, 219, 220, 168, 170, 171, + 172, 173, 174, 175, 69, 70, 212, 71, 72, 73, + 74, 161, 131, 56, 57, 122, 58, 59, 60, 61, + 206, 207, 208, 209, 17, 121, 142, 120, 119, 118, + 210, 194, 195, 185, 186, 187, 188, 189, 190, 192, + 191, 76, 75, 202, 210, 243, 180, 181, 242, 182, + 183, 184, 193, 68, 201, 200, 123, 211, 199, 124, + 127, 125, 215, 84, 217, 55, 115, 116, 117, 83, + 19, 20, 21, 53, 17, 16, 128, 203, 204, 4, + 12, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 10, 211, 177, + 126, 1, 0, 0, 23, 26, 24, 25, 27, 14, + 129, 15, 0, 0, 0, 0, 51, 0, 51, 217, + 0, 249, 185, 186, 187, 188, 189, 190, 192, 191, + 22, 0, 52, 11, 0, 180, 181, 0, 182, 183, + 184, 193, 0, 54, 0, 54, 85, 86, 87, 91, + 111, 0, 77, 79, 0, 0, 90, 88, 89, 93, + 92, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 103, 104, 105, 107, 106, 108, 109, 110, 114, 112, + 113, 56, 57, 0, 58, 59, 60, 61, 159, 162, + 163, 164, 165, 166, 167, 0, 0, 245, 0, 85, + 86, 87, 91, 111, 0, 0, 79, 80, 81, 90, + 88, 89, 93, 92, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 107, 106, 108, 109, + 110, 114, 112, 113, 194, 195, 185, 186, 187, 188, + 189, 190, 192, 191, 244, 0, 0, 0, 0, 180, + 181, 0, 182, 183, 184, 193, 0, 0, 0, 0, + 80, 81, 0, 39, 44, 0, 237, 41, 0, 40, + 0, 48, 0, 42, 43, 45, 46, 47, 0, 0, + 0, 194, 195, 185, 186, 187, 188, 189, 190, 192, + 191, 218, 0, 0, 0, 0, 180, 181, 0, 182, + 183, 184, 193, 194, 195, 185, 186, 187, 188, 189, + 190, 192, 191, 179, 0, 0, 0, 0, 180, 181, + 0, 182, 183, 184, 193, 0, 0, 0, 194, 195, + 185, 186, 187, 188, 189, 190, 192, 191, 0, 0, + 0, 0, 0, 180, 181, 0, 182, 183, 184, 193, + 0, 0, 194, 195, 185, 186, 187, 188, 189, 190, + 192, 191, 158, 0, 0, 0, 0, 180, 181, 0, + 182, 183, 184, 193, 194, 195, 185, 186, 187, 188, + 189, 190, 192, 191, 0, 0, 0, 0, 0, 180, + 181, 0, 182, 183, 184, 193, 0, 0, 0, 0, + 0, 62, 63, 64, 65, 66, 67, 0, 62, 63, + 64, 65, 66, 67, 69, 70, 0, 71, 72, 73, + 74, 69, 70, 0, 71, 72, 73, 74, 62, 63, + 64, 65, 66, 67, 19, 20, 21, 0, 17, 0, + 216, 56, 57, 0, 58, 59, 60, 61, 19, 20, + 21, 0, 17, 0, 214, 0, 0, 0, 0, 0, + 0, 19, 20, 21, 0, 17, 0, 9, 23, 26, + 24, 25, 27, 14, 0, 15, 0, 155, 0, 0, + 0, 0, 23, 26, 24, 25, 27, 14, 0, 15, + 0, 0, 0, 0, 22, 23, 26, 24, 25, 27, + 14, 0, 15, 19, 20, 21, 0, 17, 22, 128, + 19, 20, 21, 0, 39, 44, 169, 0, 41, 0, + 40, 22, 48, 0, 42, 43, 45, 46, 47, 0, + 152, 0, 0, 0, 0, 0, 0, 23, 26, 24, + 25, 27, 0, 0, 23, 26, 24, 25, 27, 41, + 0, 40, 0, 48, 0, 42, 43, 45, 46, 47, + 0, 0, 0, 22, 0, 0, 0, 29, 34, 0, + 22, 31, 0, 30, 0, 38, 0, 32, 33, 35, + 36, 37, 29, 34, 49, 3, 31, 0, 30, 0, + 38, 0, 32, 33, 35, 36, 37, 31, 0, 30, + 0, 38, 0, 32, 33, 35, 36, 37, 0, 0, + 0, 0, 0, 0, 130, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 85, 86, 87, 91, 0, 0, + 0, 161, 0, 0, 90, 88, 89, 93, 92, 94, + 95, 96, 97, 98, 99, 100, } var yyPact = [...]int{ - 551, -1000, -34, 636, -1000, 619, -1000, -1000, -1000, 551, - -1000, 467, -1000, 40, 154, 153, -1000, 248, -1000, -1000, - -1000, -1000, 167, 149, 142, 136, 121, 120, 139, 118, - 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, - 118, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 602, 110, 576, 224, 96, 460, 725, - 109, 109, 109, 109, 109, 109, -1000, -1000, -1000, -1000, - -1000, -1000, 361, 361, 361, 361, 361, 361, 361, 303, - 303, -1000, 389, 303, 303, 303, -1000, -1000, -1000, -1000, + 555, -1000, -23, 632, -1000, 313, -1000, -1000, -1000, 555, + -1000, 476, -1000, 456, 130, 129, -1000, 241, -1000, -1000, + -1000, -1000, 160, 117, 116, 115, 113, 103, 164, 100, + 100, 100, 100, 100, 100, 100, 100, 100, 100, 114, + 114, 114, 114, 114, 114, 114, 114, 114, 114, 617, + 26, 564, 48, 72, 449, 719, 99, 99, 99, 99, + 99, 99, -1000, -1000, -1000, -1000, -1000, -1000, 604, 604, + 604, 604, 604, 604, 604, 294, 294, -1000, 402, 294, + 294, 294, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, - -1000, -1000, -1000, -1000, -1000, 205, 204, 202, 124, -1000, - -1000, -1000, 86, 303, 303, 303, 303, 619, -1000, -1000, - -1000, -1000, 606, 104, 506, 543, -1000, -1000, -1000, -1000, - 506, -1000, -1000, -1000, -1000, -1000, -1000, 320, 119, -1000, - -1000, -1000, -1000, 320, -1000, -1000, -1000, -1000, -1000, -1000, - -1000, -1000, 139, -1000, -1000, -1000, -1000, 47, -1000, 535, - 17, 17, -63, -63, -63, -63, -2, 361, -32, -32, - -64, -64, -64, -64, 364, 69, 413, -1000, 303, 303, - 303, 303, 303, 303, 303, 303, 303, 303, 303, 303, - 303, 303, 303, 303, 340, -47, -47, 31, -6, -12, - -16, 184, 173, -1000, 293, 163, 85, 5, 576, 174, - 78, 18, 543, -1000, 535, -36, -1000, -1000, 303, -47, - -47, -65, -65, -65, -51, -51, -51, -51, -51, -51, - -51, -51, -65, 435, 435, -1000, -1000, -1000, -1000, -1000, - -19, -20, -1000, -1000, -1000, -1000, -1000, 413, -1000, -1000, + -1000, 154, 151, 150, 139, -1000, -1000, -1000, 66, 294, + 294, 294, 294, 313, -1000, -1000, -1000, -1000, 597, 94, + 643, 542, -1000, -1000, -1000, -1000, 643, -1000, -1000, -1000, + -1000, 595, 114, -1000, -1000, -1000, -1000, 595, -1000, -1000, + -1000, -1000, -1000, -1000, 164, -1000, -1000, -1000, -1000, 216, + -1000, 528, 22, 22, -61, -61, -61, -61, 39, 604, + -6, -6, -62, -62, -62, -62, 378, 82, 424, -1000, + 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, + 294, 294, 294, 294, 294, 294, 353, -46, -46, 30, + -8, -11, -12, 144, 141, -1000, 331, 284, 81, 1, + 564, 18, 61, 19, 542, -1000, 528, -36, -1000, -1000, + 294, -46, -46, -63, -63, -63, -50, -50, -50, -50, + -50, -50, -50, -50, -63, 170, 170, -1000, -1000, -1000, + -1000, -1000, -19, -21, -1000, -1000, -1000, -1000, -1000, 424, + -1000, -1000, } var yyPgo = [...]int{ - 0, 243, 6, 240, 5, 232, 1, 688, 228, 2, - 225, 4, 211, 212, 238, 27, 210, 178, 7, 0, - 14, 171, 122, + 0, 201, 6, 200, 5, 199, 1, 684, 197, 2, + 180, 4, 153, 179, 232, 28, 175, 173, 7, 0, + 17, 169, 163, } var yyR1 = [...]int{ 0, 1, 1, 1, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 8, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 2, 3, - 4, 5, 5, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 10, 10, 11, - 12, 12, 12, 12, 12, 12, 13, 13, 14, 14, - 14, 14, 14, 14, 14, 14, 16, 17, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 18, 18, 18, 18, 18, 19, 19, 19, + 7, 7, 7, 7, 7, 7, 8, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 2, 3, 4, 5, + 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 10, 10, 11, 12, 12, 12, 12, + 12, 12, 13, 13, 14, 14, 14, 14, 14, 14, + 14, 14, 16, 17, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 18, 18, + 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, + 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, - 22, + 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 22, 22, 22, 22, 22, 22, } var yyR2 = [...]int{ 0, 1, 1, 1, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 1, 3, 1, - 1, 1, 1, 3, 3, 3, 3, 3, 4, 3, - 4, 1, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 1, 2, 3, 3, - 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 1, 1, 1, 1, 2, - 2, 2, 3, 4, 4, 4, 4, 3, 3, 3, + 3, 3, 3, 3, 3, 1, 3, 1, 1, 1, + 1, 3, 3, 3, 3, 3, 4, 3, 4, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 2, 2, 1, 1, 1, 1, + 3, 3, 1, 2, 3, 3, 1, 1, 1, 1, + 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 1, 1, 1, 1, 2, 2, 2, 3, 4, + 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 3, 3, 3, 3, 4, - 4, + 1, 3, 3, 3, 3, 4, 4, } var yyChk = [...]int{ -1000, -1, -9, -7, -13, -6, -11, -2, -4, 12, -8, -14, -10, -15, 45, 47, -16, 10, -18, 6, - 7, 8, 68, 40, 42, 43, 41, 44, 49, 50, - 56, 54, 60, 61, 51, 62, 64, 66, 63, 65, - 58, 50, 56, 54, 60, 61, 51, 62, 64, 66, - 63, 65, 58, -7, -9, -6, -14, -17, -15, -12, - 67, 68, 70, 71, 72, 73, 52, 53, 54, 55, - 56, 57, -12, 67, 68, 70, 71, 72, 73, 12, - 12, 11, -19, 12, 68, 69, -20, -21, -22, 5, - 6, 7, 16, 17, 15, 8, 19, 18, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 33, 32, 34, 35, 36, 9, 38, 39, 37, 6, - 7, 8, 12, 12, 12, 12, 12, -6, -11, -2, - -3, -4, 12, 46, -7, 12, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -6, 12, -6, - -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, - 13, 13, 49, 13, 13, 13, 13, -14, -20, 12, - -14, -14, -14, -14, -14, -14, -15, 12, -15, -15, - -15, -15, -15, -15, -19, -5, -19, 11, 67, 68, - 70, 71, 72, 52, 53, 54, 55, 56, 57, 59, - 58, 73, 50, 51, -19, -19, -19, 4, 4, 4, - 4, 38, 39, 13, -19, -19, -19, -19, -6, -15, - 12, -9, 12, -18, 12, -9, 13, 13, 14, -19, - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, 13, 48, 48, 48, 48, - 4, 4, 13, 13, 13, 13, 13, -19, 48, 48, + 7, 8, 66, 40, 42, 43, 41, 44, 49, 50, + 56, 54, 60, 61, 51, 62, 63, 64, 58, 50, + 56, 54, 60, 61, 51, 62, 63, 64, 58, -7, + -9, -6, -14, -17, -15, -12, 65, 66, 68, 69, + 70, 71, 52, 53, 54, 55, 56, 57, -12, 65, + 66, 68, 69, 70, 71, 12, 12, 11, -19, 12, + 66, 67, -20, -21, -22, 5, 6, 7, 16, 17, + 15, 8, 19, 18, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 33, 32, 34, 35, + 36, 9, 38, 39, 37, 6, 7, 8, 12, 12, + 12, 12, 12, -6, -11, -2, -3, -4, 12, 46, + -7, 12, -7, -7, -7, -7, -7, -7, -7, -7, + -7, -6, 12, -6, -6, -6, -6, -6, -6, -6, + -6, -6, 13, 13, 49, 13, 13, 13, 13, -14, + -20, 12, -14, -14, -14, -14, -14, -14, -15, 12, + -15, -15, -15, -15, -15, -15, -19, -5, -19, 11, + 65, 66, 68, 69, 70, 52, 53, 54, 55, 56, + 57, 59, 58, 71, 50, 51, -19, -19, -19, 4, + 4, 4, 4, 38, 39, 13, -19, -19, -19, -19, + -6, -15, 12, -9, 12, -18, 12, -9, 13, 13, + 14, -19, -19, -19, -19, -19, -19, -19, -19, -19, + -19, -19, -19, -19, -19, -19, -19, 13, 48, 48, + 48, 48, 4, 4, 13, 13, 13, 13, 13, -19, + 48, 48, } var yyDef = [...]int{ - 0, -2, 1, 2, 3, 19, 20, 21, 22, 0, - 17, 0, 46, 0, 0, 0, 65, 0, 75, 76, - 77, 78, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -2, 1, 2, 3, 17, 18, 19, 20, 0, + 15, 0, 42, 0, 0, 0, 61, 0, 71, 72, + 73, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 50, 51, 52, 53, - 54, 55, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 47, 0, 0, 0, 0, 106, 107, 108, 109, + 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 46, 47, 48, 49, 50, 51, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 43, 0, 0, + 0, 0, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 0, 0, 0, 0, 79, - 80, 81, 0, 0, 0, 0, 0, 23, 24, 25, - 26, 27, 0, 0, 5, 0, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 34, 0, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 4, 18, 0, 33, 58, 66, 68, 56, 57, 0, - 59, 60, 61, 62, 63, 64, 49, 0, 69, 70, - 71, 72, 73, 74, 0, 0, 31, 48, 0, 0, + 130, 0, 0, 0, 0, 75, 76, 77, 0, 0, + 0, 0, 0, 21, 22, 23, 24, 25, 0, 0, + 5, 0, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 32, 0, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 4, 16, 0, 31, 54, 62, 64, 52, + 53, 0, 55, 56, 57, 58, 59, 60, 45, 0, + 65, 66, 67, 68, 69, 70, 0, 0, 29, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 104, 105, 0, 0, 0, - 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, - 0, 0, 0, -2, 0, 0, 28, 30, 0, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 87, 135, 136, 137, 138, - 0, 0, 83, 84, 85, 86, 29, 32, 139, 140, + 0, 0, 0, 0, 0, 0, 0, 100, 101, 0, + 0, 0, 0, 0, 0, 78, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -2, 0, 0, 26, 28, + 0, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, 98, 99, 83, 131, 132, + 133, 134, 0, 0, 79, 80, 81, 82, 27, 30, + 135, 136, } var yyTok1 = [...]int{ @@ -434,7 +427,6 @@ var yyTok2 = [...]int{ 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, } var yyTok3 = [...]int{ 0, @@ -859,761 +851,737 @@ yydefault: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:117 { - yyVAL.spansetPipelineExpression = newSpansetOperation(OpSpansetNotDescendant, yyDollar[1].spansetPipelineExpression, yyDollar[3].spansetPipelineExpression) + yyVAL.spansetPipelineExpression = newSpansetOperation(OpSpansetNotSibling, yyDollar[1].spansetPipelineExpression, yyDollar[3].spansetPipelineExpression) } case 15: - yyDollar = yyS[yypt-3 : yypt+1] + yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:118 { - yyVAL.spansetPipelineExpression = newSpansetOperation(OpSpansetNotAncestor, yyDollar[1].spansetPipelineExpression, yyDollar[3].spansetPipelineExpression) + yyVAL.spansetPipelineExpression = yyDollar[1].wrappedSpansetPipeline } case 16: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:119 +//line pkg/traceql/expr.y:122 { - yyVAL.spansetPipelineExpression = newSpansetOperation(OpSpansetNotSibling, yyDollar[1].spansetPipelineExpression, yyDollar[3].spansetPipelineExpression) + yyVAL.wrappedSpansetPipeline = yyDollar[2].spansetPipeline } case 17: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:120 +//line pkg/traceql/expr.y:125 { - yyVAL.spansetPipelineExpression = yyDollar[1].wrappedSpansetPipeline + yyVAL.spansetPipeline = newPipeline(yyDollar[1].spansetExpression) } case 18: - yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:124 + yyDollar = yyS[yypt-1 : yypt+1] +//line pkg/traceql/expr.y:126 { - yyVAL.wrappedSpansetPipeline = yyDollar[2].spansetPipeline + yyVAL.spansetPipeline = newPipeline(yyDollar[1].scalarFilter) } case 19: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:127 { - yyVAL.spansetPipeline = newPipeline(yyDollar[1].spansetExpression) + yyVAL.spansetPipeline = newPipeline(yyDollar[1].groupOperation) } case 20: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:128 { - yyVAL.spansetPipeline = newPipeline(yyDollar[1].scalarFilter) + yyVAL.spansetPipeline = newPipeline(yyDollar[1].selectOperation) } case 21: - yyDollar = yyS[yypt-1 : yypt+1] + yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:129 { - yyVAL.spansetPipeline = newPipeline(yyDollar[1].groupOperation) + yyVAL.spansetPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].spansetExpression) } case 22: - yyDollar = yyS[yypt-1 : yypt+1] + yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:130 { - yyVAL.spansetPipeline = newPipeline(yyDollar[1].selectOperation) + yyVAL.spansetPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].scalarFilter) } case 23: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:131 { - yyVAL.spansetPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].spansetExpression) + yyVAL.spansetPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].groupOperation) } case 24: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:132 { - yyVAL.spansetPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].scalarFilter) + yyVAL.spansetPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].coalesceOperation) } case 25: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:133 { - yyVAL.spansetPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].groupOperation) + yyVAL.spansetPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].selectOperation) } case 26: - yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:134 + yyDollar = yyS[yypt-4 : yypt+1] +//line pkg/traceql/expr.y:137 { - yyVAL.spansetPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].coalesceOperation) + yyVAL.groupOperation = newGroupOperation(yyDollar[3].fieldExpression) } case 27: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:135 +//line pkg/traceql/expr.y:141 { - yyVAL.spansetPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].selectOperation) + yyVAL.coalesceOperation = newCoalesceOperation() } case 28: yyDollar = yyS[yypt-4 : yypt+1] -//line pkg/traceql/expr.y:139 +//line pkg/traceql/expr.y:145 { - yyVAL.groupOperation = newGroupOperation(yyDollar[3].fieldExpression) + yyVAL.selectOperation = newSelectOperation(yyDollar[3].selectArgs) } case 29: - yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:143 + yyDollar = yyS[yypt-1 : yypt+1] +//line pkg/traceql/expr.y:149 { - yyVAL.coalesceOperation = newCoalesceOperation() + yyVAL.selectArgs = []FieldExpression{yyDollar[1].fieldExpression} } case 30: - yyDollar = yyS[yypt-4 : yypt+1] -//line pkg/traceql/expr.y:147 + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:150 { - yyVAL.selectOperation = newSelectOperation(yyDollar[3].selectArgs) + yyVAL.selectArgs = append(yyDollar[1].selectArgs, yyDollar[3].fieldExpression) } case 31: - yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:151 + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:154 { - yyVAL.selectArgs = []FieldExpression{yyDollar[1].fieldExpression} + yyVAL.spansetExpression = yyDollar[2].spansetExpression } case 32: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:152 +//line pkg/traceql/expr.y:155 { - yyVAL.selectArgs = append(yyDollar[1].selectArgs, yyDollar[3].fieldExpression) + yyVAL.spansetExpression = newSpansetOperation(OpSpansetAnd, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } case 33: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:156 { - yyVAL.spansetExpression = yyDollar[2].spansetExpression + yyVAL.spansetExpression = newSpansetOperation(OpSpansetChild, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } case 34: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:157 { - yyVAL.spansetExpression = newSpansetOperation(OpSpansetAnd, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + yyVAL.spansetExpression = newSpansetOperation(OpSpansetParent, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } case 35: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:158 { - yyVAL.spansetExpression = newSpansetOperation(OpSpansetChild, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + yyVAL.spansetExpression = newSpansetOperation(OpSpansetDescendant, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } case 36: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:159 { - yyVAL.spansetExpression = newSpansetOperation(OpSpansetParent, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + yyVAL.spansetExpression = newSpansetOperation(OpSpansetAncestor, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } case 37: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:160 { - yyVAL.spansetExpression = newSpansetOperation(OpSpansetDescendant, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + yyVAL.spansetExpression = newSpansetOperation(OpSpansetUnion, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } case 38: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:161 { - yyVAL.spansetExpression = newSpansetOperation(OpSpansetAncestor, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + yyVAL.spansetExpression = newSpansetOperation(OpSpansetSibling, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } case 39: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:162 +//line pkg/traceql/expr.y:163 { - yyVAL.spansetExpression = newSpansetOperation(OpSpansetUnion, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + yyVAL.spansetExpression = newSpansetOperation(OpSpansetNotChild, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } case 40: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:163 +//line pkg/traceql/expr.y:164 { - yyVAL.spansetExpression = newSpansetOperation(OpSpansetSibling, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + yyVAL.spansetExpression = newSpansetOperation(OpSpansetNotParent, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } case 41: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:165 { - yyVAL.spansetExpression = newSpansetOperation(OpSpansetNotChild, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + yyVAL.spansetExpression = newSpansetOperation(OpSpansetNotSibling, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } case 42: - yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:166 + yyDollar = yyS[yypt-1 : yypt+1] +//line pkg/traceql/expr.y:167 { - yyVAL.spansetExpression = newSpansetOperation(OpSpansetNotParent, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + yyVAL.spansetExpression = yyDollar[1].spansetFilter } case 43: - yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:167 + yyDollar = yyS[yypt-2 : yypt+1] +//line pkg/traceql/expr.y:171 { - yyVAL.spansetExpression = newSpansetOperation(OpSpansetNotDescendant, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + yyVAL.spansetFilter = newSpansetFilter(NewStaticBool(true)) } case 44: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:168 +//line pkg/traceql/expr.y:172 { - yyVAL.spansetExpression = newSpansetOperation(OpSpansetNotAncestor, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + yyVAL.spansetFilter = newSpansetFilter(yyDollar[2].fieldExpression) } case 45: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:169 +//line pkg/traceql/expr.y:176 { - yyVAL.spansetExpression = newSpansetOperation(OpSpansetNotSibling, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + yyVAL.scalarFilter = newScalarFilter(yyDollar[2].scalarFilterOperation, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) } case 46: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:171 +//line pkg/traceql/expr.y:180 { - yyVAL.spansetExpression = yyDollar[1].spansetFilter + yyVAL.scalarFilterOperation = OpEqual } case 47: - yyDollar = yyS[yypt-2 : yypt+1] -//line pkg/traceql/expr.y:175 + yyDollar = yyS[yypt-1 : yypt+1] +//line pkg/traceql/expr.y:181 { - yyVAL.spansetFilter = newSpansetFilter(NewStaticBool(true)) + yyVAL.scalarFilterOperation = OpNotEqual } case 48: - yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:176 + yyDollar = yyS[yypt-1 : yypt+1] +//line pkg/traceql/expr.y:182 { - yyVAL.spansetFilter = newSpansetFilter(yyDollar[2].fieldExpression) + yyVAL.scalarFilterOperation = OpLess } case 49: - yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:180 + yyDollar = yyS[yypt-1 : yypt+1] +//line pkg/traceql/expr.y:183 { - yyVAL.scalarFilter = newScalarFilter(yyDollar[2].scalarFilterOperation, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) + yyVAL.scalarFilterOperation = OpLessEqual } case 50: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:184 { - yyVAL.scalarFilterOperation = OpEqual + yyVAL.scalarFilterOperation = OpGreater } case 51: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:185 { - yyVAL.scalarFilterOperation = OpNotEqual + yyVAL.scalarFilterOperation = OpGreaterEqual } case 52: - yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:186 + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:192 { - yyVAL.scalarFilterOperation = OpLess + yyVAL.scalarPipelineExpressionFilter = newScalarFilter(yyDollar[2].scalarFilterOperation, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) } case 53: - yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:187 + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:193 { - yyVAL.scalarFilterOperation = OpLessEqual + yyVAL.scalarPipelineExpressionFilter = newScalarFilter(yyDollar[2].scalarFilterOperation, yyDollar[1].scalarPipelineExpression, yyDollar[3].static) } case 54: - yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:188 + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:197 { - yyVAL.scalarFilterOperation = OpGreater + yyVAL.scalarPipelineExpression = yyDollar[2].scalarPipelineExpression } case 55: - yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:189 + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:198 { - yyVAL.scalarFilterOperation = OpGreaterEqual + yyVAL.scalarPipelineExpression = newScalarOperation(OpAdd, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) } case 56: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:196 +//line pkg/traceql/expr.y:199 { - yyVAL.scalarPipelineExpressionFilter = newScalarFilter(yyDollar[2].scalarFilterOperation, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) + yyVAL.scalarPipelineExpression = newScalarOperation(OpSub, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) } case 57: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:197 +//line pkg/traceql/expr.y:200 { - yyVAL.scalarPipelineExpressionFilter = newScalarFilter(yyDollar[2].scalarFilterOperation, yyDollar[1].scalarPipelineExpression, yyDollar[3].static) + yyVAL.scalarPipelineExpression = newScalarOperation(OpMult, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) } case 58: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:201 { - yyVAL.scalarPipelineExpression = yyDollar[2].scalarPipelineExpression + yyVAL.scalarPipelineExpression = newScalarOperation(OpDiv, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) } case 59: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:202 { - yyVAL.scalarPipelineExpression = newScalarOperation(OpAdd, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) + yyVAL.scalarPipelineExpression = newScalarOperation(OpMod, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) } case 60: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:203 { - yyVAL.scalarPipelineExpression = newScalarOperation(OpSub, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) + yyVAL.scalarPipelineExpression = newScalarOperation(OpPower, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) } case 61: - yyDollar = yyS[yypt-3 : yypt+1] + yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:204 { - yyVAL.scalarPipelineExpression = newScalarOperation(OpMult, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) + yyVAL.scalarPipelineExpression = yyDollar[1].wrappedScalarPipeline } case 62: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:205 +//line pkg/traceql/expr.y:208 { - yyVAL.scalarPipelineExpression = newScalarOperation(OpDiv, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) + yyVAL.wrappedScalarPipeline = yyDollar[2].scalarPipeline } case 63: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:206 +//line pkg/traceql/expr.y:212 { - yyVAL.scalarPipelineExpression = newScalarOperation(OpMod, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) + yyVAL.scalarPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].aggregate) } case 64: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:207 +//line pkg/traceql/expr.y:216 { - yyVAL.scalarPipelineExpression = newScalarOperation(OpPower, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) + yyVAL.scalarExpression = yyDollar[2].scalarExpression } case 65: - yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:208 + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:217 { - yyVAL.scalarPipelineExpression = yyDollar[1].wrappedScalarPipeline + yyVAL.scalarExpression = newScalarOperation(OpAdd, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) } case 66: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:212 +//line pkg/traceql/expr.y:218 { - yyVAL.wrappedScalarPipeline = yyDollar[2].scalarPipeline + yyVAL.scalarExpression = newScalarOperation(OpSub, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) } case 67: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:216 +//line pkg/traceql/expr.y:219 { - yyVAL.scalarPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].aggregate) + yyVAL.scalarExpression = newScalarOperation(OpMult, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) } case 68: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:220 { - yyVAL.scalarExpression = yyDollar[2].scalarExpression + yyVAL.scalarExpression = newScalarOperation(OpDiv, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) } case 69: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:221 { - yyVAL.scalarExpression = newScalarOperation(OpAdd, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) + yyVAL.scalarExpression = newScalarOperation(OpMod, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) } case 70: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:222 { - yyVAL.scalarExpression = newScalarOperation(OpSub, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) + yyVAL.scalarExpression = newScalarOperation(OpPower, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) } case 71: - yyDollar = yyS[yypt-3 : yypt+1] + yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:223 { - yyVAL.scalarExpression = newScalarOperation(OpMult, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) + yyVAL.scalarExpression = yyDollar[1].aggregate } case 72: - yyDollar = yyS[yypt-3 : yypt+1] + yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:224 { - yyVAL.scalarExpression = newScalarOperation(OpDiv, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) + yyVAL.scalarExpression = NewStaticInt(yyDollar[1].staticInt) } case 73: - yyDollar = yyS[yypt-3 : yypt+1] + yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:225 { - yyVAL.scalarExpression = newScalarOperation(OpMod, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) + yyVAL.scalarExpression = NewStaticFloat(yyDollar[1].staticFloat) } case 74: - yyDollar = yyS[yypt-3 : yypt+1] + yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:226 { - yyVAL.scalarExpression = newScalarOperation(OpPower, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) + yyVAL.scalarExpression = NewStaticDuration(yyDollar[1].staticDuration) } case 75: - yyDollar = yyS[yypt-1 : yypt+1] + yyDollar = yyS[yypt-2 : yypt+1] //line pkg/traceql/expr.y:227 { - yyVAL.scalarExpression = yyDollar[1].aggregate + yyVAL.scalarExpression = NewStaticInt(-yyDollar[2].staticInt) } case 76: - yyDollar = yyS[yypt-1 : yypt+1] + yyDollar = yyS[yypt-2 : yypt+1] //line pkg/traceql/expr.y:228 { - yyVAL.scalarExpression = NewStaticInt(yyDollar[1].staticInt) + yyVAL.scalarExpression = NewStaticFloat(-yyDollar[2].staticFloat) } case 77: - yyDollar = yyS[yypt-1 : yypt+1] + yyDollar = yyS[yypt-2 : yypt+1] //line pkg/traceql/expr.y:229 { - yyVAL.scalarExpression = NewStaticFloat(yyDollar[1].staticFloat) + yyVAL.scalarExpression = NewStaticDuration(-yyDollar[2].staticDuration) } case 78: - yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:230 + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:233 { - yyVAL.scalarExpression = NewStaticDuration(yyDollar[1].staticDuration) + yyVAL.aggregate = newAggregate(aggregateCount, nil) } case 79: - yyDollar = yyS[yypt-2 : yypt+1] -//line pkg/traceql/expr.y:231 + yyDollar = yyS[yypt-4 : yypt+1] +//line pkg/traceql/expr.y:234 { - yyVAL.scalarExpression = NewStaticInt(-yyDollar[2].staticInt) + yyVAL.aggregate = newAggregate(aggregateMax, yyDollar[3].fieldExpression) } case 80: - yyDollar = yyS[yypt-2 : yypt+1] -//line pkg/traceql/expr.y:232 + yyDollar = yyS[yypt-4 : yypt+1] +//line pkg/traceql/expr.y:235 { - yyVAL.scalarExpression = NewStaticFloat(-yyDollar[2].staticFloat) + yyVAL.aggregate = newAggregate(aggregateMin, yyDollar[3].fieldExpression) } case 81: - yyDollar = yyS[yypt-2 : yypt+1] -//line pkg/traceql/expr.y:233 + yyDollar = yyS[yypt-4 : yypt+1] +//line pkg/traceql/expr.y:236 { - yyVAL.scalarExpression = NewStaticDuration(-yyDollar[2].staticDuration) + yyVAL.aggregate = newAggregate(aggregateAvg, yyDollar[3].fieldExpression) } case 82: - yyDollar = yyS[yypt-3 : yypt+1] + yyDollar = yyS[yypt-4 : yypt+1] //line pkg/traceql/expr.y:237 { - yyVAL.aggregate = newAggregate(aggregateCount, nil) + yyVAL.aggregate = newAggregate(aggregateSum, yyDollar[3].fieldExpression) } case 83: - yyDollar = yyS[yypt-4 : yypt+1] -//line pkg/traceql/expr.y:238 + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:244 { - yyVAL.aggregate = newAggregate(aggregateMax, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = yyDollar[2].fieldExpression } case 84: - yyDollar = yyS[yypt-4 : yypt+1] -//line pkg/traceql/expr.y:239 + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:245 { - yyVAL.aggregate = newAggregate(aggregateMin, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpAdd, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 85: - yyDollar = yyS[yypt-4 : yypt+1] -//line pkg/traceql/expr.y:240 + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:246 { - yyVAL.aggregate = newAggregate(aggregateAvg, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpSub, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 86: - yyDollar = yyS[yypt-4 : yypt+1] -//line pkg/traceql/expr.y:241 + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:247 { - yyVAL.aggregate = newAggregate(aggregateSum, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpMult, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 87: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:248 { - yyVAL.fieldExpression = yyDollar[2].fieldExpression + yyVAL.fieldExpression = newBinaryOperation(OpDiv, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 88: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:249 { - yyVAL.fieldExpression = newBinaryOperation(OpAdd, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpMod, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 89: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:250 { - yyVAL.fieldExpression = newBinaryOperation(OpSub, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpEqual, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 90: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:251 { - yyVAL.fieldExpression = newBinaryOperation(OpMult, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpNotEqual, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 91: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:252 { - yyVAL.fieldExpression = newBinaryOperation(OpDiv, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpLess, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 92: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:253 { - yyVAL.fieldExpression = newBinaryOperation(OpMod, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpLessEqual, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 93: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:254 { - yyVAL.fieldExpression = newBinaryOperation(OpEqual, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpGreater, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 94: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:255 { - yyVAL.fieldExpression = newBinaryOperation(OpNotEqual, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpGreaterEqual, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 95: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:256 { - yyVAL.fieldExpression = newBinaryOperation(OpLess, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpRegex, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 96: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:257 { - yyVAL.fieldExpression = newBinaryOperation(OpLessEqual, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpNotRegex, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 97: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:258 { - yyVAL.fieldExpression = newBinaryOperation(OpGreater, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpPower, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 98: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:259 { - yyVAL.fieldExpression = newBinaryOperation(OpGreaterEqual, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpAnd, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 99: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:260 { - yyVAL.fieldExpression = newBinaryOperation(OpRegex, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpOr, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 100: - yyDollar = yyS[yypt-3 : yypt+1] + yyDollar = yyS[yypt-2 : yypt+1] //line pkg/traceql/expr.y:261 { - yyVAL.fieldExpression = newBinaryOperation(OpNotRegex, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newUnaryOperation(OpSub, yyDollar[2].fieldExpression) } case 101: - yyDollar = yyS[yypt-3 : yypt+1] + yyDollar = yyS[yypt-2 : yypt+1] //line pkg/traceql/expr.y:262 { - yyVAL.fieldExpression = newBinaryOperation(OpPower, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newUnaryOperation(OpNot, yyDollar[2].fieldExpression) } case 102: - yyDollar = yyS[yypt-3 : yypt+1] + yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:263 { - yyVAL.fieldExpression = newBinaryOperation(OpAnd, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = yyDollar[1].static } case 103: - yyDollar = yyS[yypt-3 : yypt+1] + yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:264 { - yyVAL.fieldExpression = newBinaryOperation(OpOr, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = yyDollar[1].intrinsicField } case 104: - yyDollar = yyS[yypt-2 : yypt+1] + yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:265 { - yyVAL.fieldExpression = newUnaryOperation(OpSub, yyDollar[2].fieldExpression) + yyVAL.fieldExpression = yyDollar[1].attributeField } case 105: - yyDollar = yyS[yypt-2 : yypt+1] -//line pkg/traceql/expr.y:266 + yyDollar = yyS[yypt-1 : yypt+1] +//line pkg/traceql/expr.y:272 { - yyVAL.fieldExpression = newUnaryOperation(OpNot, yyDollar[2].fieldExpression) + yyVAL.static = NewStaticString(yyDollar[1].staticStr) } case 106: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:267 +//line pkg/traceql/expr.y:273 { - yyVAL.fieldExpression = yyDollar[1].static + yyVAL.static = NewStaticInt(yyDollar[1].staticInt) } case 107: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:268 +//line pkg/traceql/expr.y:274 { - yyVAL.fieldExpression = yyDollar[1].intrinsicField + yyVAL.static = NewStaticFloat(yyDollar[1].staticFloat) } case 108: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:269 +//line pkg/traceql/expr.y:275 { - yyVAL.fieldExpression = yyDollar[1].attributeField + yyVAL.static = NewStaticBool(true) } case 109: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:276 { - yyVAL.static = NewStaticString(yyDollar[1].staticStr) + yyVAL.static = NewStaticBool(false) } case 110: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:277 { - yyVAL.static = NewStaticInt(yyDollar[1].staticInt) + yyVAL.static = NewStaticNil() } case 111: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:278 { - yyVAL.static = NewStaticFloat(yyDollar[1].staticFloat) + yyVAL.static = NewStaticDuration(yyDollar[1].staticDuration) } case 112: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:279 { - yyVAL.static = NewStaticBool(true) + yyVAL.static = NewStaticStatus(StatusOk) } case 113: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:280 { - yyVAL.static = NewStaticBool(false) + yyVAL.static = NewStaticStatus(StatusError) } case 114: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:281 { - yyVAL.static = NewStaticNil() + yyVAL.static = NewStaticStatus(StatusUnset) } case 115: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:282 { - yyVAL.static = NewStaticDuration(yyDollar[1].staticDuration) + yyVAL.static = NewStaticKind(KindUnspecified) } case 116: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:283 { - yyVAL.static = NewStaticStatus(StatusOk) + yyVAL.static = NewStaticKind(KindInternal) } case 117: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:284 { - yyVAL.static = NewStaticStatus(StatusError) + yyVAL.static = NewStaticKind(KindServer) } case 118: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:285 { - yyVAL.static = NewStaticStatus(StatusUnset) + yyVAL.static = NewStaticKind(KindClient) } case 119: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:286 { - yyVAL.static = NewStaticKind(KindUnspecified) + yyVAL.static = NewStaticKind(KindProducer) } case 120: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:287 { - yyVAL.static = NewStaticKind(KindInternal) + yyVAL.static = NewStaticKind(KindConsumer) } case 121: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:288 +//line pkg/traceql/expr.y:291 { - yyVAL.static = NewStaticKind(KindServer) + yyVAL.intrinsicField = NewIntrinsic(IntrinsicDuration) } case 122: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:289 +//line pkg/traceql/expr.y:292 { - yyVAL.static = NewStaticKind(KindClient) + yyVAL.intrinsicField = NewIntrinsic(IntrinsicChildCount) } case 123: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:290 +//line pkg/traceql/expr.y:293 { - yyVAL.static = NewStaticKind(KindProducer) + yyVAL.intrinsicField = NewIntrinsic(IntrinsicName) } case 124: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:291 +//line pkg/traceql/expr.y:294 { - yyVAL.static = NewStaticKind(KindConsumer) + yyVAL.intrinsicField = NewIntrinsic(IntrinsicStatus) } case 125: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:295 { - yyVAL.intrinsicField = NewIntrinsic(IntrinsicDuration) + yyVAL.intrinsicField = NewIntrinsic(IntrinsicStatusMessage) } case 126: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:296 { - yyVAL.intrinsicField = NewIntrinsic(IntrinsicChildCount) + yyVAL.intrinsicField = NewIntrinsic(IntrinsicKind) } case 127: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:297 { - yyVAL.intrinsicField = NewIntrinsic(IntrinsicName) + yyVAL.intrinsicField = NewIntrinsic(IntrinsicParent) } case 128: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:298 { - yyVAL.intrinsicField = NewIntrinsic(IntrinsicStatus) + yyVAL.intrinsicField = NewIntrinsic(IntrinsicTraceRootSpan) } case 129: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:299 { - yyVAL.intrinsicField = NewIntrinsic(IntrinsicStatusMessage) + yyVAL.intrinsicField = NewIntrinsic(IntrinsicTraceRootService) } case 130: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:300 - { - yyVAL.intrinsicField = NewIntrinsic(IntrinsicKind) - } - case 131: - yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:301 - { - yyVAL.intrinsicField = NewIntrinsic(IntrinsicParent) - } - case 132: - yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:302 - { - yyVAL.intrinsicField = NewIntrinsic(IntrinsicTraceRootSpan) - } - case 133: - yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:303 - { - yyVAL.intrinsicField = NewIntrinsic(IntrinsicTraceRootService) - } - case 134: - yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:304 { yyVAL.intrinsicField = NewIntrinsic(IntrinsicTraceDuration) } - case 135: + case 131: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:308 +//line pkg/traceql/expr.y:304 { yyVAL.attributeField = NewAttribute(yyDollar[2].staticStr) } - case 136: + case 132: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:309 +//line pkg/traceql/expr.y:305 { yyVAL.attributeField = NewScopedAttribute(AttributeScopeResource, false, yyDollar[2].staticStr) } - case 137: + case 133: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:310 +//line pkg/traceql/expr.y:306 { yyVAL.attributeField = NewScopedAttribute(AttributeScopeSpan, false, yyDollar[2].staticStr) } - case 138: + case 134: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:311 +//line pkg/traceql/expr.y:307 { yyVAL.attributeField = NewScopedAttribute(AttributeScopeNone, true, yyDollar[2].staticStr) } - case 139: + case 135: yyDollar = yyS[yypt-4 : yypt+1] -//line pkg/traceql/expr.y:312 +//line pkg/traceql/expr.y:308 { yyVAL.attributeField = NewScopedAttribute(AttributeScopeResource, true, yyDollar[3].staticStr) } - case 140: + case 136: yyDollar = yyS[yypt-4 : yypt+1] -//line pkg/traceql/expr.y:313 +//line pkg/traceql/expr.y:309 { yyVAL.attributeField = NewScopedAttribute(AttributeScopeSpan, true, yyDollar[3].staticStr) } diff --git a/pkg/traceql/lexer.go b/pkg/traceql/lexer.go index 11f33c71b78..9a6908f962a 100644 --- a/pkg/traceql/lexer.go +++ b/pkg/traceql/lexer.go @@ -50,9 +50,7 @@ var tokens = map[string]int{ ">>": DESC, "<<": ANCE, "~": SIBL, - "!>>": NOT_DESC, "!>": NOT_CHILD, - "!<<": NOT_ANCE, "!<": NOT_PARENT, "duration": IDURATION, "childCount": CHILDCOUNT, diff --git a/pkg/traceql/lexer_test.go b/pkg/traceql/lexer_test.go index b0d9ff5789a..eefb09030dd 100644 --- a/pkg/traceql/lexer_test.go +++ b/pkg/traceql/lexer_test.go @@ -66,14 +66,6 @@ func TestLexerAttributes(t *testing.T) { })) } -func TestLexerOperators(t *testing.T) { - testLexer(t, ([]lexerTestCase{ - // duration - // {"!>", []int{NOT_CHILD}}, - {"!>>", []int{NOT_DESC}}, - })) -} - func TestLexerDuration(t *testing.T) { testLexer(t, ([]lexerTestCase{ // duration diff --git a/pkg/traceql/test_examples.yaml b/pkg/traceql/test_examples.yaml index befe23ec6cc..c195a825d6c 100644 --- a/pkg/traceql/test_examples.yaml +++ b/pkg/traceql/test_examples.yaml @@ -74,6 +74,9 @@ valid: - '{ true } > { true }' - '{ true } < { true }' - '{ true } ~ { true }' + - '{ true } !> { true }' + - '{ true } !< { true }' + - '{ true } !~ { true }' - '({ true } | count() > 1 | { false }) >> ({ true } | count() > 1 | { false })' - '({ true } | count() > 1 | { false }) > ({ true } | count() > 1 | { false })' - '({ true } | count() > 1 | { false }) ~ ({ true } | count() > 1 | { false })' From e54b6f00a55828ba06dfae624ba86941cfa76077 Mon Sep 17 00:00:00 2001 From: Joe Elliott Date: Fri, 6 Oct 2023 10:09:05 -0400 Subject: [PATCH 04/14] added tempodb lvl tests Signed-off-by: Joe Elliott --- tempodb/tempodb_search_test.go | 69 ++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/tempodb/tempodb_search_test.go b/tempodb/tempodb_search_test.go index a66d0e0b459..7fa3b2a5cee 100644 --- a/tempodb/tempodb_search_test.go +++ b/tempodb/tempodb_search_test.go @@ -517,6 +517,72 @@ func traceQLStructural(t *testing.T, _ *tempopb.Trace, wantMeta *tempopb.TraceSe }, }, }, + { + req: &tempopb.SearchRequest{Query: "{ .child } !> { .parent }"}, + expected: []*tempopb.TraceSearchMetadata{ + { + SpanSets: []*tempopb.SpanSet{ + { + Spans: []*tempopb.Span{ + { + SpanID: "0000000000040506", + StartTimeUnixNano: 1000000000000, + DurationNanos: 2000000000, + Attributes: []*v1_common.KeyValue{ + {Key: "parent", Value: &v1_common.AnyValue{Value: &v1_common.AnyValue_BoolValue{BoolValue: true}}}, + }, + }, + }, + Matched: 1, + }, + }, + }, + }, + }, + { + req: &tempopb.SearchRequest{Query: "{ .child } !~ { .parent }"}, + expected: []*tempopb.TraceSearchMetadata{ + { + SpanSets: []*tempopb.SpanSet{ + { + Spans: []*tempopb.Span{ + { + SpanID: "0000000000040506", + StartTimeUnixNano: 1000000000000, + DurationNanos: 2000000000, + Attributes: []*v1_common.KeyValue{ + {Key: "parent", Value: &v1_common.AnyValue{Value: &v1_common.AnyValue_BoolValue{BoolValue: true}}}, + }, + }, + }, + Matched: 1, + }, + }, + }, + }, + }, + { + req: &tempopb.SearchRequest{Query: "{ .parent } !< { .child }"}, + expected: []*tempopb.TraceSearchMetadata{ + { + SpanSets: []*tempopb.SpanSet{ + { + Spans: []*tempopb.Span{ + { + SpanID: "0000000000010203", + StartTimeUnixNano: 1000000000000, + DurationNanos: 1000000000, + Attributes: []*v1_common.KeyValue{ + {Key: "child", Value: &v1_common.AnyValue{Value: &v1_common.AnyValue_BoolValue{BoolValue: true}}}, + }, + }, + }, + Matched: 1, + }, + }, + }, + }, + }, { req: &tempopb.SearchRequest{Query: "{ .child } ~ { .child2 }"}, expected: []*tempopb.TraceSearchMetadata{ @@ -576,6 +642,9 @@ func traceQLStructural(t *testing.T, _ *tempopb.Trace, wantMeta *tempopb.TraceSe {Query: "{} >> {.broken}"}, {Query: "{} > {.broken}"}, {Query: "{} ~ {.broken}"}, + {Query: "{ .child } !< { .parent }"}, + {Query: "{ .parent } !> { .child }"}, + {Query: "{ .child } !~ { .child2 }"}, } for _, tc := range searchesThatMatch { From ef40ff3938de172ed297a3b2d648492758740b88 Mon Sep 17 00:00:00 2001 From: Joe Elliott Date: Fri, 6 Oct 2023 10:15:11 -0400 Subject: [PATCH 05/14] parse tests Signed-off-by: Joe Elliott --- pkg/traceql/parse_test.go | 52 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/pkg/traceql/parse_test.go b/pkg/traceql/parse_test.go index 1d96bd10a46..f9395248a73 100644 --- a/pkg/traceql/parse_test.go +++ b/pkg/traceql/parse_test.go @@ -133,6 +133,19 @@ func TestPipelineSpansetOperators(t *testing.T) { ), ), }, + { + in: "({ .a } | { .b }) ~ ({ .a } | { .b })", + expected: newSpansetOperation(OpSpansetSibling, + newPipeline( + newSpansetFilter(NewAttribute("a")), + newSpansetFilter(NewAttribute("b")), + ), + newPipeline( + newSpansetFilter(NewAttribute("a")), + newSpansetFilter(NewAttribute("b")), + ), + ), + }, { in: "({ .a } | { .b }) && ({ .a } | { .b })", expected: newSpansetOperation(OpSpansetAnd, @@ -172,6 +185,45 @@ func TestPipelineSpansetOperators(t *testing.T) { ), ), }, + { + in: "({ .a } | { .b }) !> ({ .a } | { .b })", + expected: newSpansetOperation(OpSpansetNotChild, + newPipeline( + newSpansetFilter(NewAttribute("a")), + newSpansetFilter(NewAttribute("b")), + ), + newPipeline( + newSpansetFilter(NewAttribute("a")), + newSpansetFilter(NewAttribute("b")), + ), + ), + }, + { + in: "({ .a } | { .b }) !< ({ .a } | { .b })", + expected: newSpansetOperation(OpSpansetNotParent, + newPipeline( + newSpansetFilter(NewAttribute("a")), + newSpansetFilter(NewAttribute("b")), + ), + newPipeline( + newSpansetFilter(NewAttribute("a")), + newSpansetFilter(NewAttribute("b")), + ), + ), + }, + { + in: "({ .a } | { .b }) !~ ({ .a } | { .b })", + expected: newSpansetOperation(OpSpansetNotSibling, + newPipeline( + newSpansetFilter(NewAttribute("a")), + newSpansetFilter(NewAttribute("b")), + ), + newPipeline( + newSpansetFilter(NewAttribute("a")), + newSpansetFilter(NewAttribute("b")), + ), + ), + }, } for _, tc := range tests { From f819fc9d26539611cb70436ec7e0ddde6d09750f Mon Sep 17 00:00:00 2001 From: Joe Elliott Date: Fri, 6 Oct 2023 10:33:59 -0400 Subject: [PATCH 06/14] consolidated code Signed-off-by: Joe Elliott --- pkg/traceql/ast_execute.go | 116 ++++++++++++------------------------- 1 file changed, 38 insertions(+), 78 deletions(-) diff --git a/pkg/traceql/ast_execute.go b/pkg/traceql/ast_execute.go index 7de00ac5721..f9c804a45f6 100644 --- a/pkg/traceql/ast_execute.go +++ b/pkg/traceql/ast_execute.go @@ -85,6 +85,9 @@ func (o SpansetOperation) evaluate(input []*Spanset) (output []*Spanset, err err return nil, err } + var relFn func(l, r Span) bool + var falseForAll bool + switch o.Op { case OpSpansetAnd: if len(lhs) > 0 && len(rhs) > 0 { @@ -100,82 +103,50 @@ func (o SpansetOperation) evaluate(input []*Spanset) (output []*Spanset, err err output = append(output, matchingSpanset) } + // relationship operators all set relFn which is used by below code + // to perform the operation case OpSpansetDescendant: - spans, err := o.joinSpansets(lhs, rhs, true, func(l, r Span) bool { + relFn = func(l, r Span) bool { return r.DescendantOf(l) - }) - if err != nil { - return nil, err - } - - if len(spans) > 0 { - // Clone here to capture previously computed aggregates, grouped attrs, etc. - // Copy spans to new slice because of internal buffering. - matchingSpanset := input[i].clone() - matchingSpanset.Spans = append([]Span(nil), spans...) - output = append(output, matchingSpanset) } + falseForAll = false case OpSpansetAncestor: - spans, err := o.joinSpansets(lhs, rhs, true, func(l, r Span) bool { - // In case of ancestor the lhs becomes descendant of rhs + relFn = func(l, r Span) bool { return l.DescendantOf(r) - }) - if err != nil { - return nil, err - } - - if len(spans) > 0 { - // Clone here to capture previously computed aggregates, grouped attrs, etc. - // Copy spans to new slice because of internal buffering. - matchingSpanset := input[i].clone() - matchingSpanset.Spans = append([]Span(nil), spans...) - output = append(output, matchingSpanset) } + falseForAll = false case OpSpansetChild: fallthrough case OpSpansetNotChild: - spans, err := o.joinSpansets(lhs, rhs, o.Op == OpSpansetChild, func(l, r Span) bool { + relFn = func(l, r Span) bool { return r.ChildOf(l) - }) - if err != nil { - return nil, err - } - - if len(spans) > 0 { - // Clone here to capture previously computed aggregates, grouped attrs, etc. - // Copy spans to new slice because of internal buffering. - matchingSpanset := input[i].clone() - matchingSpanset.Spans = append([]Span(nil), spans...) - output = append(output, matchingSpanset) } + falseForAll = o.Op == OpSpansetNotChild case OpSpansetParent: fallthrough case OpSpansetNotParent: - spans, err := o.joinSpansets(lhs, rhs, o.Op == OpSpansetParent, func(l, r Span) bool { - // In case of parent the lhs becomes child of rhs + relFn = func(l, r Span) bool { return l.ChildOf(r) - }) - if err != nil { - return nil, err - } - - if len(spans) > 0 { - // Clone here to capture previously computed aggregates, grouped attrs, etc. - // Copy spans to new slice because of internal buffering. - matchingSpanset := input[i].clone() - matchingSpanset.Spans = append([]Span(nil), spans...) - output = append(output, matchingSpanset) } + falseForAll = o.Op == OpSpansetNotParent case OpSpansetSibling: fallthrough case OpSpansetNotSibling: - spans, err := o.joinSpansets(lhs, rhs, o.Op == OpSpansetSibling, func(l, r Span) bool { + relFn = func(l, r Span) bool { return r.SiblingOf(l) - }) + } + falseForAll = o.Op == OpSpansetNotSibling + default: + return nil, fmt.Errorf("spanset operation (%v) not supported", o.Op) + } + + // if relFn was set up above we are doing a relationship operation. + if relFn != nil { + spans, err := o.joinSpansets(lhs, rhs, falseForAll, relFn) if err != nil { return nil, err } @@ -187,9 +158,6 @@ func (o SpansetOperation) evaluate(input []*Spanset) (output []*Spanset, err err matchingSpanset.Spans = append([]Span(nil), spans...) output = append(output, matchingSpanset) } - - default: - return nil, fmt.Errorf("spanset operation (%v) not supported", o.Op) } } @@ -199,7 +167,7 @@ func (o SpansetOperation) evaluate(input []*Spanset) (output []*Spanset, err err // joinSpansets compares all pairwise combinations of the inputs and returns the right-hand side // where the eval callback returns true. For now the behavior is only defined when there is exactly one // spanset on both sides and will return an error if multiple spansets are present. -func (o *SpansetOperation) joinSpansets(lhs, rhs []*Spanset, rhsPositive bool, eval func(l, r Span) bool) ([]Span, error) { +func (o *SpansetOperation) joinSpansets(lhs, rhs []*Spanset, falseForAll bool, eval func(l, r Span) bool) ([]Span, error) { if len(lhs) < 1 || len(rhs) < 1 { return nil, nil } @@ -208,41 +176,33 @@ func (o *SpansetOperation) joinSpansets(lhs, rhs []*Spanset, rhsPositive bool, e return nil, errSpansetOperationMultiple } - return o.joinSpansAndReturnRHS(lhs[0].Spans, rhs[0].Spans, rhsPositive, eval), nil + return o.joinSpansAndReturnRHS(lhs[0].Spans, rhs[0].Spans, falseForAll, eval), nil } // joinSpansAndReturnRHS compares all pairwise combinations of the inputs and returns the right-hand side // spans where the eval callback returns true. Uses and internal buffer and output is only valid until // the next call. Destructively edits the RHS slice for performance. -func (o *SpansetOperation) joinSpansAndReturnRHS(lhs, rhs []Span, rhsPositive bool, eval func(l, r Span) bool) []Span { +// falseForAll indicates that the spans on the RHS should only be returned if relFn returns +// false for all on the LHS. otherwise spans on the RHS are returned if there are any matches on the lhs +func (o *SpansetOperation) joinSpansAndReturnRHS(lhs, rhs []Span, falseForAll bool, eval func(l, r Span) bool) []Span { if len(lhs) == 0 || len(rhs) == 0 { return nil } o.matchingSpansBuffer = o.matchingSpansBuffer[:0] - if rhsPositive { - for _, r := range rhs { - for _, l := range lhs { - if eval(l, r) { - // Returns RHS - o.matchingSpansBuffer = append(o.matchingSpansBuffer, r) - break - } + for _, r := range rhs { + matches := false + for _, l := range lhs { + if eval(l, r) { + // Returns RHS + matches = true + break } } - } else { - for _, r := range rhs { - matches := false - for _, l := range lhs { - if eval(l, r) { - matches = true - break - } - } - if !matches { - o.matchingSpansBuffer = append(o.matchingSpansBuffer, r) - } + if matches && !falseForAll || // return RHS if there are any matches on the LHS + !matches && falseForAll { // return RHS if there are no matches on the LHS + o.matchingSpansBuffer = append(o.matchingSpansBuffer, r) } } From ebd795c5c89a4e9ee0567eff34538216ef8086f7 Mon Sep 17 00:00:00 2001 From: Joe Elliott Date: Fri, 6 Oct 2023 10:45:18 -0400 Subject: [PATCH 07/14] tests Signed-off-by: Joe Elliott --- pkg/traceql/ast_validate.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/traceql/ast_validate.go b/pkg/traceql/ast_validate.go index 5a489713373..416d55c2f3a 100644 --- a/pkg/traceql/ast_validate.go +++ b/pkg/traceql/ast_validate.go @@ -179,11 +179,17 @@ func (o BinaryOperation) validate() error { return fmt.Errorf("illegal operation for the given types: %s", o.String()) } + // this condition may not be possible to hit since it's not parseable. + // however, if we did somehow end up this situation, it would be good to return + // a reasonable error switch o.Op { - case OpSpansetChild, // jpe - should this exist? should we add the not operators? + case OpSpansetChild, OpSpansetParent, OpSpansetDescendant, OpSpansetAncestor, + OpSpansetNotChild, + OpSpansetNotParent, + OpSpansetNotSibling, OpSpansetSibling: return newUnsupportedError(fmt.Sprintf("binary operation (%v)", o.Op)) } From 8810c704a1b352c9701579edfc2ba7b55060daa7 Mon Sep 17 00:00:00 2001 From: Joe Elliott Date: Fri, 6 Oct 2023 10:52:50 -0400 Subject: [PATCH 08/14] docs Signed-off-by: Joe Elliott --- docs/sources/tempo/traceql/_index.md | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/docs/sources/tempo/traceql/_index.md b/docs/sources/tempo/traceql/_index.md index 738cefd990e..c6779dd2561 100644 --- a/docs/sources/tempo/traceql/_index.md +++ b/docs/sources/tempo/traceql/_index.md @@ -208,13 +208,14 @@ The second expression returns no traces because it's impossible for a single spa ### Structural -These spanset operators look at the structure of a trace and the relationship between the spans. +These spanset operators look at the structure of a trace and the relationship between the spans. Structural operators ALWAYS return +matches from the right hand side of the operator. - `{condA} >> {condB}` - The descendant operator (`>>`) looks for spans matching `{condB}` that are descendants of a span matching `{condA}` - `{condA} << {condB}` - The ancestor operator (`<<`) looks for spans matching `{condB}` that are ancestor of a span matching `{condA}` - `{condA} > {condB}` - The child operator (`>`) looks for spans matching `{condB}` that are direct child spans of a parent matching `{condA}` - `{condA} < {condB}` - The parent operator (`<`) looks for spans matching `{condB}` that are direct parent spans of a child matching `{condA}` -- `{condA} ~ {condB}` - The sibling operator (`~`) checks that spans matching `{condA}` and `{condB}` are siblings of the same parent span. +- `{condA} ~ {condB}` - The sibling operator (`~`) looks that spans matching `{condB}` that have at least one sibling matching `{condA}`. For example, to find a trace where a specific HTTP API interacted with a specific database: @@ -222,6 +223,27 @@ For example, to find a trace where a specific HTTP API interacted with a specifi { span.http.url = "/path/of/api" } >> { span.db.name = "db-shard-001" } ``` +### Experimental Structural + +These spanset operators look at the structure of a trace and the relationship between the spans. They are marked experimental b/c they +are known to sometimes return false positives. However, they can be very useful and we encourage users to try them and give feedback. + +- `{condA} !> {condB}` - The not child operator (`!>`) looks for spans matching `{condB}` that are not direct child spans of a parent matching `{condA}` +- `{condA} !< {condB}` - The not parent operator (`!<`) looks for spans matching `{condB}` that are not direct parent spans of a child matching `{condA}` +- `{condA} !~ {condB}` - The not sibling operator (`!~`) looks that spans matching `{condB}` that do not have at least one sibling matching `{condA}`. + +For example, to find a trace with a leaf span in the service "foo": + +``` +{ } !< { resource.service.name = "foo" } +``` + +To find a span that is the last error in a series of cascading errors: + +``` +{ status != error } !< { status = error } +``` + ## Aggregators So far, all of the example queries expressions have been about individual spans. You can use aggregate functions to ask questions about a set of spans. These currently consist of: From dddfabc6d11b665595382c8552d5b80ee6ea90df Mon Sep 17 00:00:00 2001 From: Joe Elliott Date: Fri, 6 Oct 2023 10:59:03 -0400 Subject: [PATCH 09/14] changelog Signed-off-by: Joe Elliott --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index df5ecb216f9..c952daed001 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * [FEATURE] New encoding vParquet3 with support for dedicated attribute columns (@mapno, @stoewer) [#2649](https://github.com/grafana/tempo/pull/2649) * [FEATURE] Add filtering support to Generic Forwarding [#2742](https://github.com/grafana/tempo/pull/2742) (@Blinkuu) * [FEATURE] Add cli command to print out summary of large traces [#2775](https://github.com/grafana/tempo/pull/2775) (@ie-pham) +* [FEATURE] Added not structural operators to TraceQL: !>, !<, and !~ [#2993](https://github.com/grafana/tempo/pull/2993) (@joe-elliott) * [CHANGE] Update Go to 1.21 [#2486](https://github.com/grafana/tempo/pull/2829) (@zalegrala) * [CHANGE] Make metrics-generator ingestion slack per tenant [#2589](https://github.com/grafana/tempo/pull/2589) (@ie-pham) * [CHANGE] Moved the tempo_ingester_traces_created_total metric to be incremented when a trace is cut to the wal [#2884](https://github.com/grafana/tempo/pull/2884) (@joe-elliott) From 7727b56e561d5513711bbe3ab9c01eb009fb7b54 Mon Sep 17 00:00:00 2001 From: Joe Elliott Date: Fri, 6 Oct 2023 14:36:19 -0400 Subject: [PATCH 10/14] not ancestor/descendant Signed-off-by: Joe Elliott --- pkg/traceql/ast.go | 2 +- pkg/traceql/ast_execute.go | 8 +- pkg/traceql/ast_execute_test.go | 30 ++ pkg/traceql/ast_validate.go | 2 + pkg/traceql/enum_operators.go | 6 + pkg/traceql/enum_operators_test.go | 2 + pkg/traceql/expr.y | 6 +- pkg/traceql/expr.y.go | 824 +++++++++++++++-------------- pkg/traceql/lexer.go | 28 +- pkg/traceql/lexer_test.go | 11 + pkg/traceql/parse_test.go | 31 ++ pkg/traceql/test_examples.yaml | 2 + 12 files changed, 547 insertions(+), 405 deletions(-) diff --git a/pkg/traceql/ast.go b/pkg/traceql/ast.go index d3bfc90f14d..ced59a785d0 100644 --- a/pkg/traceql/ast.go +++ b/pkg/traceql/ast.go @@ -234,7 +234,7 @@ type SpansetOperation struct { func (o SpansetOperation) extractConditions(request *FetchSpansRequest) { switch o.Op { - case OpSpansetDescendant, OpSpansetAncestor: + case OpSpansetDescendant, OpSpansetAncestor, OpSpansetNotDescendant, OpSpansetNotAncestor: request.Conditions = append(request.Conditions, Condition{ Attribute: NewIntrinsic(IntrinsicStructuralDescendant), }) diff --git a/pkg/traceql/ast_execute.go b/pkg/traceql/ast_execute.go index f9c804a45f6..eb246ef931b 100644 --- a/pkg/traceql/ast_execute.go +++ b/pkg/traceql/ast_execute.go @@ -106,16 +106,20 @@ func (o SpansetOperation) evaluate(input []*Spanset) (output []*Spanset, err err // relationship operators all set relFn which is used by below code // to perform the operation case OpSpansetDescendant: + fallthrough + case OpSpansetNotDescendant: relFn = func(l, r Span) bool { return r.DescendantOf(l) } - falseForAll = false + falseForAll = o.Op == OpSpansetNotDescendant case OpSpansetAncestor: + fallthrough + case OpSpansetNotAncestor: relFn = func(l, r Span) bool { return l.DescendantOf(r) } - falseForAll = false + falseForAll = o.Op == OpSpansetNotAncestor case OpSpansetChild: fallthrough diff --git a/pkg/traceql/ast_execute_test.go b/pkg/traceql/ast_execute_test.go index 2dabc4699a4..fd934f5144f 100644 --- a/pkg/traceql/ast_execute_test.go +++ b/pkg/traceql/ast_execute_test.go @@ -460,6 +460,36 @@ func TestSpansetOperationEvaluate(t *testing.T) { }}, }, }, + { + "{ } !<< { .child }", + []*Spanset{ + {Spans: []Span{ + newMockSpan([]byte{1}).WithAttrBool("parent", true).WithNestedSetInfo(0, 1, 4), + newMockSpan([]byte{2}).WithAttrBool("child", true).WithNestedSetInfo(1, 2, 3), + newMockSpan([]byte{2}).WithAttrBool("child", true).WithNestedSetInfo(0, 1, 4), + }}, + }, + []*Spanset{ + {Spans: []Span{ + newMockSpan([]byte{2}).WithAttrBool("child", true).WithNestedSetInfo(1, 2, 3), + }}, + }, + }, + { + "{ } !>> { .parent }", + []*Spanset{ + {Spans: []Span{ + newMockSpan([]byte{1}).WithAttrBool("parent", true).WithNestedSetInfo(0, 1, 4), + newMockSpan([]byte{1}).WithAttrBool("parent", true).WithNestedSetInfo(1, 2, 3), + newMockSpan([]byte{2}).WithAttrBool("child", true).WithNestedSetInfo(1, 2, 3), + }}, + }, + []*Spanset{ + {Spans: []Span{ + newMockSpan([]byte{1}).WithAttrBool("parent", true).WithNestedSetInfo(0, 1, 4), + }}, + }, + }, { // tests that child operators do not modify the spanset "{ } > { } > { } > { }", []*Spanset{ diff --git a/pkg/traceql/ast_validate.go b/pkg/traceql/ast_validate.go index 416d55c2f3a..fb18ecc97b5 100644 --- a/pkg/traceql/ast_validate.go +++ b/pkg/traceql/ast_validate.go @@ -190,6 +190,8 @@ func (o BinaryOperation) validate() error { OpSpansetNotChild, OpSpansetNotParent, OpSpansetNotSibling, + OpSpansetNotAncestor, + OpSpansetNotDescendant, OpSpansetSibling: return newUnsupportedError(fmt.Sprintf("binary operation (%v)", o.Op)) } diff --git a/pkg/traceql/enum_operators.go b/pkg/traceql/enum_operators.go index fc072769e06..aaa0d11fe54 100644 --- a/pkg/traceql/enum_operators.go +++ b/pkg/traceql/enum_operators.go @@ -33,6 +33,8 @@ const ( OpSpansetNotChild OpSpansetNotParent OpSpansetNotSibling + OpSpansetNotAncestor + OpSpansetNotDescendant ) func (op Operator) isBoolean() bool { @@ -172,6 +174,10 @@ func (op Operator) String() string { return "!<" case OpSpansetNotSibling: return "!~" + case OpSpansetNotAncestor: + return "!<<" + case OpSpansetNotDescendant: + return "!>>" } return fmt.Sprintf("operator(%d)", op) diff --git a/pkg/traceql/enum_operators_test.go b/pkg/traceql/enum_operators_test.go index 9f7ffb247f6..f7feeb739b2 100644 --- a/pkg/traceql/enum_operators_test.go +++ b/pkg/traceql/enum_operators_test.go @@ -38,6 +38,8 @@ func TestOperatorIsBoolean(t *testing.T) { {OpSpansetNotChild, false}, {OpSpansetNotParent, false}, {OpSpansetNotSibling, false}, + {OpSpansetNotAncestor, false}, + {OpSpansetNotDescendant, false}, } for _, tc := range tt { diff --git a/pkg/traceql/expr.y b/pkg/traceql/expr.y index 22072138540..6d2030cb4e7 100644 --- a/pkg/traceql/expr.y +++ b/pkg/traceql/expr.y @@ -84,7 +84,7 @@ import ( // Operators are listed with increasing precedence. %left PIPE %left AND OR -%left EQ NEQ LT LTE GT GTE NRE RE DESC ANCE SIBL NOT_CHILD NOT_PARENT +%left EQ NEQ LT LTE GT GTE NRE RE DESC ANCE SIBL NOT_CHILD NOT_PARENT NOT_DESC NOT_ANCE %left ADD SUB %left NOT %left MUL DIV MOD @@ -114,6 +114,8 @@ spansetPipelineExpression: // shares the same operators as spansetExpression. sp | spansetPipelineExpression SIBL spansetPipelineExpression { $$ = newSpansetOperation(OpSpansetSibling, $1, $3) } | spansetPipelineExpression NOT_CHILD spansetPipelineExpression { $$ = newSpansetOperation(OpSpansetNotChild, $1, $3) } | spansetPipelineExpression NOT_PARENT spansetPipelineExpression { $$ = newSpansetOperation(OpSpansetNotParent, $1, $3) } + | spansetPipelineExpression NOT_DESC spansetPipelineExpression { $$ = newSpansetOperation(OpSpansetNotDescendant, $1, $3) } + | spansetPipelineExpression NOT_ANCE spansetPipelineExpression { $$ = newSpansetOperation(OpSpansetNotAncestor, $1, $3) } | spansetPipelineExpression NRE spansetPipelineExpression { $$ = newSpansetOperation(OpSpansetNotSibling, $1, $3) } | wrappedSpansetPipeline { $$ = $1 } ; @@ -163,6 +165,8 @@ spansetExpression: // shares the same operators as scalarPipelineExpression. spl | spansetExpression NOT_CHILD spansetExpression { $$ = newSpansetOperation(OpSpansetNotChild, $1, $3) } | spansetExpression NOT_PARENT spansetExpression { $$ = newSpansetOperation(OpSpansetNotParent, $1, $3) } | spansetExpression NRE spansetExpression { $$ = newSpansetOperation(OpSpansetNotSibling, $1, $3) } + | spansetExpression NOT_ANCE spansetExpression { $$ = newSpansetOperation(OpSpansetNotAncestor, $1, $3) } + | spansetExpression NOT_DESC spansetExpression { $$ = newSpansetOperation(OpSpansetNotDescendant, $1, $3) } | spansetFilter { $$ = $1 } ; diff --git a/pkg/traceql/expr.y.go b/pkg/traceql/expr.y.go index dcc0e11b6cf..e44069347db 100644 --- a/pkg/traceql/expr.y.go +++ b/pkg/traceql/expr.y.go @@ -108,13 +108,15 @@ const ANCE = 57403 const SIBL = 57404 const NOT_CHILD = 57405 const NOT_PARENT = 57406 -const ADD = 57407 -const SUB = 57408 -const NOT = 57409 -const MUL = 57410 -const DIV = 57411 -const MOD = 57412 -const POW = 57413 +const NOT_DESC = 57407 +const NOT_ANCE = 57408 +const ADD = 57409 +const SUB = 57410 +const NOT = 57411 +const MUL = 57412 +const DIV = 57413 +const MOD = 57414 +const POW = 57415 var yyToknames = [...]string{ "$end", @@ -181,6 +183,8 @@ var yyToknames = [...]string{ "SIBL", "NOT_CHILD", "NOT_PARENT", + "NOT_DESC", + "NOT_ANCE", "ADD", "SUB", "NOT", @@ -200,219 +204,222 @@ var yyExca = [...]int{ -1, 1, 1, -1, -2, 0, - -1, 215, - 13, 63, - -2, 71, + -1, 223, + 13, 67, + -2, 75, } const yyPrivate = 57344 -const yyLast = 746 +const yyLast = 752 var yyAct = [...]int{ - 78, 5, 213, 2, 6, 8, 7, 18, 193, 74, - 61, 51, 50, 154, 247, 180, 181, 82, 182, 183, - 184, 193, 182, 183, 184, 193, 28, 251, 13, 250, - 123, 158, 153, 124, 127, 125, 241, 240, 54, 153, - 239, 141, 143, 144, 145, 146, 147, 148, 149, 150, - 151, 194, 195, 185, 186, 187, 188, 189, 190, 192, - 191, 156, 71, 72, 73, 74, 180, 181, 28, 182, - 183, 184, 193, 160, 248, 154, 176, 178, 238, 205, - 196, 197, 198, 69, 70, 157, 71, 72, 73, 74, - 58, 59, 60, 61, 246, 219, 220, 168, 170, 171, - 172, 173, 174, 175, 69, 70, 212, 71, 72, 73, - 74, 161, 131, 56, 57, 122, 58, 59, 60, 61, - 206, 207, 208, 209, 17, 121, 142, 120, 119, 118, - 210, 194, 195, 185, 186, 187, 188, 189, 190, 192, - 191, 76, 75, 202, 210, 243, 180, 181, 242, 182, - 183, 184, 193, 68, 201, 200, 123, 211, 199, 124, - 127, 125, 215, 84, 217, 55, 115, 116, 117, 83, - 19, 20, 21, 53, 17, 16, 128, 203, 204, 4, - 12, 221, 222, 223, 224, 225, 226, 227, 228, 229, - 230, 231, 232, 233, 234, 235, 236, 10, 211, 177, - 126, 1, 0, 0, 23, 26, 24, 25, 27, 14, - 129, 15, 0, 0, 0, 0, 51, 0, 51, 217, - 0, 249, 185, 186, 187, 188, 189, 190, 192, 191, - 22, 0, 52, 11, 0, 180, 181, 0, 182, 183, - 184, 193, 0, 54, 0, 54, 85, 86, 87, 91, - 111, 0, 77, 79, 0, 0, 90, 88, 89, 93, - 92, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 107, 106, 108, 109, 110, 114, 112, - 113, 56, 57, 0, 58, 59, 60, 61, 159, 162, - 163, 164, 165, 166, 167, 0, 0, 245, 0, 85, - 86, 87, 91, 111, 0, 0, 79, 80, 81, 90, - 88, 89, 93, 92, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 107, 106, 108, 109, - 110, 114, 112, 113, 194, 195, 185, 186, 187, 188, - 189, 190, 192, 191, 244, 0, 0, 0, 0, 180, - 181, 0, 182, 183, 184, 193, 0, 0, 0, 0, - 80, 81, 0, 39, 44, 0, 237, 41, 0, 40, - 0, 48, 0, 42, 43, 45, 46, 47, 0, 0, - 0, 194, 195, 185, 186, 187, 188, 189, 190, 192, - 191, 218, 0, 0, 0, 0, 180, 181, 0, 182, - 183, 184, 193, 194, 195, 185, 186, 187, 188, 189, - 190, 192, 191, 179, 0, 0, 0, 0, 180, 181, - 0, 182, 183, 184, 193, 0, 0, 0, 194, 195, - 185, 186, 187, 188, 189, 190, 192, 191, 0, 0, - 0, 0, 0, 180, 181, 0, 182, 183, 184, 193, - 0, 0, 194, 195, 185, 186, 187, 188, 189, 190, - 192, 191, 158, 0, 0, 0, 0, 180, 181, 0, - 182, 183, 184, 193, 194, 195, 185, 186, 187, 188, - 189, 190, 192, 191, 0, 0, 0, 0, 0, 180, - 181, 0, 182, 183, 184, 193, 0, 0, 0, 0, - 0, 62, 63, 64, 65, 66, 67, 0, 62, 63, - 64, 65, 66, 67, 69, 70, 0, 71, 72, 73, - 74, 69, 70, 0, 71, 72, 73, 74, 62, 63, - 64, 65, 66, 67, 19, 20, 21, 0, 17, 0, - 216, 56, 57, 0, 58, 59, 60, 61, 19, 20, - 21, 0, 17, 0, 214, 0, 0, 0, 0, 0, - 0, 19, 20, 21, 0, 17, 0, 9, 23, 26, - 24, 25, 27, 14, 0, 15, 0, 155, 0, 0, - 0, 0, 23, 26, 24, 25, 27, 14, 0, 15, - 0, 0, 0, 0, 22, 23, 26, 24, 25, 27, - 14, 0, 15, 19, 20, 21, 0, 17, 22, 128, - 19, 20, 21, 0, 39, 44, 169, 0, 41, 0, - 40, 22, 48, 0, 42, 43, 45, 46, 47, 0, - 152, 0, 0, 0, 0, 0, 0, 23, 26, 24, - 25, 27, 0, 0, 23, 26, 24, 25, 27, 41, - 0, 40, 0, 48, 0, 42, 43, 45, 46, 47, - 0, 0, 0, 22, 0, 0, 0, 29, 34, 0, - 22, 31, 0, 30, 0, 38, 0, 32, 33, 35, - 36, 37, 29, 34, 49, 3, 31, 0, 30, 0, - 38, 0, 32, 33, 35, 36, 37, 31, 0, 30, - 0, 38, 0, 32, 33, 35, 36, 37, 0, 0, - 0, 0, 0, 0, 130, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 85, 86, 87, 91, 0, 0, - 0, 161, 0, 0, 90, 88, 89, 93, 92, 94, - 95, 96, 97, 98, 99, 100, + 82, 5, 221, 2, 6, 8, 7, 18, 201, 78, + 65, 55, 54, 162, 86, 28, 188, 189, 255, 190, + 191, 192, 201, 190, 191, 192, 201, 13, 259, 258, + 127, 161, 249, 128, 131, 129, 248, 58, 75, 76, + 77, 78, 247, 147, 149, 150, 151, 152, 153, 154, + 155, 156, 157, 158, 159, 202, 203, 193, 194, 195, + 196, 197, 198, 200, 199, 73, 74, 28, 75, 76, + 77, 78, 188, 189, 168, 190, 191, 192, 201, 246, + 184, 186, 227, 228, 204, 205, 206, 62, 63, 64, + 65, 256, 66, 67, 68, 69, 70, 71, 254, 213, + 176, 178, 179, 180, 181, 182, 183, 73, 74, 165, + 75, 76, 77, 78, 60, 61, 220, 62, 63, 64, + 65, 169, 88, 161, 214, 215, 216, 217, 210, 17, + 135, 148, 126, 125, 218, 202, 203, 193, 194, 195, + 196, 197, 198, 200, 199, 19, 20, 21, 124, 17, + 218, 132, 188, 189, 123, 190, 191, 192, 201, 162, + 219, 122, 211, 212, 127, 80, 79, 128, 131, 129, + 223, 87, 225, 119, 120, 121, 253, 251, 57, 23, + 26, 24, 25, 27, 14, 133, 15, 166, 250, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 219, 209, 22, 208, 207, + 16, 72, 4, 202, 203, 193, 194, 195, 196, 197, + 198, 200, 199, 59, 55, 12, 55, 225, 10, 257, + 188, 189, 185, 190, 191, 192, 201, 164, 56, 11, + 130, 73, 74, 1, 75, 76, 77, 78, 0, 0, + 58, 0, 58, 89, 90, 91, 95, 115, 0, 81, + 83, 0, 0, 94, 92, 93, 97, 96, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 111, 110, 112, 113, 114, 118, 116, 117, 0, 0, + 0, 60, 61, 0, 62, 63, 64, 65, 167, 170, + 171, 172, 173, 174, 175, 0, 252, 0, 89, 90, + 91, 95, 115, 0, 0, 83, 84, 85, 94, 92, + 93, 97, 96, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 111, 110, 112, 113, 114, + 118, 116, 117, 202, 203, 193, 194, 195, 196, 197, + 198, 200, 199, 245, 0, 0, 0, 0, 0, 0, + 188, 189, 0, 190, 191, 192, 201, 19, 20, 21, + 0, 84, 85, 177, 43, 0, 42, 226, 50, 0, + 44, 45, 47, 48, 49, 52, 51, 0, 0, 0, + 202, 203, 193, 194, 195, 196, 197, 198, 200, 199, + 187, 23, 26, 24, 25, 27, 0, 188, 189, 0, + 190, 191, 192, 201, 202, 203, 193, 194, 195, 196, + 197, 198, 200, 199, 0, 0, 0, 0, 0, 22, + 0, 188, 189, 0, 190, 191, 192, 201, 0, 202, + 203, 193, 194, 195, 196, 197, 198, 200, 199, 0, + 0, 0, 0, 0, 0, 0, 188, 189, 0, 190, + 191, 192, 201, 202, 203, 193, 194, 195, 196, 197, + 198, 200, 199, 166, 0, 0, 0, 0, 0, 0, + 188, 189, 0, 190, 191, 192, 201, 193, 194, 195, + 196, 197, 198, 200, 199, 0, 0, 0, 0, 0, + 0, 0, 188, 189, 0, 190, 191, 192, 201, 0, + 0, 0, 66, 67, 68, 69, 70, 71, 0, 66, + 67, 68, 69, 70, 71, 0, 0, 73, 74, 0, + 75, 76, 77, 78, 60, 61, 0, 62, 63, 64, + 65, 19, 20, 21, 0, 17, 0, 224, 0, 19, + 20, 21, 0, 17, 0, 222, 0, 19, 20, 21, + 31, 17, 30, 9, 40, 0, 32, 33, 35, 36, + 37, 38, 39, 0, 0, 23, 26, 24, 25, 27, + 14, 0, 15, 23, 26, 24, 25, 27, 14, 163, + 15, 23, 26, 24, 25, 27, 14, 0, 15, 0, + 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, + 0, 22, 19, 20, 21, 160, 17, 0, 132, 22, + 0, 0, 0, 0, 0, 0, 41, 46, 0, 0, + 43, 0, 42, 0, 50, 0, 44, 45, 47, 48, + 49, 52, 51, 0, 0, 0, 23, 26, 24, 25, + 27, 0, 29, 34, 0, 0, 31, 0, 30, 0, + 40, 0, 32, 33, 35, 36, 37, 38, 39, 41, + 46, 0, 0, 43, 22, 42, 0, 50, 0, 44, + 45, 47, 48, 49, 52, 51, 29, 34, 53, 3, + 31, 0, 30, 0, 40, 0, 32, 33, 35, 36, + 37, 38, 39, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 134, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 89, 90, 91, 95, 0, 0, 0, 169, 0, 0, + 94, 92, 93, 97, 96, 98, 99, 100, 101, 102, + 103, 104, } var yyPact = [...]int{ - 555, -1000, -23, 632, -1000, 313, -1000, -1000, -1000, 555, - -1000, 476, -1000, 456, 130, 129, -1000, 241, -1000, -1000, - -1000, -1000, 160, 117, 116, 115, 113, 103, 164, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 114, - 114, 114, 114, 114, 114, 114, 114, 114, 114, 617, - 26, 564, 48, 72, 449, 719, 99, 99, 99, 99, - 99, 99, -1000, -1000, -1000, -1000, -1000, -1000, 604, 604, - 604, 604, 604, 604, 604, 294, 294, -1000, 402, 294, - 294, 294, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, + 551, -1000, -34, 636, -1000, 619, -1000, -1000, -1000, 551, + -1000, 467, -1000, 40, 154, 153, -1000, 248, -1000, -1000, + -1000, -1000, 167, 149, 142, 136, 121, 120, 139, 118, + 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, + 118, 119, 119, 119, 119, 119, 119, 119, 119, 119, + 119, 119, 119, 602, 110, 576, 224, 96, 460, 725, + 109, 109, 109, 109, 109, 109, -1000, -1000, -1000, -1000, + -1000, -1000, 361, 361, 361, 361, 361, 361, 361, 303, + 303, -1000, 389, 303, 303, 303, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, - -1000, 154, 151, 150, 139, -1000, -1000, -1000, 66, 294, - 294, 294, 294, 313, -1000, -1000, -1000, -1000, 597, 94, - 643, 542, -1000, -1000, -1000, -1000, 643, -1000, -1000, -1000, - -1000, 595, 114, -1000, -1000, -1000, -1000, 595, -1000, -1000, - -1000, -1000, -1000, -1000, 164, -1000, -1000, -1000, -1000, 216, - -1000, 528, 22, 22, -61, -61, -61, -61, 39, 604, - -6, -6, -62, -62, -62, -62, 378, 82, 424, -1000, - 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, - 294, 294, 294, 294, 294, 294, 353, -46, -46, 30, - -8, -11, -12, 144, 141, -1000, 331, 284, 81, 1, - 564, 18, 61, 19, 542, -1000, 528, -36, -1000, -1000, - 294, -46, -46, -63, -63, -63, -50, -50, -50, -50, - -50, -50, -50, -50, -63, 170, 170, -1000, -1000, -1000, - -1000, -1000, -19, -21, -1000, -1000, -1000, -1000, -1000, 424, - -1000, -1000, + -1000, -1000, -1000, -1000, -1000, 205, 204, 202, 124, -1000, + -1000, -1000, 86, 303, 303, 303, 303, 619, -1000, -1000, + -1000, -1000, 606, 104, 506, 543, -1000, -1000, -1000, -1000, + 506, -1000, -1000, -1000, -1000, -1000, -1000, 320, 119, -1000, + -1000, -1000, -1000, 320, -1000, -1000, -1000, -1000, -1000, -1000, + -1000, -1000, 139, -1000, -1000, -1000, -1000, 47, -1000, 535, + 17, 17, -63, -63, -63, -63, -2, 361, -32, -32, + -64, -64, -64, -64, 364, 69, 413, -1000, 303, 303, + 303, 303, 303, 303, 303, 303, 303, 303, 303, 303, + 303, 303, 303, 303, 340, -47, -47, 31, -6, -12, + -16, 184, 173, -1000, 293, 163, 85, 5, 576, 174, + 78, 18, 543, -1000, 535, -36, -1000, -1000, 303, -47, + -47, -65, -65, -65, -51, -51, -51, -51, -51, -51, + -51, -51, -65, 435, 435, -1000, -1000, -1000, -1000, -1000, + -19, -20, -1000, -1000, -1000, -1000, -1000, 413, -1000, -1000, } var yyPgo = [...]int{ - 0, 201, 6, 200, 5, 199, 1, 684, 197, 2, - 180, 4, 153, 179, 232, 28, 175, 173, 7, 0, - 17, 169, 163, + 0, 243, 6, 240, 5, 232, 1, 688, 228, 2, + 225, 4, 211, 212, 238, 27, 210, 178, 7, 0, + 14, 171, 122, } var yyR1 = [...]int{ 0, 1, 1, 1, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 8, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 2, 3, 4, 5, - 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 10, 10, 11, 12, 12, 12, 12, - 12, 12, 13, 13, 14, 14, 14, 14, 14, 14, - 14, 14, 16, 17, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 18, 18, - 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, + 7, 7, 7, 7, 7, 7, 7, 7, 8, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 2, 3, + 4, 5, 5, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 10, 10, 11, + 12, 12, 12, 12, 12, 12, 13, 13, 14, 14, + 14, 14, 14, 14, 14, 14, 16, 17, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 22, 22, 22, 22, 22, 22, + 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, + 22, } var yyR2 = [...]int{ 0, 1, 1, 1, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 1, 3, 1, 1, 1, - 1, 3, 3, 3, 3, 3, 4, 3, 4, 1, + 3, 3, 3, 3, 3, 3, 3, 1, 3, 1, + 1, 1, 1, 3, 3, 3, 3, 3, 4, 3, + 4, 1, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 1, 2, 3, 3, + 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 1, 1, 1, 1, 2, + 2, 2, 3, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 1, 2, 3, 3, 1, 1, 1, 1, - 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 1, 1, 1, 1, 2, 2, 2, 3, 4, - 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 3, 3, 3, 3, 4, 4, + 1, 1, 1, 1, 1, 3, 3, 3, 3, 4, + 4, } var yyChk = [...]int{ -1000, -1, -9, -7, -13, -6, -11, -2, -4, 12, -8, -14, -10, -15, 45, 47, -16, 10, -18, 6, - 7, 8, 66, 40, 42, 43, 41, 44, 49, 50, - 56, 54, 60, 61, 51, 62, 63, 64, 58, 50, - 56, 54, 60, 61, 51, 62, 63, 64, 58, -7, - -9, -6, -14, -17, -15, -12, 65, 66, 68, 69, - 70, 71, 52, 53, 54, 55, 56, 57, -12, 65, - 66, 68, 69, 70, 71, 12, 12, 11, -19, 12, - 66, 67, -20, -21, -22, 5, 6, 7, 16, 17, - 15, 8, 19, 18, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 33, 32, 34, 35, - 36, 9, 38, 39, 37, 6, 7, 8, 12, 12, - 12, 12, 12, -6, -11, -2, -3, -4, 12, 46, - -7, 12, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -6, 12, -6, -6, -6, -6, -6, -6, -6, - -6, -6, 13, 13, 49, 13, 13, 13, 13, -14, - -20, 12, -14, -14, -14, -14, -14, -14, -15, 12, - -15, -15, -15, -15, -15, -15, -19, -5, -19, 11, - 65, 66, 68, 69, 70, 52, 53, 54, 55, 56, - 57, 59, 58, 71, 50, 51, -19, -19, -19, 4, - 4, 4, 4, 38, 39, 13, -19, -19, -19, -19, - -6, -15, 12, -9, 12, -18, 12, -9, 13, 13, - 14, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, 13, 48, 48, - 48, 48, 4, 4, 13, 13, 13, 13, 13, -19, - 48, 48, + 7, 8, 68, 40, 42, 43, 41, 44, 49, 50, + 56, 54, 60, 61, 51, 62, 63, 64, 65, 66, + 58, 50, 56, 54, 60, 61, 51, 62, 63, 64, + 58, 66, 65, -7, -9, -6, -14, -17, -15, -12, + 67, 68, 70, 71, 72, 73, 52, 53, 54, 55, + 56, 57, -12, 67, 68, 70, 71, 72, 73, 12, + 12, 11, -19, 12, 68, 69, -20, -21, -22, 5, + 6, 7, 16, 17, 15, 8, 19, 18, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 33, 32, 34, 35, 36, 9, 38, 39, 37, 6, + 7, 8, 12, 12, 12, 12, 12, -6, -11, -2, + -3, -4, 12, 46, -7, 12, -7, -7, -7, -7, + -7, -7, -7, -7, -7, -7, -7, -6, 12, -6, + -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, + 13, 13, 49, 13, 13, 13, 13, -14, -20, 12, + -14, -14, -14, -14, -14, -14, -15, 12, -15, -15, + -15, -15, -15, -15, -19, -5, -19, 11, 67, 68, + 70, 71, 72, 52, 53, 54, 55, 56, 57, 59, + 58, 73, 50, 51, -19, -19, -19, 4, 4, 4, + 4, 38, 39, 13, -19, -19, -19, -19, -6, -15, + 12, -9, 12, -18, 12, -9, 13, 13, 14, -19, + -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, + -19, -19, -19, -19, -19, 13, 48, 48, 48, 48, + 4, 4, 13, 13, 13, 13, 13, -19, 48, 48, } var yyDef = [...]int{ - 0, -2, 1, 2, 3, 17, 18, 19, 20, 0, - 15, 0, 42, 0, 0, 0, 61, 0, 71, 72, - 73, 74, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -2, 1, 2, 3, 19, 20, 21, 22, 0, + 17, 0, 46, 0, 0, 0, 65, 0, 75, 76, + 77, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 46, 47, 48, 49, 50, 51, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 43, 0, 0, - 0, 0, 102, 103, 104, 105, 106, 107, 108, 109, + 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 50, 51, 52, 53, + 54, 55, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 47, 0, 0, 0, 0, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 0, 0, 0, 0, 75, 76, 77, 0, 0, - 0, 0, 0, 21, 22, 23, 24, 25, 0, 0, - 5, 0, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 32, 0, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 4, 16, 0, 31, 54, 62, 64, 52, - 53, 0, 55, 56, 57, 58, 59, 60, 45, 0, - 65, 66, 67, 68, 69, 70, 0, 0, 29, 44, + 130, 131, 132, 133, 134, 0, 0, 0, 0, 79, + 80, 81, 0, 0, 0, 0, 0, 23, 24, 25, + 26, 27, 0, 0, 5, 0, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 34, 0, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 4, 18, 0, 33, 58, 66, 68, 56, 57, 0, + 59, 60, 61, 62, 63, 64, 49, 0, 69, 70, + 71, 72, 73, 74, 0, 0, 31, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 100, 101, 0, - 0, 0, 0, 0, 0, 78, 0, 0, 0, 0, - 0, 0, 0, 0, 0, -2, 0, 0, 26, 28, - 0, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 83, 131, 132, - 133, 134, 0, 0, 79, 80, 81, 82, 27, 30, - 135, 136, + 0, 0, 0, 0, 0, 104, 105, 0, 0, 0, + 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -2, 0, 0, 28, 30, 0, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 87, 135, 136, 137, 138, + 0, 0, 83, 84, 85, 86, 29, 32, 139, 140, } var yyTok1 = [...]int{ @@ -427,6 +434,7 @@ var yyTok2 = [...]int{ 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, } var yyTok3 = [...]int{ 0, @@ -851,737 +859,761 @@ yydefault: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:117 { - yyVAL.spansetPipelineExpression = newSpansetOperation(OpSpansetNotSibling, yyDollar[1].spansetPipelineExpression, yyDollar[3].spansetPipelineExpression) + yyVAL.spansetPipelineExpression = newSpansetOperation(OpSpansetNotDescendant, yyDollar[1].spansetPipelineExpression, yyDollar[3].spansetPipelineExpression) } case 15: - yyDollar = yyS[yypt-1 : yypt+1] + yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:118 { - yyVAL.spansetPipelineExpression = yyDollar[1].wrappedSpansetPipeline + yyVAL.spansetPipelineExpression = newSpansetOperation(OpSpansetNotAncestor, yyDollar[1].spansetPipelineExpression, yyDollar[3].spansetPipelineExpression) } case 16: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:122 +//line pkg/traceql/expr.y:119 { - yyVAL.wrappedSpansetPipeline = yyDollar[2].spansetPipeline + yyVAL.spansetPipelineExpression = newSpansetOperation(OpSpansetNotSibling, yyDollar[1].spansetPipelineExpression, yyDollar[3].spansetPipelineExpression) } case 17: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:125 +//line pkg/traceql/expr.y:120 { - yyVAL.spansetPipeline = newPipeline(yyDollar[1].spansetExpression) + yyVAL.spansetPipelineExpression = yyDollar[1].wrappedSpansetPipeline } case 18: - yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:126 + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:124 { - yyVAL.spansetPipeline = newPipeline(yyDollar[1].scalarFilter) + yyVAL.wrappedSpansetPipeline = yyDollar[2].spansetPipeline } case 19: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:127 { - yyVAL.spansetPipeline = newPipeline(yyDollar[1].groupOperation) + yyVAL.spansetPipeline = newPipeline(yyDollar[1].spansetExpression) } case 20: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:128 { - yyVAL.spansetPipeline = newPipeline(yyDollar[1].selectOperation) + yyVAL.spansetPipeline = newPipeline(yyDollar[1].scalarFilter) } case 21: - yyDollar = yyS[yypt-3 : yypt+1] + yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:129 { - yyVAL.spansetPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].spansetExpression) + yyVAL.spansetPipeline = newPipeline(yyDollar[1].groupOperation) } case 22: - yyDollar = yyS[yypt-3 : yypt+1] + yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:130 { - yyVAL.spansetPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].scalarFilter) + yyVAL.spansetPipeline = newPipeline(yyDollar[1].selectOperation) } case 23: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:131 { - yyVAL.spansetPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].groupOperation) + yyVAL.spansetPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].spansetExpression) } case 24: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:132 { - yyVAL.spansetPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].coalesceOperation) + yyVAL.spansetPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].scalarFilter) } case 25: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:133 { - yyVAL.spansetPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].selectOperation) + yyVAL.spansetPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].groupOperation) } case 26: - yyDollar = yyS[yypt-4 : yypt+1] -//line pkg/traceql/expr.y:137 + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:134 { - yyVAL.groupOperation = newGroupOperation(yyDollar[3].fieldExpression) + yyVAL.spansetPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].coalesceOperation) } case 27: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:141 +//line pkg/traceql/expr.y:135 { - yyVAL.coalesceOperation = newCoalesceOperation() + yyVAL.spansetPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].selectOperation) } case 28: yyDollar = yyS[yypt-4 : yypt+1] -//line pkg/traceql/expr.y:145 +//line pkg/traceql/expr.y:139 { - yyVAL.selectOperation = newSelectOperation(yyDollar[3].selectArgs) + yyVAL.groupOperation = newGroupOperation(yyDollar[3].fieldExpression) } case 29: - yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:149 + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:143 { - yyVAL.selectArgs = []FieldExpression{yyDollar[1].fieldExpression} + yyVAL.coalesceOperation = newCoalesceOperation() } case 30: - yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:150 + yyDollar = yyS[yypt-4 : yypt+1] +//line pkg/traceql/expr.y:147 { - yyVAL.selectArgs = append(yyDollar[1].selectArgs, yyDollar[3].fieldExpression) + yyVAL.selectOperation = newSelectOperation(yyDollar[3].selectArgs) } case 31: - yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:154 + yyDollar = yyS[yypt-1 : yypt+1] +//line pkg/traceql/expr.y:151 { - yyVAL.spansetExpression = yyDollar[2].spansetExpression + yyVAL.selectArgs = []FieldExpression{yyDollar[1].fieldExpression} } case 32: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:155 +//line pkg/traceql/expr.y:152 { - yyVAL.spansetExpression = newSpansetOperation(OpSpansetAnd, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + yyVAL.selectArgs = append(yyDollar[1].selectArgs, yyDollar[3].fieldExpression) } case 33: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:156 { - yyVAL.spansetExpression = newSpansetOperation(OpSpansetChild, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + yyVAL.spansetExpression = yyDollar[2].spansetExpression } case 34: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:157 { - yyVAL.spansetExpression = newSpansetOperation(OpSpansetParent, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + yyVAL.spansetExpression = newSpansetOperation(OpSpansetAnd, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } case 35: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:158 { - yyVAL.spansetExpression = newSpansetOperation(OpSpansetDescendant, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + yyVAL.spansetExpression = newSpansetOperation(OpSpansetChild, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } case 36: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:159 { - yyVAL.spansetExpression = newSpansetOperation(OpSpansetAncestor, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + yyVAL.spansetExpression = newSpansetOperation(OpSpansetParent, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } case 37: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:160 { - yyVAL.spansetExpression = newSpansetOperation(OpSpansetUnion, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + yyVAL.spansetExpression = newSpansetOperation(OpSpansetDescendant, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } case 38: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:161 { - yyVAL.spansetExpression = newSpansetOperation(OpSpansetSibling, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + yyVAL.spansetExpression = newSpansetOperation(OpSpansetAncestor, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } case 39: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:163 +//line pkg/traceql/expr.y:162 { - yyVAL.spansetExpression = newSpansetOperation(OpSpansetNotChild, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + yyVAL.spansetExpression = newSpansetOperation(OpSpansetUnion, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } case 40: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:164 +//line pkg/traceql/expr.y:163 { - yyVAL.spansetExpression = newSpansetOperation(OpSpansetNotParent, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + yyVAL.spansetExpression = newSpansetOperation(OpSpansetSibling, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } case 41: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:165 { - yyVAL.spansetExpression = newSpansetOperation(OpSpansetNotSibling, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) + yyVAL.spansetExpression = newSpansetOperation(OpSpansetNotChild, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } case 42: - yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:167 + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:166 { - yyVAL.spansetExpression = yyDollar[1].spansetFilter + yyVAL.spansetExpression = newSpansetOperation(OpSpansetNotParent, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } case 43: - yyDollar = yyS[yypt-2 : yypt+1] -//line pkg/traceql/expr.y:171 + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:167 { - yyVAL.spansetFilter = newSpansetFilter(NewStaticBool(true)) + yyVAL.spansetExpression = newSpansetOperation(OpSpansetNotSibling, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } case 44: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:172 +//line pkg/traceql/expr.y:168 { - yyVAL.spansetFilter = newSpansetFilter(yyDollar[2].fieldExpression) + yyVAL.spansetExpression = newSpansetOperation(OpSpansetNotAncestor, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } case 45: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:176 +//line pkg/traceql/expr.y:169 { - yyVAL.scalarFilter = newScalarFilter(yyDollar[2].scalarFilterOperation, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) + yyVAL.spansetExpression = newSpansetOperation(OpSpansetNotDescendant, yyDollar[1].spansetExpression, yyDollar[3].spansetExpression) } case 46: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:180 +//line pkg/traceql/expr.y:171 { - yyVAL.scalarFilterOperation = OpEqual + yyVAL.spansetExpression = yyDollar[1].spansetFilter } case 47: - yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:181 + yyDollar = yyS[yypt-2 : yypt+1] +//line pkg/traceql/expr.y:175 { - yyVAL.scalarFilterOperation = OpNotEqual + yyVAL.spansetFilter = newSpansetFilter(NewStaticBool(true)) } case 48: - yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:182 + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:176 { - yyVAL.scalarFilterOperation = OpLess + yyVAL.spansetFilter = newSpansetFilter(yyDollar[2].fieldExpression) } case 49: - yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:183 + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:180 { - yyVAL.scalarFilterOperation = OpLessEqual + yyVAL.scalarFilter = newScalarFilter(yyDollar[2].scalarFilterOperation, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) } case 50: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:184 { - yyVAL.scalarFilterOperation = OpGreater + yyVAL.scalarFilterOperation = OpEqual } case 51: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:185 { - yyVAL.scalarFilterOperation = OpGreaterEqual + yyVAL.scalarFilterOperation = OpNotEqual } case 52: - yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:192 + yyDollar = yyS[yypt-1 : yypt+1] +//line pkg/traceql/expr.y:186 { - yyVAL.scalarPipelineExpressionFilter = newScalarFilter(yyDollar[2].scalarFilterOperation, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) + yyVAL.scalarFilterOperation = OpLess } case 53: - yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:193 + yyDollar = yyS[yypt-1 : yypt+1] +//line pkg/traceql/expr.y:187 { - yyVAL.scalarPipelineExpressionFilter = newScalarFilter(yyDollar[2].scalarFilterOperation, yyDollar[1].scalarPipelineExpression, yyDollar[3].static) + yyVAL.scalarFilterOperation = OpLessEqual } case 54: - yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:197 + yyDollar = yyS[yypt-1 : yypt+1] +//line pkg/traceql/expr.y:188 { - yyVAL.scalarPipelineExpression = yyDollar[2].scalarPipelineExpression + yyVAL.scalarFilterOperation = OpGreater } case 55: - yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:198 + yyDollar = yyS[yypt-1 : yypt+1] +//line pkg/traceql/expr.y:189 { - yyVAL.scalarPipelineExpression = newScalarOperation(OpAdd, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) + yyVAL.scalarFilterOperation = OpGreaterEqual } case 56: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:199 +//line pkg/traceql/expr.y:196 { - yyVAL.scalarPipelineExpression = newScalarOperation(OpSub, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) + yyVAL.scalarPipelineExpressionFilter = newScalarFilter(yyDollar[2].scalarFilterOperation, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) } case 57: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:200 +//line pkg/traceql/expr.y:197 { - yyVAL.scalarPipelineExpression = newScalarOperation(OpMult, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) + yyVAL.scalarPipelineExpressionFilter = newScalarFilter(yyDollar[2].scalarFilterOperation, yyDollar[1].scalarPipelineExpression, yyDollar[3].static) } case 58: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:201 { - yyVAL.scalarPipelineExpression = newScalarOperation(OpDiv, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) + yyVAL.scalarPipelineExpression = yyDollar[2].scalarPipelineExpression } case 59: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:202 { - yyVAL.scalarPipelineExpression = newScalarOperation(OpMod, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) + yyVAL.scalarPipelineExpression = newScalarOperation(OpAdd, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) } case 60: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:203 { - yyVAL.scalarPipelineExpression = newScalarOperation(OpPower, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) + yyVAL.scalarPipelineExpression = newScalarOperation(OpSub, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) } case 61: - yyDollar = yyS[yypt-1 : yypt+1] + yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:204 { - yyVAL.scalarPipelineExpression = yyDollar[1].wrappedScalarPipeline + yyVAL.scalarPipelineExpression = newScalarOperation(OpMult, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) } case 62: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:208 +//line pkg/traceql/expr.y:205 { - yyVAL.wrappedScalarPipeline = yyDollar[2].scalarPipeline + yyVAL.scalarPipelineExpression = newScalarOperation(OpDiv, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) } case 63: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:212 +//line pkg/traceql/expr.y:206 { - yyVAL.scalarPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].aggregate) + yyVAL.scalarPipelineExpression = newScalarOperation(OpMod, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) } case 64: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:216 +//line pkg/traceql/expr.y:207 { - yyVAL.scalarExpression = yyDollar[2].scalarExpression + yyVAL.scalarPipelineExpression = newScalarOperation(OpPower, yyDollar[1].scalarPipelineExpression, yyDollar[3].scalarPipelineExpression) } case 65: - yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:217 + yyDollar = yyS[yypt-1 : yypt+1] +//line pkg/traceql/expr.y:208 { - yyVAL.scalarExpression = newScalarOperation(OpAdd, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) + yyVAL.scalarPipelineExpression = yyDollar[1].wrappedScalarPipeline } case 66: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:218 +//line pkg/traceql/expr.y:212 { - yyVAL.scalarExpression = newScalarOperation(OpSub, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) + yyVAL.wrappedScalarPipeline = yyDollar[2].scalarPipeline } case 67: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:219 +//line pkg/traceql/expr.y:216 { - yyVAL.scalarExpression = newScalarOperation(OpMult, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) + yyVAL.scalarPipeline = yyDollar[1].spansetPipeline.addItem(yyDollar[3].aggregate) } case 68: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:220 { - yyVAL.scalarExpression = newScalarOperation(OpDiv, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) + yyVAL.scalarExpression = yyDollar[2].scalarExpression } case 69: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:221 { - yyVAL.scalarExpression = newScalarOperation(OpMod, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) + yyVAL.scalarExpression = newScalarOperation(OpAdd, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) } case 70: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:222 { - yyVAL.scalarExpression = newScalarOperation(OpPower, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) + yyVAL.scalarExpression = newScalarOperation(OpSub, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) } case 71: - yyDollar = yyS[yypt-1 : yypt+1] + yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:223 { - yyVAL.scalarExpression = yyDollar[1].aggregate + yyVAL.scalarExpression = newScalarOperation(OpMult, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) } case 72: - yyDollar = yyS[yypt-1 : yypt+1] + yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:224 { - yyVAL.scalarExpression = NewStaticInt(yyDollar[1].staticInt) + yyVAL.scalarExpression = newScalarOperation(OpDiv, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) } case 73: - yyDollar = yyS[yypt-1 : yypt+1] + yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:225 { - yyVAL.scalarExpression = NewStaticFloat(yyDollar[1].staticFloat) + yyVAL.scalarExpression = newScalarOperation(OpMod, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) } case 74: - yyDollar = yyS[yypt-1 : yypt+1] + yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:226 { - yyVAL.scalarExpression = NewStaticDuration(yyDollar[1].staticDuration) + yyVAL.scalarExpression = newScalarOperation(OpPower, yyDollar[1].scalarExpression, yyDollar[3].scalarExpression) } case 75: - yyDollar = yyS[yypt-2 : yypt+1] + yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:227 { - yyVAL.scalarExpression = NewStaticInt(-yyDollar[2].staticInt) + yyVAL.scalarExpression = yyDollar[1].aggregate } case 76: - yyDollar = yyS[yypt-2 : yypt+1] + yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:228 { - yyVAL.scalarExpression = NewStaticFloat(-yyDollar[2].staticFloat) + yyVAL.scalarExpression = NewStaticInt(yyDollar[1].staticInt) } case 77: - yyDollar = yyS[yypt-2 : yypt+1] + yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:229 { - yyVAL.scalarExpression = NewStaticDuration(-yyDollar[2].staticDuration) + yyVAL.scalarExpression = NewStaticFloat(yyDollar[1].staticFloat) } case 78: - yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:233 + yyDollar = yyS[yypt-1 : yypt+1] +//line pkg/traceql/expr.y:230 { - yyVAL.aggregate = newAggregate(aggregateCount, nil) + yyVAL.scalarExpression = NewStaticDuration(yyDollar[1].staticDuration) } case 79: - yyDollar = yyS[yypt-4 : yypt+1] -//line pkg/traceql/expr.y:234 + yyDollar = yyS[yypt-2 : yypt+1] +//line pkg/traceql/expr.y:231 { - yyVAL.aggregate = newAggregate(aggregateMax, yyDollar[3].fieldExpression) + yyVAL.scalarExpression = NewStaticInt(-yyDollar[2].staticInt) } case 80: - yyDollar = yyS[yypt-4 : yypt+1] -//line pkg/traceql/expr.y:235 + yyDollar = yyS[yypt-2 : yypt+1] +//line pkg/traceql/expr.y:232 { - yyVAL.aggregate = newAggregate(aggregateMin, yyDollar[3].fieldExpression) + yyVAL.scalarExpression = NewStaticFloat(-yyDollar[2].staticFloat) } case 81: - yyDollar = yyS[yypt-4 : yypt+1] -//line pkg/traceql/expr.y:236 + yyDollar = yyS[yypt-2 : yypt+1] +//line pkg/traceql/expr.y:233 { - yyVAL.aggregate = newAggregate(aggregateAvg, yyDollar[3].fieldExpression) + yyVAL.scalarExpression = NewStaticDuration(-yyDollar[2].staticDuration) } case 82: - yyDollar = yyS[yypt-4 : yypt+1] + yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:237 { - yyVAL.aggregate = newAggregate(aggregateSum, yyDollar[3].fieldExpression) + yyVAL.aggregate = newAggregate(aggregateCount, nil) } case 83: - yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:244 + yyDollar = yyS[yypt-4 : yypt+1] +//line pkg/traceql/expr.y:238 { - yyVAL.fieldExpression = yyDollar[2].fieldExpression + yyVAL.aggregate = newAggregate(aggregateMax, yyDollar[3].fieldExpression) } case 84: - yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:245 + yyDollar = yyS[yypt-4 : yypt+1] +//line pkg/traceql/expr.y:239 { - yyVAL.fieldExpression = newBinaryOperation(OpAdd, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.aggregate = newAggregate(aggregateMin, yyDollar[3].fieldExpression) } case 85: - yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:246 + yyDollar = yyS[yypt-4 : yypt+1] +//line pkg/traceql/expr.y:240 { - yyVAL.fieldExpression = newBinaryOperation(OpSub, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.aggregate = newAggregate(aggregateAvg, yyDollar[3].fieldExpression) } case 86: - yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:247 + yyDollar = yyS[yypt-4 : yypt+1] +//line pkg/traceql/expr.y:241 { - yyVAL.fieldExpression = newBinaryOperation(OpMult, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.aggregate = newAggregate(aggregateSum, yyDollar[3].fieldExpression) } case 87: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:248 { - yyVAL.fieldExpression = newBinaryOperation(OpDiv, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = yyDollar[2].fieldExpression } case 88: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:249 { - yyVAL.fieldExpression = newBinaryOperation(OpMod, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpAdd, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 89: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:250 { - yyVAL.fieldExpression = newBinaryOperation(OpEqual, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpSub, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 90: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:251 { - yyVAL.fieldExpression = newBinaryOperation(OpNotEqual, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpMult, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 91: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:252 { - yyVAL.fieldExpression = newBinaryOperation(OpLess, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpDiv, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 92: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:253 { - yyVAL.fieldExpression = newBinaryOperation(OpLessEqual, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpMod, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 93: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:254 { - yyVAL.fieldExpression = newBinaryOperation(OpGreater, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpEqual, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 94: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:255 { - yyVAL.fieldExpression = newBinaryOperation(OpGreaterEqual, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpNotEqual, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 95: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:256 { - yyVAL.fieldExpression = newBinaryOperation(OpRegex, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpLess, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 96: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:257 { - yyVAL.fieldExpression = newBinaryOperation(OpNotRegex, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpLessEqual, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 97: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:258 { - yyVAL.fieldExpression = newBinaryOperation(OpPower, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpGreater, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 98: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:259 { - yyVAL.fieldExpression = newBinaryOperation(OpAnd, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpGreaterEqual, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 99: yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:260 { - yyVAL.fieldExpression = newBinaryOperation(OpOr, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpRegex, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 100: - yyDollar = yyS[yypt-2 : yypt+1] + yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:261 { - yyVAL.fieldExpression = newUnaryOperation(OpSub, yyDollar[2].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpNotRegex, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 101: - yyDollar = yyS[yypt-2 : yypt+1] + yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:262 { - yyVAL.fieldExpression = newUnaryOperation(OpNot, yyDollar[2].fieldExpression) + yyVAL.fieldExpression = newBinaryOperation(OpPower, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 102: - yyDollar = yyS[yypt-1 : yypt+1] + yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:263 { - yyVAL.fieldExpression = yyDollar[1].static + yyVAL.fieldExpression = newBinaryOperation(OpAnd, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 103: - yyDollar = yyS[yypt-1 : yypt+1] + yyDollar = yyS[yypt-3 : yypt+1] //line pkg/traceql/expr.y:264 { - yyVAL.fieldExpression = yyDollar[1].intrinsicField + yyVAL.fieldExpression = newBinaryOperation(OpOr, yyDollar[1].fieldExpression, yyDollar[3].fieldExpression) } case 104: - yyDollar = yyS[yypt-1 : yypt+1] + yyDollar = yyS[yypt-2 : yypt+1] //line pkg/traceql/expr.y:265 { - yyVAL.fieldExpression = yyDollar[1].attributeField + yyVAL.fieldExpression = newUnaryOperation(OpSub, yyDollar[2].fieldExpression) } case 105: - yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:272 + yyDollar = yyS[yypt-2 : yypt+1] +//line pkg/traceql/expr.y:266 { - yyVAL.static = NewStaticString(yyDollar[1].staticStr) + yyVAL.fieldExpression = newUnaryOperation(OpNot, yyDollar[2].fieldExpression) } case 106: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:273 +//line pkg/traceql/expr.y:267 { - yyVAL.static = NewStaticInt(yyDollar[1].staticInt) + yyVAL.fieldExpression = yyDollar[1].static } case 107: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:274 +//line pkg/traceql/expr.y:268 { - yyVAL.static = NewStaticFloat(yyDollar[1].staticFloat) + yyVAL.fieldExpression = yyDollar[1].intrinsicField } case 108: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:275 +//line pkg/traceql/expr.y:269 { - yyVAL.static = NewStaticBool(true) + yyVAL.fieldExpression = yyDollar[1].attributeField } case 109: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:276 { - yyVAL.static = NewStaticBool(false) + yyVAL.static = NewStaticString(yyDollar[1].staticStr) } case 110: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:277 { - yyVAL.static = NewStaticNil() + yyVAL.static = NewStaticInt(yyDollar[1].staticInt) } case 111: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:278 { - yyVAL.static = NewStaticDuration(yyDollar[1].staticDuration) + yyVAL.static = NewStaticFloat(yyDollar[1].staticFloat) } case 112: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:279 { - yyVAL.static = NewStaticStatus(StatusOk) + yyVAL.static = NewStaticBool(true) } case 113: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:280 { - yyVAL.static = NewStaticStatus(StatusError) + yyVAL.static = NewStaticBool(false) } case 114: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:281 { - yyVAL.static = NewStaticStatus(StatusUnset) + yyVAL.static = NewStaticNil() } case 115: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:282 { - yyVAL.static = NewStaticKind(KindUnspecified) + yyVAL.static = NewStaticDuration(yyDollar[1].staticDuration) } case 116: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:283 { - yyVAL.static = NewStaticKind(KindInternal) + yyVAL.static = NewStaticStatus(StatusOk) } case 117: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:284 { - yyVAL.static = NewStaticKind(KindServer) + yyVAL.static = NewStaticStatus(StatusError) } case 118: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:285 { - yyVAL.static = NewStaticKind(KindClient) + yyVAL.static = NewStaticStatus(StatusUnset) } case 119: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:286 { - yyVAL.static = NewStaticKind(KindProducer) + yyVAL.static = NewStaticKind(KindUnspecified) } case 120: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:287 { - yyVAL.static = NewStaticKind(KindConsumer) + yyVAL.static = NewStaticKind(KindInternal) } case 121: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:291 +//line pkg/traceql/expr.y:288 { - yyVAL.intrinsicField = NewIntrinsic(IntrinsicDuration) + yyVAL.static = NewStaticKind(KindServer) } case 122: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:292 +//line pkg/traceql/expr.y:289 { - yyVAL.intrinsicField = NewIntrinsic(IntrinsicChildCount) + yyVAL.static = NewStaticKind(KindClient) } case 123: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:293 +//line pkg/traceql/expr.y:290 { - yyVAL.intrinsicField = NewIntrinsic(IntrinsicName) + yyVAL.static = NewStaticKind(KindProducer) } case 124: yyDollar = yyS[yypt-1 : yypt+1] -//line pkg/traceql/expr.y:294 +//line pkg/traceql/expr.y:291 { - yyVAL.intrinsicField = NewIntrinsic(IntrinsicStatus) + yyVAL.static = NewStaticKind(KindConsumer) } case 125: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:295 { - yyVAL.intrinsicField = NewIntrinsic(IntrinsicStatusMessage) + yyVAL.intrinsicField = NewIntrinsic(IntrinsicDuration) } case 126: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:296 { - yyVAL.intrinsicField = NewIntrinsic(IntrinsicKind) + yyVAL.intrinsicField = NewIntrinsic(IntrinsicChildCount) } case 127: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:297 { - yyVAL.intrinsicField = NewIntrinsic(IntrinsicParent) + yyVAL.intrinsicField = NewIntrinsic(IntrinsicName) } case 128: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:298 { - yyVAL.intrinsicField = NewIntrinsic(IntrinsicTraceRootSpan) + yyVAL.intrinsicField = NewIntrinsic(IntrinsicStatus) } case 129: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:299 { - yyVAL.intrinsicField = NewIntrinsic(IntrinsicTraceRootService) + yyVAL.intrinsicField = NewIntrinsic(IntrinsicStatusMessage) } case 130: yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:300 { - yyVAL.intrinsicField = NewIntrinsic(IntrinsicTraceDuration) + yyVAL.intrinsicField = NewIntrinsic(IntrinsicKind) } case 131: - yyDollar = yyS[yypt-3 : yypt+1] + yyDollar = yyS[yypt-1 : yypt+1] +//line pkg/traceql/expr.y:301 + { + yyVAL.intrinsicField = NewIntrinsic(IntrinsicParent) + } + case 132: + yyDollar = yyS[yypt-1 : yypt+1] +//line pkg/traceql/expr.y:302 + { + yyVAL.intrinsicField = NewIntrinsic(IntrinsicTraceRootSpan) + } + case 133: + yyDollar = yyS[yypt-1 : yypt+1] +//line pkg/traceql/expr.y:303 + { + yyVAL.intrinsicField = NewIntrinsic(IntrinsicTraceRootService) + } + case 134: + yyDollar = yyS[yypt-1 : yypt+1] //line pkg/traceql/expr.y:304 + { + yyVAL.intrinsicField = NewIntrinsic(IntrinsicTraceDuration) + } + case 135: + yyDollar = yyS[yypt-3 : yypt+1] +//line pkg/traceql/expr.y:308 { yyVAL.attributeField = NewAttribute(yyDollar[2].staticStr) } - case 132: + case 136: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:305 +//line pkg/traceql/expr.y:309 { yyVAL.attributeField = NewScopedAttribute(AttributeScopeResource, false, yyDollar[2].staticStr) } - case 133: + case 137: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:306 +//line pkg/traceql/expr.y:310 { yyVAL.attributeField = NewScopedAttribute(AttributeScopeSpan, false, yyDollar[2].staticStr) } - case 134: + case 138: yyDollar = yyS[yypt-3 : yypt+1] -//line pkg/traceql/expr.y:307 +//line pkg/traceql/expr.y:311 { yyVAL.attributeField = NewScopedAttribute(AttributeScopeNone, true, yyDollar[2].staticStr) } - case 135: + case 139: yyDollar = yyS[yypt-4 : yypt+1] -//line pkg/traceql/expr.y:308 +//line pkg/traceql/expr.y:312 { yyVAL.attributeField = NewScopedAttribute(AttributeScopeResource, true, yyDollar[3].staticStr) } - case 136: + case 140: yyDollar = yyS[yypt-4 : yypt+1] -//line pkg/traceql/expr.y:309 +//line pkg/traceql/expr.y:313 { yyVAL.attributeField = NewScopedAttribute(AttributeScopeSpan, true, yyDollar[3].staticStr) } diff --git a/pkg/traceql/lexer.go b/pkg/traceql/lexer.go index 9a6908f962a..e61df5bd13d 100644 --- a/pkg/traceql/lexer.go +++ b/pkg/traceql/lexer.go @@ -52,6 +52,8 @@ var tokens = map[string]int{ "~": SIBL, "!>": NOT_CHILD, "!<": NOT_PARENT, + "!>>": NOT_DESC, + "!<<": NOT_ANCE, "duration": IDURATION, "childCount": CHILDCOUNT, "name": NAME, @@ -169,18 +171,34 @@ func (l *lexer) Lex(lval *yySymType) int { return FLOAT } - tokStrNext := l.TokenText() + string(l.Peek()) - if tok, ok := tokens[tokStrNext]; ok { - l.Next() - l.parsingAttribute = startsAttribute(tok) - return tok + // look for combination tokens starting with 2 and working up til there is no match + multiTok := -1 + tokStrNext := l.TokenText() + for { + tokStrNext = tokStrNext + string(l.Peek()) + tok, ok := tokens[tokStrNext] + if ok { + multiTok = tok + l.Next() + continue + } + + break + } + + // did we find a combination token? + if multiTok != -1 { + l.parsingAttribute = startsAttribute(multiTok) + return multiTok } + // no combination tokens, see if the current text is a known token if tok, ok := tokens[l.TokenText()]; ok { l.parsingAttribute = startsAttribute(tok) return tok } + // default to an identifier lval.staticStr = l.TokenText() return IDENTIFIER } diff --git a/pkg/traceql/lexer_test.go b/pkg/traceql/lexer_test.go index eefb09030dd..1ff75b3c289 100644 --- a/pkg/traceql/lexer_test.go +++ b/pkg/traceql/lexer_test.go @@ -66,6 +66,17 @@ func TestLexerAttributes(t *testing.T) { })) } +func TestLexerMultitokens(t *testing.T) { + testLexer(t, ([]lexerTestCase{ + // attributes + {`&&`, []int{AND}}, + {`>>`, []int{DESC}}, + {`!<<`, []int{NOT_ANCE}}, + {`!`, []int{NOT}}, + {`!~`, []int{NRE}}, + })) +} + func TestLexerDuration(t *testing.T) { testLexer(t, ([]lexerTestCase{ // duration diff --git a/pkg/traceql/parse_test.go b/pkg/traceql/parse_test.go index f9395248a73..dd5f60e01a3 100644 --- a/pkg/traceql/parse_test.go +++ b/pkg/traceql/parse_test.go @@ -224,6 +224,32 @@ func TestPipelineSpansetOperators(t *testing.T) { ), ), }, + { + in: "({ .a } | { .b }) !>> ({ .a } | { .b })", + expected: newSpansetOperation(OpSpansetNotDescendant, + newPipeline( + newSpansetFilter(NewAttribute("a")), + newSpansetFilter(NewAttribute("b")), + ), + newPipeline( + newSpansetFilter(NewAttribute("a")), + newSpansetFilter(NewAttribute("b")), + ), + ), + }, + { + in: "({ .a } | { .b }) !<< ({ .a } | { .b })", + expected: newSpansetOperation(OpSpansetNotAncestor, + newPipeline( + newSpansetFilter(NewAttribute("a")), + newSpansetFilter(NewAttribute("b")), + ), + newPipeline( + newSpansetFilter(NewAttribute("a")), + newSpansetFilter(NewAttribute("b")), + ), + ), + }, } for _, tc := range tests { @@ -516,6 +542,11 @@ func TestSpansetExpressionOperators(t *testing.T) { {in: "{ true } ~ { false }", expected: newSpansetOperation(OpSpansetSibling, newSpansetFilter(NewStaticBool(true)), newSpansetFilter(NewStaticBool(false)))}, // this test was added to highlight the one shift/reduce conflict in the grammar. this could also be parsed as two spanset pipelines &&ed together. {in: "({ true }) && ({ false })", expected: newSpansetOperation(OpSpansetAnd, newSpansetFilter(NewStaticBool(true)), newSpansetFilter(NewStaticBool(false)))}, + {in: "{ true } !> { false }", expected: newSpansetOperation(OpSpansetNotChild, newSpansetFilter(NewStaticBool(true)), newSpansetFilter(NewStaticBool(false)))}, + {in: "{ true } !< { false }", expected: newSpansetOperation(OpSpansetNotParent, newSpansetFilter(NewStaticBool(true)), newSpansetFilter(NewStaticBool(false)))}, + {in: "{ true } !>> { false }", expected: newSpansetOperation(OpSpansetNotDescendant, newSpansetFilter(NewStaticBool(true)), newSpansetFilter(NewStaticBool(false)))}, + {in: "{ true } !<< { false }", expected: newSpansetOperation(OpSpansetNotAncestor, newSpansetFilter(NewStaticBool(true)), newSpansetFilter(NewStaticBool(false)))}, + {in: "{ true } !~ { false }", expected: newSpansetOperation(OpSpansetNotSibling, newSpansetFilter(NewStaticBool(true)), newSpansetFilter(NewStaticBool(false)))}, } for _, tc := range tests { diff --git a/pkg/traceql/test_examples.yaml b/pkg/traceql/test_examples.yaml index c195a825d6c..a71c5c80dab 100644 --- a/pkg/traceql/test_examples.yaml +++ b/pkg/traceql/test_examples.yaml @@ -77,6 +77,8 @@ valid: - '{ true } !> { true }' - '{ true } !< { true }' - '{ true } !~ { true }' + - '{ true } !>> { true }' + - '{ true } !<< { true }' - '({ true } | count() > 1 | { false }) >> ({ true } | count() > 1 | { false })' - '({ true } | count() > 1 | { false }) > ({ true } | count() > 1 | { false })' - '({ true } | count() > 1 | { false }) ~ ({ true } | count() > 1 | { false })' From dc4b29356c870a5e63a670a00dcf5c1d2ae54f96 Mon Sep 17 00:00:00 2001 From: Joe Elliott Date: Fri, 6 Oct 2023 14:39:00 -0400 Subject: [PATCH 11/14] tempodb tests and docs Signed-off-by: Joe Elliott --- docs/sources/tempo/traceql/_index.md | 2 ++ tempodb/tempodb_search_test.go | 44 ++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/docs/sources/tempo/traceql/_index.md b/docs/sources/tempo/traceql/_index.md index c6779dd2561..65c071325cd 100644 --- a/docs/sources/tempo/traceql/_index.md +++ b/docs/sources/tempo/traceql/_index.md @@ -228,6 +228,8 @@ For example, to find a trace where a specific HTTP API interacted with a specifi These spanset operators look at the structure of a trace and the relationship between the spans. They are marked experimental b/c they are known to sometimes return false positives. However, they can be very useful and we encourage users to try them and give feedback. +- `{condA} !>> {condB}` - The not descendant operator (`!>>`) looks for spans matching `{condB}` that are not descendant spans of a parent matching `{condA}` +- `{condA} !<< {condB}` - The not ancestor operator (`!<<`) looks for spans matching `{condB}` that are not ancestor spans of a child matching `{condA}` - `{condA} !> {condB}` - The not child operator (`!>`) looks for spans matching `{condB}` that are not direct child spans of a parent matching `{condA}` - `{condA} !< {condB}` - The not parent operator (`!<`) looks for spans matching `{condB}` that are not direct parent spans of a child matching `{condA}` - `{condA} !~ {condB}` - The not sibling operator (`!~`) looks that spans matching `{condB}` that do not have at least one sibling matching `{condA}`. diff --git a/tempodb/tempodb_search_test.go b/tempodb/tempodb_search_test.go index 7fa3b2a5cee..2934fb20960 100644 --- a/tempodb/tempodb_search_test.go +++ b/tempodb/tempodb_search_test.go @@ -539,6 +539,28 @@ func traceQLStructural(t *testing.T, _ *tempopb.Trace, wantMeta *tempopb.TraceSe }, }, }, + { + req: &tempopb.SearchRequest{Query: "{ .child } !>> { .parent }"}, + expected: []*tempopb.TraceSearchMetadata{ + { + SpanSets: []*tempopb.SpanSet{ + { + Spans: []*tempopb.Span{ + { + SpanID: "0000000000040506", + StartTimeUnixNano: 1000000000000, + DurationNanos: 2000000000, + Attributes: []*v1_common.KeyValue{ + {Key: "parent", Value: &v1_common.AnyValue{Value: &v1_common.AnyValue_BoolValue{BoolValue: true}}}, + }, + }, + }, + Matched: 1, + }, + }, + }, + }, + }, { req: &tempopb.SearchRequest{Query: "{ .child } !~ { .parent }"}, expected: []*tempopb.TraceSearchMetadata{ @@ -583,6 +605,28 @@ func traceQLStructural(t *testing.T, _ *tempopb.Trace, wantMeta *tempopb.TraceSe }, }, }, + { + req: &tempopb.SearchRequest{Query: "{ .parent } !<< { .child }"}, + expected: []*tempopb.TraceSearchMetadata{ + { + SpanSets: []*tempopb.SpanSet{ + { + Spans: []*tempopb.Span{ + { + SpanID: "0000000000010203", + StartTimeUnixNano: 1000000000000, + DurationNanos: 1000000000, + Attributes: []*v1_common.KeyValue{ + {Key: "child", Value: &v1_common.AnyValue{Value: &v1_common.AnyValue_BoolValue{BoolValue: true}}}, + }, + }, + }, + Matched: 1, + }, + }, + }, + }, + }, { req: &tempopb.SearchRequest{Query: "{ .child } ~ { .child2 }"}, expected: []*tempopb.TraceSearchMetadata{ From 6aa6c5b8741f2df2f7f29ca277d795a61c5b1116 Mon Sep 17 00:00:00 2001 From: Joe Elliott Date: Fri, 6 Oct 2023 14:43:05 -0400 Subject: [PATCH 12/14] remove load Signed-off-by: Joe Elliott --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 99c2198a2d4..f57b75f3237 100644 --- a/Makefile +++ b/Makefile @@ -160,7 +160,7 @@ lint: .PHONY: docker-component # Not intended to be used directly docker-component: check-component exe - docker build -t grafana/$(COMPONENT) --load --build-arg=TARGETARCH=$(GOARCH) -f ./cmd/$(COMPONENT)/Dockerfile . + docker build -t grafana/$(COMPONENT) --build-arg=TARGETARCH=$(GOARCH) -f ./cmd/$(COMPONENT)/Dockerfile . docker tag grafana/$(COMPONENT) $(COMPONENT) .PHONY: docker-component-debug From a8c7b45ac675d7fe7c0385fc43921d6a63c3f83c Mon Sep 17 00:00:00 2001 From: Joe Elliott Date: Tue, 10 Oct 2023 12:55:40 -0400 Subject: [PATCH 13/14] Apply suggestions from code review Co-authored-by: Kim Nylander <104772500+knylander-grafana@users.noreply.github.com> --- docs/sources/tempo/traceql/_index.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/sources/tempo/traceql/_index.md b/docs/sources/tempo/traceql/_index.md index 65c071325cd..31e2d592a59 100644 --- a/docs/sources/tempo/traceql/_index.md +++ b/docs/sources/tempo/traceql/_index.md @@ -215,7 +215,7 @@ matches from the right hand side of the operator. - `{condA} << {condB}` - The ancestor operator (`<<`) looks for spans matching `{condB}` that are ancestor of a span matching `{condA}` - `{condA} > {condB}` - The child operator (`>`) looks for spans matching `{condB}` that are direct child spans of a parent matching `{condA}` - `{condA} < {condB}` - The parent operator (`<`) looks for spans matching `{condB}` that are direct parent spans of a child matching `{condA}` -- `{condA} ~ {condB}` - The sibling operator (`~`) looks that spans matching `{condB}` that have at least one sibling matching `{condA}`. +- `{condA} ~ {condB}` - The sibling operator (`~`) looks at spans matching `{condB}` that have at least one sibling matching `{condA}`. For example, to find a trace where a specific HTTP API interacted with a specific database: @@ -225,14 +225,14 @@ For example, to find a trace where a specific HTTP API interacted with a specifi ### Experimental Structural -These spanset operators look at the structure of a trace and the relationship between the spans. They are marked experimental b/c they -are known to sometimes return false positives. However, they can be very useful and we encourage users to try them and give feedback. +These spanset operators look at the structure of a trace and the relationship between the spans. They are marked experimental because they +are known to sometimes return false positives. However, they can be very useful (see examples below). We encourage users to try them and give feedback. -- `{condA} !>> {condB}` - The not descendant operator (`!>>`) looks for spans matching `{condB}` that are not descendant spans of a parent matching `{condA}` -- `{condA} !<< {condB}` - The not ancestor operator (`!<<`) looks for spans matching `{condB}` that are not ancestor spans of a child matching `{condA}` -- `{condA} !> {condB}` - The not child operator (`!>`) looks for spans matching `{condB}` that are not direct child spans of a parent matching `{condA}` -- `{condA} !< {condB}` - The not parent operator (`!<`) looks for spans matching `{condB}` that are not direct parent spans of a child matching `{condA}` -- `{condA} !~ {condB}` - The not sibling operator (`!~`) looks that spans matching `{condB}` that do not have at least one sibling matching `{condA}`. +- `{condA} !>> {condB}` - The not-descendant operator (`!>>`) looks for spans matching `{condB}` that are not descendant spans of a parent matching `{condA}` +- `{condA} !<< {condB}` - The not-ancestor operator (`!<<`) looks for spans matching `{condB}` that are not ancestor spans of a child matching `{condA}` +- `{condA} !> {condB}` - The not-child operator (`!>`) looks for spans matching `{condB}` that are not direct child spans of a parent matching `{condA}` +- `{condA} !< {condB}` - The not-parent operator (`!<`) looks for spans matching `{condB}` that are not direct parent spans of a child matching `{condA}` +- `{condA} !~ {condB}` - The not-sibling operator (`!~`) looks that spans matching `{condB}` that do not have at least one sibling matching `{condA}`. For example, to find a trace with a leaf span in the service "foo": From 023c9b262fe1d2264894efe1d553042790d48e08 Mon Sep 17 00:00:00 2001 From: Joe Elliott Date: Tue, 10 Oct 2023 16:49:08 -0400 Subject: [PATCH 14/14] review Signed-off-by: Joe Elliott --- docs/sources/tempo/traceql/_index.md | 2 +- pkg/traceql/ast_execute.go | 30 ++++++++++++++-------------- pkg/traceql/lexer.go | 2 ++ 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/docs/sources/tempo/traceql/_index.md b/docs/sources/tempo/traceql/_index.md index 31e2d592a59..0e61ca4bb06 100644 --- a/docs/sources/tempo/traceql/_index.md +++ b/docs/sources/tempo/traceql/_index.md @@ -243,7 +243,7 @@ For example, to find a trace with a leaf span in the service "foo": To find a span that is the last error in a series of cascading errors: ``` -{ status != error } !< { status = error } +{ status = error } !< { status = error } ``` ## Aggregators diff --git a/pkg/traceql/ast_execute.go b/pkg/traceql/ast_execute.go index eb246ef931b..ca2ad337c91 100644 --- a/pkg/traceql/ast_execute.go +++ b/pkg/traceql/ast_execute.go @@ -105,45 +105,45 @@ func (o SpansetOperation) evaluate(input []*Spanset) (output []*Spanset, err err // relationship operators all set relFn which is used by below code // to perform the operation - case OpSpansetDescendant: - fallthrough case OpSpansetNotDescendant: + falseForAll = true + fallthrough + case OpSpansetDescendant: relFn = func(l, r Span) bool { return r.DescendantOf(l) } - falseForAll = o.Op == OpSpansetNotDescendant - case OpSpansetAncestor: - fallthrough case OpSpansetNotAncestor: + falseForAll = true + fallthrough + case OpSpansetAncestor: relFn = func(l, r Span) bool { return l.DescendantOf(r) } - falseForAll = o.Op == OpSpansetNotAncestor - case OpSpansetChild: - fallthrough case OpSpansetNotChild: + falseForAll = true + fallthrough + case OpSpansetChild: relFn = func(l, r Span) bool { return r.ChildOf(l) } - falseForAll = o.Op == OpSpansetNotChild - case OpSpansetParent: - fallthrough case OpSpansetNotParent: + falseForAll = true + fallthrough + case OpSpansetParent: relFn = func(l, r Span) bool { return l.ChildOf(r) } - falseForAll = o.Op == OpSpansetNotParent - case OpSpansetSibling: - fallthrough case OpSpansetNotSibling: + falseForAll = true + fallthrough + case OpSpansetSibling: relFn = func(l, r Span) bool { return r.SiblingOf(l) } - falseForAll = o.Op == OpSpansetNotSibling default: return nil, fmt.Errorf("spanset operation (%v) not supported", o.Op) } diff --git a/pkg/traceql/lexer.go b/pkg/traceql/lexer.go index e61df5bd13d..fe50ac88818 100644 --- a/pkg/traceql/lexer.go +++ b/pkg/traceql/lexer.go @@ -172,6 +172,8 @@ func (l *lexer) Lex(lval *yySymType) int { } // look for combination tokens starting with 2 and working up til there is no match + // this is only to disamgiguate tokens with common prefixes. it will not find 3+ token combinations + // with no valid prefixes multiTok := -1 tokStrNext := l.TokenText() for {