예제 #1
0
        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);
        }
예제 #2
0
 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);
     }
 }
예제 #3
0
		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;
		}
예제 #4
0
		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);
			}
		}