예제 #1
0
        private Iterator BuildJoin(BoundJoinRelation relation)
        {
            var left = BuildRelation(relation.Left);

            _outerRowBufferAllocation = BuildRowBufferAllocation(relation.Left, left.RowBuffer);

            var right = BuildRelation(relation.Right);
            var combinedAllocation = BuildRowBufferAllocation(relation.Right, right.RowBuffer);

            _outerRowBufferAllocation = _outerRowBufferAllocation.Parent;

            var predicate = BuildPredicate(relation.Condition, true, combinedAllocation);

            var passthruPredicate = BuildPredicate(relation.PassthruPredicate, false, combinedAllocation);

            switch (relation.JoinType)
            {
            case BoundJoinType.Inner:
                Debug.Assert(relation.Probe == null);
                return(new InnerNestedLoopsIterator(left, right, predicate, passthruPredicate));

            case BoundJoinType.LeftSemi:
                return(relation.Probe == null
                        ? (Iterator) new LeftSemiNestedLoopsIterator(left, right, predicate, passthruPredicate)
                        : new ProbingLeftSemiNestedLoopsIterator(left, right, predicate));

            case BoundJoinType.LeftAntiSemi:
                Debug.Assert(relation.Probe == null);
                return(new LeftAntiSemiNestedLoopsIterator(left, right, predicate, passthruPredicate));

            case BoundJoinType.LeftOuter:
                return(new LeftOuterNestedLoopsIterator(left, right, predicate, passthruPredicate));

            default:
                throw ExceptionBuilder.UnexpectedValue(relation.JoinType);
            }
        }
예제 #2
0
 public RowBufferAllocation(RowBufferAllocation parent, RowBuffer rowBuffer, IEnumerable <ValueSlot> valueSlots)
 {
     Parent    = parent;
     RowBuffer = rowBuffer;
     _mapping  = GetValueMapping(valueSlots.ToImmutableArray());
 }
예제 #3
0
        private static TDelegate BuildExpression <TDelegate>(BoundExpression expression, Type targetType, RowBufferAllocation allocation)
        {
            var builder = new ExpressionBuilder(allocation);

            return(builder.BuildExpression <TDelegate>(expression, targetType));
        }
예제 #4
0
        public static IteratorPredicate BuildIteratorPredicate(BoundExpression predicate, bool nullValue, RowBufferAllocation allocation)
        {
            if (predicate == null)
            {
                return(() => nullValue);
            }

            return(BuildExpression <IteratorPredicate>(predicate, typeof(bool), allocation));
        }
예제 #5
0
 public static IteratorFunction BuildIteratorFunction(BoundExpression expression, RowBufferAllocation allocation)
 {
     return(BuildExpression <IteratorFunction>(expression, typeof(object), allocation));
 }
예제 #6
0
 private ExpressionBuilder(RowBufferAllocation allocation)
 {
     _rowBufferAllocation = allocation;
 }
예제 #7
0
 private static IteratorPredicate BuildPredicate(BoundExpression predicate, bool nullValue, RowBufferAllocation allocation)
 {
     return(ExpressionBuilder.BuildIteratorPredicate(predicate, nullValue, allocation));
 }
예제 #8
0
 private static IteratorFunction BuildFunction(BoundExpression expression, RowBufferAllocation allocation)
 {
     return(ExpressionBuilder.BuildIteratorFunction(expression, allocation));
 }