/// <summary> /// Initializes join clause item with ON expression. /// </summary> internal JoinClauseItem(FromClauseItem joinLeft, FromClauseItem joinRight, JoinKind joinKind, Node onExpr) { _joinLeft = joinLeft; _joinRight = joinRight; JoinKind = joinKind; _onExpr = onExpr; }
public override void CollectDataFromChildren() { if (ChildNodes.Count() > 0) { JoinKindOpt = ParseEnum <JoinKind>((ChildNodes.First <ISqlNode>() as SqlKeyNode).Text); } }
// <summary> // Initializes join clause item with ON expression. // </summary> internal JoinClauseItem(FromClauseItem joinLeft, FromClauseItem joinRight, JoinKind joinKind, Node onExpr) { _joinLeft = joinLeft; _joinRight = joinRight; JoinKind = joinKind; _onExpr = onExpr; }
/// <summary> /// Creates a transitively generated join edge /// </summary> /// <param name="left"> the left table </param> /// <param name="right"> the right table </param> /// <param name="joinKind"> the join kind </param> /// <param name="leftVars"> left equijoin vars </param> /// <param name="rightVars"> right equijoin vars </param> /// <returns> the join edge </returns> internal static JoinEdge CreateTransitiveJoinEdge( AugmentedTableNode left, AugmentedTableNode right, JoinKind joinKind, List <ColumnVar> leftVars, List <ColumnVar> rightVars) { var joinEdge = new JoinEdge(left, right, null, joinKind, leftVars, rightVars); return(joinEdge); }
internal static JoinEdge CreateTransitiveJoinEdge( AugmentedTableNode left, AugmentedTableNode right, JoinKind joinKind, List <ColumnVar> leftVars, List <ColumnVar> rightVars) { return(new JoinEdge(left, right, (AugmentedJoinNode)null, joinKind, leftVars, rightVars)); }
internal JoinPlanNode( PlanNode left, PlanNode right, IBinaryObserver pipe, Type leftPayloadType, Type rightPayloadType, Type payloadType, Type keyType, JoinKind joinKind, bool isGenerated, string errorMessages, bool withStateManager) : base(left, right, pipe, keyType, leftPayloadType, rightPayloadType, payloadType, isGenerated, errorMessages) { this.leftPayloadType = leftPayloadType; this.rightPayloadType = rightPayloadType; this.JoinKind = joinKind; }
public EquiJoinStreamable(IStreamable <TKey, TLeft> left, IStreamable <TKey, TRight> right, Expression <Func <TLeft, TRight, TResult> > selector) : base(left.Properties.Join(right.Properties, selector), left, right) { Contract.Requires(selector != null); this.Selector = selector; // This operator uses the equality method on payloads if (left.Properties.IsColumnar && !left.Properties.IsStartEdgeOnly && !left.Properties.PayloadEqualityComparer.CanUsePayloadEquality()) { throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Type of left side of join, '{0}', does not have a valid equality operator for columnar mode.", typeof(TLeft).FullName)); } // This operator uses the equality method on payloads if (right.Properties.IsColumnar && !right.Properties.IsStartEdgeOnly && !right.Properties.PayloadEqualityComparer.CanUsePayloadEquality()) { throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Type of right side of join, '{0}', does not have a valid equality operator for columnar mode.", typeof(TRight).FullName)); } if (left.Properties.IsStartEdgeOnly && right.Properties.IsStartEdgeOnly) { if ((left.Properties.KeyComparer != null) && (right.Properties.KeyComparer != null) && (left.Properties.KeyComparer.ExpressionEquals(right.Properties.KeyComparer) && (typeof(TKey).GetPartitionType() == null))) { this.joinKind = JoinKind.IncreasingOrderEquiJoin; this.fallbackGenerator = (s, e, o) => new IncreasingOrderEquiJoinPipe <TKey, TLeft, TRight, TResult>(s, e, o); this.partitionedGenerator = null; this.columnarGenerator = (k => IncreasingOrderEquiJoinTemplate.Generate(this, this.Selector)); } else { this.joinKind = JoinKind.StartEdgeEquijoin; this.fallbackGenerator = (s, e, o) => new StartEdgeEquiJoinPipe <TKey, TLeft, TRight, TResult>(s, e, o); this.partitionedGenerator = (s, e, o) => (BinaryPipe <TKey, TLeft, TRight, TResult>)Activator.CreateInstance( typeof(PartitionedStartEdgeEquiJoinPipe <, , , ,>).MakeGenericType( typeof(TKey), typeof(TLeft), typeof(TRight), typeof(TResult), typeof(TKey).GetPartitionType()), s, e, o); this.columnarGenerator = (k => StartEdgeEquiJoinTemplate.Generate(this, this.Selector)); } } else { this.joinKind = JoinKind.EquiJoin; this.fallbackGenerator = (s, e, o) => new EquiJoinPipe <TKey, TLeft, TRight, TResult>(s, e, o); this.partitionedGenerator = (s, e, o) => (BinaryPipe <TKey, TLeft, TRight, TResult>)Activator.CreateInstance( CreatePartitionedEquiJoinType(), s, e, o); this.columnarGenerator = (k => EquiJoinTemplate.Generate(this, this.Selector)); } Initialize(); }
internal JoinClauseItem( FromClauseItem joinLeft, FromClauseItem joinRight, JoinKind joinKind, Node onExpr) { this._joinLeft = joinLeft; this._joinRight = joinRight; this.JoinKind = joinKind; this._onExpr = onExpr; }
private JoinEdge( AugmentedTableNode left, AugmentedTableNode right, AugmentedJoinNode joinNode, JoinKind joinKind, List <ColumnVar> leftVars, List <ColumnVar> rightVars) { m_left = left; m_right = right; JoinKind = joinKind; m_joinNode = joinNode; m_leftVars = leftVars; m_rightVars = rightVars; PlanCompiler.Assert(m_leftVars.Count == m_rightVars.Count, "Count mismatch: " + m_leftVars.Count + "," + m_rightVars.Count); }
private JoinEdge( AugmentedTableNode left, AugmentedTableNode right, AugmentedJoinNode joinNode, JoinKind joinKind, List<ColumnVar> leftVars, List<ColumnVar> rightVars) { m_left = left; m_right = right; JoinKind = joinKind; m_joinNode = joinNode; m_leftVars = leftVars; m_rightVars = rightVars; PlanCompiler.Assert(m_leftVars.Count == m_rightVars.Count, "Count mismatch: " + m_leftVars.Count + "," + m_rightVars.Count); }
public EquiJoinStreamable(IStreamable <TKey, TLeft> left, IStreamable <TKey, TRight> right, Expression <Func <TLeft, TRight, TResult> > selector) : base(left.Properties.Join(right.Properties, selector), left, right) { Contract.Requires(selector != null); this.Selector = selector; if (left.Properties.IsStartEdgeOnly && right.Properties.IsStartEdgeOnly) { if ((left.Properties.KeyComparer != null) && (right.Properties.KeyComparer != null) && left.Properties.KeyComparer.ExpressionEquals(right.Properties.KeyComparer) && (typeof(TKey).GetPartitionType() == null)) { this.joinKind = JoinKind.IncreasingOrderEquiJoin; this.fallbackGenerator = (s, e, o) => new IncreasingOrderEquiJoinPipe <TKey, TLeft, TRight, TResult>(s, e, o); this.partitionedGenerator = null; this.columnarGenerator = k => IncreasingOrderEquiJoinTemplate.Generate(this, this.Selector); } else { this.joinKind = JoinKind.StartEdgeEquijoin; this.fallbackGenerator = (s, e, o) => new StartEdgeEquiJoinPipe <TKey, TLeft, TRight, TResult>(s, e, o); this.partitionedGenerator = (s, e, o) => (BinaryPipe <TKey, TLeft, TRight, TResult>)Activator.CreateInstance( typeof(PartitionedStartEdgeEquiJoinPipe <, , , ,>).MakeGenericType( typeof(TKey), typeof(TLeft), typeof(TRight), typeof(TResult), typeof(TKey).GetPartitionType()), s, e, o); this.columnarGenerator = k => StartEdgeEquiJoinTemplate.Generate(this, this.Selector); } } else if (left.Properties.IsConstantDuration && right.Properties.IsConstantDuration) { this.joinKind = JoinKind.FixedIntervalEquiJoin; this.fallbackGenerator = (s, e, o) => new FixedIntervalEquiJoinPipe <TKey, TLeft, TRight, TResult>(s, e, o); this.partitionedGenerator = (s, e, o) => (BinaryPipe <TKey, TLeft, TRight, TResult>)Activator.CreateInstance( CreatePartitionedFixedIntervalEquiJoinType(), s, e, o); this.columnarGenerator = k => FixedIntervalEquiJoinTemplate.Generate(this, this.Selector); } else { this.joinKind = JoinKind.EquiJoin; this.fallbackGenerator = (s, e, o) => new EquiJoinPipe <TKey, TLeft, TRight, TResult>(s, e, o); this.partitionedGenerator = (s, e, o) => (BinaryPipe <TKey, TLeft, TRight, TResult>)Activator.CreateInstance( CreatePartitionedEquiJoinType(), s, e, o); this.columnarGenerator = k => EquiJoinTemplate.Generate(this, this.Selector); } Initialize(); }
public JoinTable(JoinTable referrer, ForeignKeyConstraint constraint, JoinDirection direction) { _joinBy = constraint; _joinDirection = direction; Table tbl = constraint.Table; _referrer = referrer; if (referrer == null) { _kind = JoinKind.Root; } else { _kind = referrer.Kind; if (_kind == JoinKind.Root) { _kind = JoinKind.Inner; } if (_kind != JoinKind.LeftOuter && _kind != JoinKind.FullOuter) { foreach (string c in constraint.Columns) { Column col = tbl.Columns[c]; if (!col.NotNull) { _kind = JoinKind.LeftOuter; break; } } } } switch (direction) { case JoinDirection.ReferFrom: _table = constraint.Table; ReferrerColumns = (string[])constraint.RefColumns.Clone(); JoinColumns = (string[])constraint.Columns.Clone(); break; case JoinDirection.ReferTo: _table = constraint.ReferenceConstraint.Table; ReferrerColumns = (string[])constraint.Columns.Clone(); JoinColumns = (string[])constraint.RefColumns.Clone(); break; default: throw new NotImplementedException(); } InitVisibleColumns(); }
private JoinEdge( AugmentedTableNode left, AugmentedTableNode right, AugmentedJoinNode joinNode, JoinKind joinKind, List <ColumnVar> leftVars, List <ColumnVar> rightVars) { this.m_left = left; this.m_right = right; this.JoinKind = joinKind; this.m_joinNode = joinNode; this.m_leftVars = leftVars; this.m_rightVars = rightVars; System.Data.Entity.Core.Query.PlanCompiler.PlanCompiler.Assert((this.m_leftVars.Count == this.m_rightVars.Count ? 1 : 0) != 0, "Count mismatch: " + (object)this.m_leftVars.Count + "," + (object)this.m_rightVars.Count); }
internal static JoinEdge CreateJoinEdge( AugmentedTableNode left, AugmentedTableNode right, AugmentedJoinNode joinNode, ColumnVar leftVar, ColumnVar rightVar) { List <ColumnVar> leftVars = new List <ColumnVar>(); List <ColumnVar> rightVars = new List <ColumnVar>(); leftVars.Add(leftVar); rightVars.Add(rightVar); OpType opType = joinNode.Node.Op.OpType; System.Data.Entity.Core.Query.PlanCompiler.PlanCompiler.Assert(opType == OpType.LeftOuterJoin || opType == OpType.InnerJoin, "Unexpected join type for join edge: " + (object)opType); JoinKind joinKind = opType == OpType.LeftOuterJoin ? JoinKind.LeftOuter : JoinKind.Inner; return(new JoinEdge(left, right, joinNode, joinKind, leftVars, rightVars)); }
// <summary> // Initializes join clause item without ON expression. // </summary> internal JoinClauseItem(FromClauseItem joinLeft, FromClauseItem joinRight, JoinKind joinKind) : this(joinLeft, joinRight, joinKind, null) { }
/// <summary> /// Initializes join clause item without ON expression. /// </summary> internal JoinClauseItem(FromClauseItem joinLeft, FromClauseItem joinRight, JoinKind joinKind) : this(joinLeft, joinRight, joinKind, null) { }
internal static Tuple <IIndex <a>, VectorConstruction, VectorConstruction> createJoinTransformation <a>(IIndexBuilder indexBuilder, IIndexBuilder otherIndexBuilder, JoinKind kind, Lookup lookup, IIndex <a> thisIndex, IIndex <a> otherIndex, VectorConstruction thisVector, VectorConstruction otherVector) { if ((lookup == Lookup.Exact ? 0 : (kind == JoinKind.Inner ? 1 : 0)) != 0) { throw new InvalidOperationException("Join/Zip - Inner join can only be used with Lookup.Exact."); } if ((lookup == Lookup.Exact ? 0 : (kind == JoinKind.Outer ? 1 : 0)) != 0) { throw new InvalidOperationException("Join/Zip - Outer join can only be used with Lookup.Exact."); } if (((!thisIndex.IsOrdered ? 0 : (otherIndex.IsOrdered ? 1 : 0)) != 0 ? 0 : (lookup != Lookup.Exact ? 1 : 0)) != 0) { throw new InvalidOperationException("Join/Zip - Lookup can be only used when joining/zipping ordered series/frames."); } JoinKind input = kind; Tuple <Tuple <VectorConstruction, VectorConstruction, IIndex <a>, IIndex <a>, FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> > > > >, JoinKind> tuple1 = MatchingHelpers.Let <Tuple <VectorConstruction, VectorConstruction, IIndex <a>, IIndex <a>, FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> > > > >, JoinKind>(new Tuple <VectorConstruction, VectorConstruction, IIndex <a>, IIndex <a>, FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> > > > >(thisVector, otherVector, thisIndex, otherIndex, (FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> > > >) new JoinHelpers.createJoinTransformation <a>()), input); IIndex <a> sourceIndex; VectorConstruction vector1; FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> > > > fsharpFunc1; IIndex <a> restriction; VectorConstruction vectorConstruction1; switch (tuple1.Item2) { case JoinKind.Left: VectorConstruction vectorConstruction2 = tuple1.Item1.Item1; IIndex <a> index1 = tuple1.Item1.Item3; FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> > > > fsharpFunc2 = tuple1.Item1.Item5; VectorConstruction vectorConstruction3 = tuple1.Item1.Item2; sourceIndex = tuple1.Item1.Item4; vector1 = vectorConstruction3; fsharpFunc1 = fsharpFunc2; restriction = index1; vectorConstruction1 = vectorConstruction2; break; default: Tuple <Tuple <VectorConstruction, VectorConstruction, IIndex <a>, IIndex <a>, FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> > > > >, JoinKind> tuple2 = MatchingHelpers.Let <Tuple <VectorConstruction, VectorConstruction, IIndex <a>, IIndex <a>, FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> > > > >, JoinKind>(new Tuple <VectorConstruction, VectorConstruction, IIndex <a>, IIndex <a>, FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> > > > >(thisVector, otherVector, thisIndex, otherIndex, (FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> > > >) new JoinHelpers.createJoinTransformation <a>()), input); switch (tuple2.Item2) { case JoinKind.Right: vectorConstruction1 = tuple2.Item1.Item2; restriction = tuple2.Item1.Item4; fsharpFunc1 = tuple2.Item1.Item5; vector1 = tuple2.Item1.Item1; sourceIndex = tuple2.Item1.Item3; break; default: switch (input) { case JoinKind.Outer: if ((!object.ReferenceEquals((object)thisIndex, (object)otherIndex) ? (LanguagePrimitives.HashCompare.GenericEqualityIntrinsic <IIndex <a> >((M0)thisIndex, (M0)otherIndex) ? 1 : 0) : 1) == 0) { goto default; } else { break; } case JoinKind.Inner: if ((!object.ReferenceEquals((object)thisIndex, (object)otherIndex) ? (LanguagePrimitives.HashCompare.GenericEqualityIntrinsic <IIndex <a> >((M0)thisIndex, (M0)otherIndex) ? 1 : 0) : 1) == 0) { goto default; } else { break; } default: switch (input) { case JoinKind.Outer: return(indexBuilder.Union <a>(new Tuple <IIndex <a>, VectorConstruction>(thisIndex, thisVector), new Tuple <IIndex <a>, VectorConstruction>(otherIndex, otherVector))); case JoinKind.Inner: return(indexBuilder.Intersect <a>(new Tuple <IIndex <a>, VectorConstruction>(thisIndex, thisVector), new Tuple <IIndex <a>, VectorConstruction>(otherIndex, otherVector))); default: throw new InvalidOperationException("Join/Zip - Invalid JoinKind value!"); } } return(new Tuple <IIndex <a>, VectorConstruction, VectorConstruction>(thisIndex, thisVector, otherVector)); } } if ((lookup != Lookup.Exact ? 0 : (object.ReferenceEquals((object)restriction, (object)sourceIndex) ? 1 : 0)) != 0) { return((Tuple <IIndex <a>, VectorConstruction, VectorConstruction>) FSharpFunc <IIndex <a>, VectorConstruction> .InvokeFast <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> >((FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <M0, M1> > >) fsharpFunc1, restriction, vectorConstruction1, (M0)vector1)); } Tuple <IIndex <a>, VectorConstruction> rowIndex = JoinHelpers.restrictToRowIndex <a>(lookup, restriction, sourceIndex, vector1); VectorConstruction vector2 = rowIndex.Item2; IIndex <a> index2 = rowIndex.Item1; if ((lookup != Lookup.Exact ? 0 : (LanguagePrimitives.HashCompare.GenericEqualityIntrinsic <IIndex <a> >((M0)restriction, (M0)index2) ? 1 : 0)) != 0) { return((Tuple <IIndex <a>, VectorConstruction, VectorConstruction>) FSharpFunc <IIndex <a>, VectorConstruction> .InvokeFast <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> >((FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <M0, M1> > >) fsharpFunc1, restriction, vectorConstruction1, (M0)vector2)); } VectorConstruction vectorConstruction4 = JoinHelpers.fillMissing(vector2, lookup); VectorConstruction vectorConstruction5 = otherIndexBuilder.Reindex <a>(index2, restriction, lookup, vectorConstruction4, (FSharpFunc <long, bool>) new JoinHelpers.otherRowCmd()); return((Tuple <IIndex <a>, VectorConstruction, VectorConstruction>) FSharpFunc <IIndex <a>, VectorConstruction> .InvokeFast <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> >((FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <M0, M1> > >) fsharpFunc1, restriction, vectorConstruction1, (M0)vectorConstruction5)); }
// <summary> // Creates a transitively generated join edge // </summary> // <param name="left"> the left table </param> // <param name="right"> the right table </param> // <param name="joinKind"> the join kind </param> // <param name="leftVars"> left equijoin vars </param> // <param name="rightVars"> right equijoin vars </param> // <returns> the join edge </returns> internal static JoinEdge CreateTransitiveJoinEdge( AugmentedTableNode left, AugmentedTableNode right, JoinKind joinKind, List<ColumnVar> leftVars, List<ColumnVar> rightVars) { var joinEdge = new JoinEdge(left, right, null, joinKind, leftVars, rightVars); return joinEdge; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { JoinKind k = (JoinKind)value; return((k == JoinKind.Root) ? Visibility.Collapsed : Visibility.Visible); }