public override AlgebraNode VisitHashMatchAlgebraNode(HashMatchAlgebraNode node) { HashMatchIterator hashMatchIterator = new HashMatchIterator(); hashMatchIterator.RowBuffer = new object[node.OutputList.Length]; hashMatchIterator.Left = ConvertAlgebraNode(node.Left); hashMatchIterator.LeftOutput = GetIteratorOutput(0, node.Left.OutputList, node.OutputList); hashMatchIterator.Right = ConvertAlgebraNode(node.Right); hashMatchIterator.RightOutput = GetIteratorOutput(hashMatchIterator.LeftOutput.Length, node.Right.OutputList, node.OutputList); hashMatchIterator.BuildKeyEntry = GetIteratorInput(node.Left.OutputList, new RowBufferEntry[] { node.BuildKeyEntry })[0]; hashMatchIterator.ProbeEntry = GetIteratorInput(node.Right.OutputList, new RowBufferEntry[] { node.ProbeEntry })[0]; switch (node.Op) { case JoinAlgebraNode.JoinOperator.InnerJoin: hashMatchIterator.LogicalOp = JoinType.Inner; break; case JoinAlgebraNode.JoinOperator.RightOuterJoin: hashMatchIterator.LogicalOp = JoinType.RightOuter; break; case JoinAlgebraNode.JoinOperator.FullOuterJoin: hashMatchIterator.LogicalOp = JoinType.FullOuter; break; default: throw ExceptionBuilder.UnhandledCaseLabel(node.Op); } UpdatePredicateRowBufferReferences(hashMatchIterator, node); SetLastIterator(node, hashMatchIterator); 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 VisitHashMatchAlgebraNode(HashMatchAlgebraNode node) { HashMatchIterator hashMatchIterator = new HashMatchIterator(); hashMatchIterator.RowBuffer = new object[node.OutputList.Length]; hashMatchIterator.Left = ConvertAlgebraNode(node.Left); hashMatchIterator.LeftOutput = GetIteratorOutput(0, node.Left.OutputList, node.OutputList); hashMatchIterator.Right = ConvertAlgebraNode(node.Right); hashMatchIterator.RightOutput = GetIteratorOutput(hashMatchIterator.LeftOutput.Length, node.Right.OutputList, node.OutputList); hashMatchIterator.BuildKeyEntry = GetIteratorInput(node.Left.OutputList, new RowBufferEntry[] { node.BuildKeyEntry })[0]; hashMatchIterator.ProbeEntry = GetIteratorInput(node.Right.OutputList, new RowBufferEntry[] { node.ProbeEntry })[0]; switch (node.Op) { case JoinAlgebraNode.JoinOperator.InnerJoin: hashMatchIterator.LogicalOp = JoinType.Inner; break; case JoinAlgebraNode.JoinOperator.RightOuterJoin: hashMatchIterator.LogicalOp = JoinType.RightOuter; break; case JoinAlgebraNode.JoinOperator.FullOuterJoin: hashMatchIterator.LogicalOp = JoinType.FullOuter; break; default: throw ExceptionBuilder.UnhandledCaseLabel(node.Op); } UpdatePredicateRowBufferReferences(hashMatchIterator, node); SetLastIterator(node, hashMatchIterator); return node; }