MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / Or

Function Or

pkg/sql/inverted/expression.go:610–638  ·  view source on GitHub ↗

Or of two boolean expressions. This function may modify both the left and right Expressions.

(left, right Expression)

Source from the content-addressed store, hash-verified

608// Or of two boolean expressions. This function may modify both the left and
609// right Expressions.
610func Or(left, right Expression) Expression {
611 switch l := left.(type) {
612 case *SpanExpression:
613 switch r := right.(type) {
614 case *SpanExpression:
615 return unionSpanExpressions(l, r)
616 case NonInvertedColExpression:
617 return r
618 default:
619 return opSpanExpressionAndDefault(l, right, SetUnion)
620 }
621 case NonInvertedColExpression:
622 return left
623 default:
624 switch r := right.(type) {
625 case *SpanExpression:
626 return opSpanExpressionAndDefault(r, left, SetUnion)
627 case NonInvertedColExpression:
628 return right
629 default:
630 return &SpanExpression{
631 Tight: left.IsTight() && right.IsTight(),
632 Operator: SetUnion,
633 Left: left,
634 Right: right,
635 }
636 }
637 }
638}
639
640// Helper that applies op to a left-side that is a *SpanExpression and
641// a right-side that is an unknown implementation of Expression.

Calls 3

unionSpanExpressionsFunction · 0.85
IsTightMethod · 0.65

Tested by

no test coverage detected