Exemple #1
0
        protected override BoundRelation RewriteIntersectOrExceptRelation(BoundIntersectOrExceptRelation node)
        {
            _recorder.Record(node.Left.GetOutputValues());
            _recorder.Record(node.Right.GetOutputValues());

            return(base.RewriteIntersectOrExceptRelation(node));
        }
        protected override BoundRelation RewriteIntersectOrExceptRelation(BoundIntersectOrExceptRelation node)
        {
            var left  = RewriteRelation(node.Left);
            var right = RewriteRelation(node.Right);

            var values       = left.GetOutputValues();
            var sortedValues = values.Zip(node.Comparers, (v, c) => new BoundComparedValue(v, c));
            var sortedLeft   = new BoundSortRelation(true, left, sortedValues);

            var valueSlots = sortedLeft.GetOutputValues().Zip(right.GetOutputValues(), ValueTuple.Create);
            var condition  = CreatePredicate(valueSlots);

            var joinOperator = node.IsIntersect
                ? BoundJoinType.LeftSemi
                : BoundJoinType.LeftAntiSemi;

            return(new BoundJoinRelation(joinOperator, sortedLeft, right, condition, null, null));
        }
 private static CardinalityEstimate EstimateIntersectOrExceptRelation(BoundIntersectOrExceptRelation relation)
 {
     return(CardinalityEstimate.Unknown);
 }