public override AlgebraNode VisitAggregateAlgebraNode(AggregateAlgebraNode node) { StreamAggregateIterator streamAggregateIterator = new StreamAggregateIterator(); streamAggregateIterator.RowBuffer = new object[node.OutputList.Length]; streamAggregateIterator.Input = ConvertAlgebraNode(node.Input); streamAggregateIterator.InputOutput = GetIteratorOutput(0, node.Input.OutputList, node.OutputList); BoundRowBufferEntrySet boundRowBufferEntrySet = new BoundRowBufferEntrySet(streamAggregateIterator.Input.RowBuffer, node.Input.OutputList); if (node.Groups == null) { streamAggregateIterator.GroupByEntries = new IteratorInput[0]; streamAggregateIterator.DefinedValues = GetDefinedValues(node.OutputList, node.DefinedValues, boundRowBufferEntrySet); } else { streamAggregateIterator.GroupByEntries = GetIteratorInput(node.Input.OutputList, node.Groups); streamAggregateIterator.DefinedValues = GetDefinedValues(node.OutputList, node.DefinedValues, boundRowBufferEntrySet); } SetLastIterator(node, streamAggregateIterator); return(node); }
public override AlgebraNode VisitAssertAlgebraNode(AssertAlgebraNode node) { string message; switch (node.AssertionType) { case AssertionType.MaxOneRow: message = Resources.SubqueryReturnedMoreThanRow; break; case AssertionType.BelowRecursionLimit: message = Resources.MaximumRecursionLevelExceeded; break; default: throw ExceptionBuilder.UnhandledCaseLabel(node.AssertionType); } AssertIterator assertIterator = new AssertIterator(); assertIterator.RowBuffer = new object[node.OutputList.Length]; assertIterator.Input = ConvertAlgebraNode(node.Input); assertIterator.InputOutput = GetIteratorOutput(0, node.Input.OutputList, node.OutputList); assertIterator.Message = message; BoundRowBufferEntrySet boundRowBufferEntrySet = new BoundRowBufferEntrySet(assertIterator.Input.RowBuffer, node.Input.OutputList); assertIterator.Predicate = CreateRuntimeExpression(node.Predicate, boundRowBufferEntrySet); SetLastIterator(node, assertIterator); return(node); }
private void UpdatePredicateRowBufferReferences(HashMatchIterator hashMatchIterator, HashMatchAlgebraNode node) { if (node.ProbeResidual != null) { BoundRowBufferEntrySet leftBoundRowBufferEntrySet = new BoundRowBufferEntrySet(hashMatchIterator.Left.RowBuffer, node.Left.OutputList); BoundRowBufferEntrySet rightBoundRowBufferEntrySet = new BoundRowBufferEntrySet(hashMatchIterator.Right.RowBuffer, node.Right.OutputList); hashMatchIterator.ProbeResidual = CreateRuntimeExpression(node.ProbeResidual, leftBoundRowBufferEntrySet, rightBoundRowBufferEntrySet); } }
public override AlgebraNode VisitFilterAlgebraNode(FilterAlgebraNode node) { FilterIterator filterIterator = new FilterIterator(); filterIterator.RowBuffer = new object[node.OutputList.Length]; filterIterator.Input = ConvertAlgebraNode(node.Input); filterIterator.InputOutput = GetIteratorOutput(0, node.Input.OutputList, node.OutputList); BoundRowBufferEntrySet boundRowBufferEntrySet = new BoundRowBufferEntrySet(filterIterator.Input.RowBuffer, node.Input.OutputList); filterIterator.Predicate = CreateRuntimeExpression(node.Predicate, boundRowBufferEntrySet); SetLastIterator(node, filterIterator); return(node); }
private void UpdatePredicateRowBufferReferences(NestedLoopsIterator nestedLoopsIterator, JoinAlgebraNode node) { BoundRowBufferEntrySet leftBoundRowBufferEntrySet = new BoundRowBufferEntrySet(nestedLoopsIterator.Left.RowBuffer, node.Left.OutputList); BoundRowBufferEntrySet rightBoundRowBufferEntrySet = new BoundRowBufferEntrySet(nestedLoopsIterator.Right.RowBuffer, node.Right.OutputList); if (node.Predicate != null) { nestedLoopsIterator.Predicate = CreateRuntimeExpression(node.Predicate, leftBoundRowBufferEntrySet, rightBoundRowBufferEntrySet); } if (node.PassthruPredicate != null) { nestedLoopsIterator.PassthruPredicate = CreateRuntimeExpression(node.PassthruPredicate, leftBoundRowBufferEntrySet, rightBoundRowBufferEntrySet); } }
public override AlgebraNode VisitComputeScalarAlgebraNode(ComputeScalarAlgebraNode node) { ComputeScalarIterator computeScalarIterator = new ComputeScalarIterator(); computeScalarIterator.RowBuffer = new object[node.OutputList.Length]; computeScalarIterator.Input = ConvertAlgebraNode(node.Input); computeScalarIterator.InputOutput = GetIteratorOutput(0, node.Input.OutputList, node.OutputList); BoundRowBufferEntrySet boundRowBufferEntrySet = new BoundRowBufferEntrySet(computeScalarIterator.Input.RowBuffer, node.Input.OutputList); computeScalarIterator.DefinedValues = GetDefinedValues(node.OutputList, node.DefinedValues, boundRowBufferEntrySet); SetLastIterator(node, computeScalarIterator); return(node); }
public override AlgebraNode VisitIndexSpoolAlgebraNode(IndexSpoolAlgebraNode node) { IndexSpoolIterator indexSpoolIterator = new IndexSpoolIterator(); indexSpoolIterator.RowBuffer = new object[node.OutputList.Length]; indexSpoolIterator.Input = ConvertAlgebraNode(node.Input); indexSpoolIterator.InputOutput = GetIteratorOutput(0, node.Input.OutputList, node.OutputList); indexSpoolIterator.IndexEntry = GetIteratorInput(node.Input.OutputList, new RowBufferEntry[] { node.IndexEntry })[0]; BoundRowBufferEntrySet boundRowBufferEntrySet = new BoundRowBufferEntrySet(indexSpoolIterator.Input.RowBuffer, node.Input.OutputList); indexSpoolIterator.ProbeExpression = CreateRuntimeExpression(node.ProbeExpression, boundRowBufferEntrySet); SetLastIterator(node, indexSpoolIterator); return(node); }
private void PushOuterReferences(object[] rowBuffer, JoinAlgebraNode node) { if (node.OuterReferences != null && node.OuterReferences.Length > 0) { // Important: We cannot use node.OuterReferences as argument for BoundRowBufferEntrySet(). // The replacment strategy below will replace occurences to the entries by their index // within the array. Therefore we need an array with the same layout as the row buffer. RowBufferEntry[] outerReferences = new RowBufferEntry[node.Left.OutputList.Length]; for (int i = 0; i < outerReferences.Length; i++) { if (ArrayHelpers.Contains(node.OuterReferences, node.Left.OutputList[i])) { outerReferences[i] = node.Left.OutputList[i]; } } BoundRowBufferEntrySet bufferEntrySet = new BoundRowBufferEntrySet(rowBuffer, outerReferences); _outerReferenceStack.Push(bufferEntrySet); } }
public override AlgebraNode VisitAssertAlgebraNode(AssertAlgebraNode node) { string message; switch(node.AssertionType) { case AssertionType.MaxOneRow: message = Resources.SubqueryReturnedMoreThanRow; break; case AssertionType.BelowRecursionLimit: message = Resources.MaximumRecursionLevelExceeded; break; default: throw ExceptionBuilder.UnhandledCaseLabel(node.AssertionType); } AssertIterator assertIterator = new AssertIterator(); assertIterator.RowBuffer = new object[node.OutputList.Length]; assertIterator.Input = ConvertAlgebraNode(node.Input); assertIterator.InputOutput = GetIteratorOutput(0, node.Input.OutputList, node.OutputList); assertIterator.Message = message; BoundRowBufferEntrySet boundRowBufferEntrySet = new BoundRowBufferEntrySet(assertIterator.Input.RowBuffer, node.Input.OutputList); assertIterator.Predicate = CreateRuntimeExpression(node.Predicate, boundRowBufferEntrySet); SetLastIterator(node, assertIterator); return node; }
public override AlgebraNode VisitComputeScalarAlgebraNode(ComputeScalarAlgebraNode node) { ComputeScalarIterator computeScalarIterator = new ComputeScalarIterator(); computeScalarIterator.RowBuffer = new object[node.OutputList.Length]; computeScalarIterator.Input = ConvertAlgebraNode(node.Input); computeScalarIterator.InputOutput = GetIteratorOutput(0, node.Input.OutputList, node.OutputList); BoundRowBufferEntrySet boundRowBufferEntrySet = new BoundRowBufferEntrySet(computeScalarIterator.Input.RowBuffer, node.Input.OutputList); computeScalarIterator.DefinedValues = GetDefinedValues(node.OutputList, node.DefinedValues, boundRowBufferEntrySet); SetLastIterator(node, computeScalarIterator); return node; }
public override AlgebraNode VisitFilterAlgebraNode(FilterAlgebraNode node) { FilterIterator filterIterator = new FilterIterator(); filterIterator.RowBuffer = new object[node.OutputList.Length]; filterIterator.Input = ConvertAlgebraNode(node.Input); filterIterator.InputOutput = GetIteratorOutput(0, node.Input.OutputList, node.OutputList); BoundRowBufferEntrySet boundRowBufferEntrySet = new BoundRowBufferEntrySet(filterIterator.Input.RowBuffer, node.Input.OutputList); filterIterator.Predicate = CreateRuntimeExpression(node.Predicate, boundRowBufferEntrySet); SetLastIterator(node, filterIterator); return node; }
public override AlgebraNode VisitAggregateAlgebraNode(AggregateAlgebraNode node) { StreamAggregateIterator streamAggregateIterator = new StreamAggregateIterator(); streamAggregateIterator.RowBuffer = new object[node.OutputList.Length]; streamAggregateIterator.Input = ConvertAlgebraNode(node.Input); streamAggregateIterator.InputOutput = GetIteratorOutput(0, node.Input.OutputList, node.OutputList); BoundRowBufferEntrySet boundRowBufferEntrySet = new BoundRowBufferEntrySet(streamAggregateIterator.Input.RowBuffer, node.Input.OutputList); if (node.Groups == null) { streamAggregateIterator.GroupByEntries = new IteratorInput[0]; streamAggregateIterator.DefinedValues = GetDefinedValues(node.OutputList, node.DefinedValues, boundRowBufferEntrySet); } else { streamAggregateIterator.GroupByEntries = GetIteratorInput(node.Input.OutputList, node.Groups); streamAggregateIterator.DefinedValues = GetDefinedValues(node.OutputList, node.DefinedValues, boundRowBufferEntrySet); } SetLastIterator(node, streamAggregateIterator); return node; }
private void UpdatePredicateRowBufferReferences(NestedLoopsIterator nestedLoopsIterator, JoinAlgebraNode node) { BoundRowBufferEntrySet leftBoundRowBufferEntrySet = new BoundRowBufferEntrySet(nestedLoopsIterator.Left.RowBuffer, node.Left.OutputList); BoundRowBufferEntrySet rightBoundRowBufferEntrySet = new BoundRowBufferEntrySet(nestedLoopsIterator.Right.RowBuffer, node.Right.OutputList); if (node.Predicate != null) nestedLoopsIterator.Predicate = CreateRuntimeExpression(node.Predicate, leftBoundRowBufferEntrySet, rightBoundRowBufferEntrySet); if (node.PassthruPredicate != null) nestedLoopsIterator.PassthruPredicate = CreateRuntimeExpression(node.PassthruPredicate, leftBoundRowBufferEntrySet, rightBoundRowBufferEntrySet); }
public override AlgebraNode VisitIndexSpoolAlgebraNode(IndexSpoolAlgebraNode node) { IndexSpoolIterator indexSpoolIterator = new IndexSpoolIterator(); indexSpoolIterator.RowBuffer = new object[node.OutputList.Length]; indexSpoolIterator.Input = ConvertAlgebraNode(node.Input); indexSpoolIterator.InputOutput = GetIteratorOutput(0, node.Input.OutputList, node.OutputList); indexSpoolIterator.IndexEntry = GetIteratorInput(node.Input.OutputList, new RowBufferEntry[] { node.IndexEntry })[0]; BoundRowBufferEntrySet boundRowBufferEntrySet = new BoundRowBufferEntrySet(indexSpoolIterator.Input.RowBuffer, node.Input.OutputList); indexSpoolIterator.ProbeExpression = CreateRuntimeExpression(node.ProbeExpression, boundRowBufferEntrySet); SetLastIterator(node, indexSpoolIterator); return node; }
public RowBufferEntryExpressionUpdater(BoundRowBufferEntrySet[] bufferEntrySets) { _bufferEntrySets = bufferEntrySets; }
private void PushOuterReferences(object[] rowBuffer, JoinAlgebraNode node) { if (node.OuterReferences != null && node.OuterReferences.Length > 0) { // Important: We cannot use node.OuterReferences as argument for BoundRowBufferEntrySet(). // The replacment strategy below will replace occurences to the entries by their index // within the array. Therefore we need an array with the same layout as the row buffer. RowBufferEntry[] outerReferences = new RowBufferEntry[node.Left.OutputList.Length]; for (int i = 0; i < outerReferences.Length; i++) { if (ArrayHelpers.Contains(node.OuterReferences, node.Left.OutputList[i])) outerReferences[i] = node.Left.OutputList[i]; } BoundRowBufferEntrySet bufferEntrySet = new BoundRowBufferEntrySet(rowBuffer, outerReferences); _outerReferenceStack.Push(bufferEntrySet); } }