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); } }
public RowBufferAllocation(RowBufferAllocation parent, RowBuffer rowBuffer, IEnumerable <ValueSlot> valueSlots) { Parent = parent; RowBuffer = rowBuffer; _mapping = GetValueMapping(valueSlots.ToImmutableArray()); }
private static TDelegate BuildExpression <TDelegate>(BoundExpression expression, Type targetType, RowBufferAllocation allocation) { var builder = new ExpressionBuilder(allocation); return(builder.BuildExpression <TDelegate>(expression, targetType)); }
public static IteratorPredicate BuildIteratorPredicate(BoundExpression predicate, bool nullValue, RowBufferAllocation allocation) { if (predicate == null) { return(() => nullValue); } return(BuildExpression <IteratorPredicate>(predicate, typeof(bool), allocation)); }
public static IteratorFunction BuildIteratorFunction(BoundExpression expression, RowBufferAllocation allocation) { return(BuildExpression <IteratorFunction>(expression, typeof(object), allocation)); }
private ExpressionBuilder(RowBufferAllocation allocation) { _rowBufferAllocation = allocation; }
private static IteratorPredicate BuildPredicate(BoundExpression predicate, bool nullValue, RowBufferAllocation allocation) { return(ExpressionBuilder.BuildIteratorPredicate(predicate, nullValue, allocation)); }
private static IteratorFunction BuildFunction(BoundExpression expression, RowBufferAllocation allocation) { return(ExpressionBuilder.BuildIteratorFunction(expression, allocation)); }