protected override void InternalBindingTraversal(Plan plan, PlanNodeVisitor visitor) { base.InternalBindingTraversal(plan, visitor); #if UseScannedDifference Schema.IRowType leftRowType = DataType.CreateRowType(Keywords.Left); APlan.Symbols.Push(new Symbol(leftRowType)); try { Schema.IRowType rightRowType = DataType.CreateRowType(Keywords.Right); APlan.Symbols.Push(new Symbol(rightRowType)); try { FEqualNode.BindingTraversal(APlan, visitor); } finally { APlan.Symbols.Pop(); } } finally { APlan.Symbols.Pop(); } #endif }
private bool FindIndexKey(Schema.IRowType keyRowType, NativeRow key, out RowTreeNode indexNode, out int entryNumber) { RowTreeSearchPath searchPath = new RowTreeSearchPath(); try { bool result = _accessPath.FindKey(_manager, keyRowType, key, searchPath, out entryNumber); indexNode = searchPath.DisownAt(searchPath.Count - 1); return(result); } finally { searchPath.Dispose(); } }
public override void DetermineDataType(Plan plan) { DetermineModifiers(plan); if (Nodes[0].DataType.Is(Nodes[1].DataType)) { Nodes[0] = Compiler.Upcast(plan, Nodes[0], Nodes[1].DataType); } else if (Nodes[1].DataType.Is(Nodes[0].DataType)) { Nodes[1] = Compiler.Upcast(plan, Nodes[1], Nodes[0].DataType); } else { ConversionContext context = Compiler.FindConversionPath(plan, Nodes[0].DataType, Nodes[1].DataType); if (context.CanConvert) { Nodes[0] = Compiler.Upcast(plan, Compiler.ConvertNode(plan, Nodes[0], context), Nodes[1].DataType); } else { context = Compiler.FindConversionPath(plan, Nodes[1].DataType, Nodes[0].DataType); Compiler.CheckConversionContext(plan, context); Nodes[1] = Compiler.Upcast(plan, Compiler.ConvertNode(plan, Nodes[1], context), Nodes[0].DataType); } } _dataType = new Schema.TableType(); _tableVar = new Schema.ResultTableVar(this); _tableVar.Owner = plan.User; _tableVar.InheritMetaData(LeftTableVar.MetaData); CopyTableVarColumns(LeftTableVar.Columns); DetermineRemotable(plan); CopyKeys(LeftTableVar.Keys); CopyOrders(LeftTableVar.Orders); if (LeftNode.Order != null) { Order = CopyOrder(LeftNode.Order); } #if UseReferenceDerivation #if UseElaborable if (plan.CursorContext.CursorCapabilities.HasFlag(CursorCapability.Elaborable)) #endif CopyReferences(plan, LeftTableVar); #endif #if UseScannedDifference // Scanned Difference Algorithm - Brute Force, for every row in the left, scan the right for a matching row FDifferenceAlgorithm = typeof(ScannedDifferenceTable); Schema.IRowType leftRowType = DataType.CreateRowType(Keywords.Left); APlan.Symbols.Push(new Symbol(leftRowType)); try { // Compile a row equality node Schema.IRowType rightRowType = DataType.CreateRowType(Keywords.Right); APlan.Symbols.Push(new Symbol(rightRowType)); try { FEqualNode = Compiler.CompileExpression(APlan, Compiler.BuildKeyEqualExpression(APlan, leftRowType.Columns, rightRowType.Columns)); } finally { APlan.Symbols.Pop(); } } finally { APlan.Symbols.Pop(); } #endif }
public override void DetermineDataType(Plan plan) { DetermineModifiers(plan); _dataType = plan.DataTypes.SystemBoolean; if (Nodes[0].DataType.Is(Nodes[1].DataType)) { Nodes[0] = Compiler.Upcast(plan, Nodes[0], Nodes[1].DataType); } else if (Nodes[1].DataType.Is(Nodes[0].DataType)) { Nodes[1] = Compiler.Upcast(plan, Nodes[1], Nodes[0].DataType); } else { ConversionContext context = Compiler.FindConversionPath(plan, Nodes[0].DataType, Nodes[1].DataType); if (context.CanConvert) { Nodes[0] = Compiler.Upcast(plan, Compiler.ConvertNode(plan, Nodes[0], context), Nodes[1].DataType); } else { context = Compiler.FindConversionPath(plan, Nodes[1].DataType, Nodes[0].DataType); Compiler.CheckConversionContext(plan, context); Nodes[1] = Compiler.Upcast(plan, Compiler.ConvertNode(plan, Nodes[1], context), Nodes[0].DataType); } } plan.Symbols.PushWindow(0); try { plan.EnterRowContext(); try { #if USENAMEDROWVARIABLES plan.Symbols.Push(new Symbol(Keywords.Left, LeftTableNode.DataType.RowType)); #else Schema.IRowType leftRowType = LeftTableNode.DataType.CreateRowType(Keywords.Left); APlan.Symbols.Push(new Symbol(String.Empty, leftRowType)); #endif try { #if USENAMEDROWVARIABLES plan.Symbols.Push(new Symbol(Keywords.Right, RightTableNode.DataType.RowType)); #else Schema.IRowType rightRowType = RightTableNode.DataType.CreateRowType(Keywords.Right); APlan.Symbols.Push(new Symbol(String.Empty, rightRowType)); #endif try { _rowEqualNode = #if USENAMEDROWVARIABLES Compiler.CompileExpression(plan, Compiler.BuildRowEqualExpression(plan, Keywords.Left, Keywords.Right, LeftTableNode.TableVar.Columns, RightTableNode.TableVar.Columns)); #else Compiler.CompileExpression(APlan, Compiler.BuildRowEqualExpression(APlan, leftRowType.Columns, rightRowType.Columns)); #endif } finally { plan.Symbols.Pop(); } } finally { plan.Symbols.Pop(); } } finally { plan.ExitRowContext(); } } finally { plan.Symbols.PopWindow(); } }