Helper that applies op to a left-side that is a *SpanExpression and a right-side that is an unknown implementation of Expression.
( left *SpanExpression, right Expression, op SetOperator, )
| 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. |
| 642 | func opSpanExpressionAndDefault( |
| 643 | left *SpanExpression, right Expression, op SetOperator, |
| 644 | ) *SpanExpression { |
| 645 | expr := &SpanExpression{ |
| 646 | Tight: left.IsTight() && right.IsTight(), |
| 647 | // The SpansToRead is a lower-bound in this case. Note that |
| 648 | // such an expression is only used for Join costing. |
| 649 | SpansToRead: left.SpansToRead, |
| 650 | Operator: op, |
| 651 | Left: left, |
| 652 | Right: right, |
| 653 | } |
| 654 | if op == SetUnion { |
| 655 | // Promote the left-side union spans. We don't know anything |
| 656 | // about the right-side. |
| 657 | expr.FactoredUnionSpans = left.FactoredUnionSpans |
| 658 | left.FactoredUnionSpans = nil |
| 659 | } |
| 660 | // Else SetIntersection -- we can't factor anything if one side is |
| 661 | // unknown. |
| 662 | return expr |
| 663 | } |
| 664 | |
| 665 | // Intersects two SpanExpressions. |
| 666 | func intersectSpanExpressions(left, right *SpanExpression) *SpanExpression { |