MCPcopy
hub / github.com/grafana/tempo / validate

Method validate

pkg/traceql/ast_validate.go:86–109  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

84}
85
86func (o ScalarOperation) validate() error {
87 if err := o.LHS.validate(); err != nil {
88 return err
89 }
90 if err := o.RHS.validate(); err != nil {
91 return err
92 }
93
94 if o.Op == OpNotExists || o.Op == OpExists {
95 return fmt.Errorf("illegal operation for the given type: %s", o.String())
96 }
97
98 lhsT := o.LHS.impliedType()
99 rhsT := o.RHS.impliedType()
100 if !lhsT.isMatchingOperand(rhsT) {
101 return fmt.Errorf("binary operations must operate on the same type: %s", o.String())
102 }
103
104 if !o.Op.binaryTypesValid(lhsT, rhsT) {
105 return fmt.Errorf("illegal operation for the given types: %s", o.String())
106 }
107
108 return nil
109}
110
111func (a Aggregate) validate() error {
112 if a.e == nil {

Callers

nothing calls this directly

Calls 5

StringMethod · 0.95
isMatchingOperandMethod · 0.80
binaryTypesValidMethod · 0.80
validateMethod · 0.65
impliedTypeMethod · 0.65

Tested by

no test coverage detected