Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataEntity / System / Data / Query / InternalTrees / PhysicalOps.cs / 3 / PhysicalOps.cs
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....], [....]
//---------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Data.Metadata.Edm;
using System.Diagnostics;
using System.Globalization;
using System.Data.Query.PlanCompiler;
using md = System.Data.Metadata.Edm;
namespace System.Data.Query.InternalTrees
{
///
/// A PhysicalProjectOp is a physical Op capping the entire command tree (and the
/// subtrees of CollectOps).
///
internal class PhysicalProjectOp : PhysicalOp
{
#region public methods
///
/// Instance for pattern matching in rules
///
internal static readonly PhysicalProjectOp Pattern = new PhysicalProjectOp();
///
/// Get the column map that describes how the result should be reshaped
///
internal SimpleCollectionColumnMap ColumnMap
{
get { return m_columnMap; }
}
///
/// Get the (ordered) list of output vars that this node produces
///
internal VarList Outputs
{
get { return m_outputVars; }
}
///
/// Visitor pattern method
///
/// The BasicOpVisitor that is visiting this Op
/// The Node that references this Op
[DebuggerNonUserCode]
internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); }
///
/// Visitor pattern method for visitors with a return value
///
/// The visitor
/// The node in question
/// An instance of TResultType
[DebuggerNonUserCode]
internal override TResultType Accept(BasicOpVisitorOfT v, Node n) { return v.Visit(this, n); }
#endregion
#region private constructors
///
/// basic constructor
///
/// List of outputs from this Op
/// column map that describes the result to be shaped
internal PhysicalProjectOp(VarList outputVars, SimpleCollectionColumnMap columnMap)
: this()
{
Debug.Assert(null != columnMap, "null columnMap?");
m_outputVars = outputVars;
m_columnMap = columnMap;
}
private PhysicalProjectOp()
: base(OpType.PhysicalProject)
{
}
#endregion
#region private state
private SimpleCollectionColumnMap m_columnMap;
private VarList m_outputVars;
#endregion
}
///
/// Represents information about one collection being managed by the NestOps.
/// The CollectionVar is a Var that represents the entire collection.
///
internal class CollectionInfo
{
#region public methods
///
/// The collection-var
///
internal Var CollectionVar
{
get { return m_collectionVar; }
}
///
/// the column map for the collection element
///
internal ColumnMap ColumnMap
{
get { return m_columnMap; }
}
///
/// list of vars describing the collection element; flattened to remove
/// nested collections
///
internal VarList FlattenedElementVars
{
get { return m_flattenedElementVars; }
}
///
/// list of keys specific to this collection
///
internal VarVec Keys
{
get { return m_keys; }
}
///
/// list of sort keys specific to this collection
///
internal List SortKeys
{
get { return m_sortKeys; }
}
///
/// Discriminator Value for this collection (for a given NestOp).
/// Should we break this out into a subtype of CollectionInfo
///
internal object DiscriminatorValue
{
get { return m_discriminatorValue; }
}
#endregion
#region constructors
internal CollectionInfo(Var collectionVar, ColumnMap columnMap, VarList flattenedElementVars, VarVec keys, List sortKeys, object discriminatorValue)
{
m_collectionVar = collectionVar;
m_columnMap = columnMap;
m_flattenedElementVars = flattenedElementVars;
m_keys = keys;
m_sortKeys = sortKeys;
m_discriminatorValue = discriminatorValue;
}
#endregion
#region private state
private Var m_collectionVar; // the collection Var
private ColumnMap m_columnMap; // column map for the collection element
private VarList m_flattenedElementVars; // elementVars, removing collections;
private VarVec m_keys; //list of keys specific to this collection
private List m_sortKeys; //list of sort keys specific to this collection
private object m_discriminatorValue;
#endregion
}
///
/// Base class for Nest operations
///
internal abstract class NestBaseOp : PhysicalOp
{
#region publics
///
/// (Ordered) list of prefix sort keys (defines ordering of results)
///
internal List PrefixSortKeys
{
get { return m_prefixSortKeys; }
}
///
/// Outputs of the NestOp. Includes the Keys obviously, and one Var for each of
/// the collections produced. In addition, this may also include non-key vars
/// from the outer row
///
internal VarVec Outputs
{
get { return m_outputs; }
}
///
/// Information about each collection managed by the NestOp
///
internal List CollectionInfo
{
get { return m_collectionInfoList; }
}
#endregion
#region constructors
internal NestBaseOp(OpType opType, List prefixSortKeys,
VarVec outputVars,
List collectionInfoList)
: base(opType)
{
m_outputs = outputVars;
m_collectionInfoList = collectionInfoList;
m_prefixSortKeys = prefixSortKeys;
}
#endregion
#region private state
private List m_prefixSortKeys; // list of sort key prefixes
private VarVec m_outputs; // list of all output vars
private List m_collectionInfoList;
#endregion
}
///
/// Single-stream nest aggregation Op.
/// (Somewhat similar to a group-by op - should we merge these?)
///
internal class SingleStreamNestOp : NestBaseOp
{
#region publics
///
/// 1 child - the input
///
internal override int Arity { get { return 1; } }
///
/// The discriminator Var (when there are multiple collections)
///
internal Var Discriminator
{
get { return m_discriminator; }
}
///
/// List of postfix sort keys (mostly to deal with multi-level nested collections)
///
internal List PostfixSortKeys
{
get { return m_postfixSortKeys; }
}
///
/// Set of keys for this nest operation
///
internal VarVec Keys
{
get { return m_keys; }
}
///
/// Visitor pattern method
///
/// The BasicOpVisitor that is visiting this Op
/// The Node that references this Op
[DebuggerNonUserCode]
internal override void Accept(BasicOpVisitor v, Node n)
{
v.Visit(this, n);
}
///
/// Visitor pattern method for visitors with a return value
///
/// The visitor
/// The node in question
/// An instance of TResultType
[DebuggerNonUserCode]
internal override TResultType Accept(BasicOpVisitorOfT v, Node n)
{
return v.Visit(this, n);
}
#endregion
#region constructors
internal SingleStreamNestOp(VarVec keys,
List prefixSortKeys, List postfixSortKeys,
VarVec outputVars, List collectionInfoList,
Var discriminatorVar)
: base(OpType.SingleStreamNest, prefixSortKeys, outputVars, collectionInfoList)
{
m_keys = keys;
m_postfixSortKeys = postfixSortKeys;
m_discriminator = discriminatorVar;
}
#endregion
#region private state
private VarVec m_keys; // keys for this operation
private Var m_discriminator; // Var describing the discriminator
List m_postfixSortKeys; // list of postfix sort keys
#endregion
}
///
/// Represents a multi-stream nest operation. The first input represents the
/// container row, while all the other inputs represent collections
///
internal class MultiStreamNestOp : NestBaseOp
{
#region publics
///
/// Visitor pattern method
///
/// The BasicOpVisitor that is visiting this Op
/// The Node that references this Op
[DebuggerNonUserCode]
internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); }
///
/// Visitor pattern method for visitors with a return value
///
/// The visitor
/// The node in question
/// An instance of TResultType
[DebuggerNonUserCode]
internal override TResultType Accept(BasicOpVisitorOfT v, Node n) { return v.Visit(this, n); }
#endregion
#region constructors
internal MultiStreamNestOp(List prefixSortKeys, VarVec outputVars,
List collectionInfoList)
: base(OpType.MultiStreamNest, prefixSortKeys, outputVars, collectionInfoList)
{
}
#endregion
#region private state
#endregion
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....], [....]
//---------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Data.Metadata.Edm;
using System.Diagnostics;
using System.Globalization;
using System.Data.Query.PlanCompiler;
using md = System.Data.Metadata.Edm;
namespace System.Data.Query.InternalTrees
{
///
/// A PhysicalProjectOp is a physical Op capping the entire command tree (and the
/// subtrees of CollectOps).
///
internal class PhysicalProjectOp : PhysicalOp
{
#region public methods
///
/// Instance for pattern matching in rules
///
internal static readonly PhysicalProjectOp Pattern = new PhysicalProjectOp();
///
/// Get the column map that describes how the result should be reshaped
///
internal SimpleCollectionColumnMap ColumnMap
{
get { return m_columnMap; }
}
///
/// Get the (ordered) list of output vars that this node produces
///
internal VarList Outputs
{
get { return m_outputVars; }
}
///
/// Visitor pattern method
///
/// The BasicOpVisitor that is visiting this Op
/// The Node that references this Op
[DebuggerNonUserCode]
internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); }
///
/// Visitor pattern method for visitors with a return value
///
/// The visitor
/// The node in question
/// An instance of TResultType
[DebuggerNonUserCode]
internal override TResultType Accept(BasicOpVisitorOfT v, Node n) { return v.Visit(this, n); }
#endregion
#region private constructors
///
/// basic constructor
///
/// List of outputs from this Op
/// column map that describes the result to be shaped
internal PhysicalProjectOp(VarList outputVars, SimpleCollectionColumnMap columnMap)
: this()
{
Debug.Assert(null != columnMap, "null columnMap?");
m_outputVars = outputVars;
m_columnMap = columnMap;
}
private PhysicalProjectOp()
: base(OpType.PhysicalProject)
{
}
#endregion
#region private state
private SimpleCollectionColumnMap m_columnMap;
private VarList m_outputVars;
#endregion
}
///
/// Represents information about one collection being managed by the NestOps.
/// The CollectionVar is a Var that represents the entire collection.
///
internal class CollectionInfo
{
#region public methods
///
/// The collection-var
///
internal Var CollectionVar
{
get { return m_collectionVar; }
}
///
/// the column map for the collection element
///
internal ColumnMap ColumnMap
{
get { return m_columnMap; }
}
///
/// list of vars describing the collection element; flattened to remove
/// nested collections
///
internal VarList FlattenedElementVars
{
get { return m_flattenedElementVars; }
}
///
/// list of keys specific to this collection
///
internal VarVec Keys
{
get { return m_keys; }
}
///
/// list of sort keys specific to this collection
///
internal List SortKeys
{
get { return m_sortKeys; }
}
///
/// Discriminator Value for this collection (for a given NestOp).
/// Should we break this out into a subtype of CollectionInfo
///
internal object DiscriminatorValue
{
get { return m_discriminatorValue; }
}
#endregion
#region constructors
internal CollectionInfo(Var collectionVar, ColumnMap columnMap, VarList flattenedElementVars, VarVec keys, List sortKeys, object discriminatorValue)
{
m_collectionVar = collectionVar;
m_columnMap = columnMap;
m_flattenedElementVars = flattenedElementVars;
m_keys = keys;
m_sortKeys = sortKeys;
m_discriminatorValue = discriminatorValue;
}
#endregion
#region private state
private Var m_collectionVar; // the collection Var
private ColumnMap m_columnMap; // column map for the collection element
private VarList m_flattenedElementVars; // elementVars, removing collections;
private VarVec m_keys; //list of keys specific to this collection
private List m_sortKeys; //list of sort keys specific to this collection
private object m_discriminatorValue;
#endregion
}
///
/// Base class for Nest operations
///
internal abstract class NestBaseOp : PhysicalOp
{
#region publics
///
/// (Ordered) list of prefix sort keys (defines ordering of results)
///
internal List PrefixSortKeys
{
get { return m_prefixSortKeys; }
}
///
/// Outputs of the NestOp. Includes the Keys obviously, and one Var for each of
/// the collections produced. In addition, this may also include non-key vars
/// from the outer row
///
internal VarVec Outputs
{
get { return m_outputs; }
}
///
/// Information about each collection managed by the NestOp
///
internal List CollectionInfo
{
get { return m_collectionInfoList; }
}
#endregion
#region constructors
internal NestBaseOp(OpType opType, List prefixSortKeys,
VarVec outputVars,
List collectionInfoList)
: base(opType)
{
m_outputs = outputVars;
m_collectionInfoList = collectionInfoList;
m_prefixSortKeys = prefixSortKeys;
}
#endregion
#region private state
private List m_prefixSortKeys; // list of sort key prefixes
private VarVec m_outputs; // list of all output vars
private List m_collectionInfoList;
#endregion
}
///
/// Single-stream nest aggregation Op.
/// (Somewhat similar to a group-by op - should we merge these?)
///
internal class SingleStreamNestOp : NestBaseOp
{
#region publics
///
/// 1 child - the input
///
internal override int Arity { get { return 1; } }
///
/// The discriminator Var (when there are multiple collections)
///
internal Var Discriminator
{
get { return m_discriminator; }
}
///
/// List of postfix sort keys (mostly to deal with multi-level nested collections)
///
internal List PostfixSortKeys
{
get { return m_postfixSortKeys; }
}
///
/// Set of keys for this nest operation
///
internal VarVec Keys
{
get { return m_keys; }
}
///
/// Visitor pattern method
///
/// The BasicOpVisitor that is visiting this Op
/// The Node that references this Op
[DebuggerNonUserCode]
internal override void Accept(BasicOpVisitor v, Node n)
{
v.Visit(this, n);
}
///
/// Visitor pattern method for visitors with a return value
///
/// The visitor
/// The node in question
/// An instance of TResultType
[DebuggerNonUserCode]
internal override TResultType Accept(BasicOpVisitorOfT v, Node n)
{
return v.Visit(this, n);
}
#endregion
#region constructors
internal SingleStreamNestOp(VarVec keys,
List prefixSortKeys, List postfixSortKeys,
VarVec outputVars, List collectionInfoList,
Var discriminatorVar)
: base(OpType.SingleStreamNest, prefixSortKeys, outputVars, collectionInfoList)
{
m_keys = keys;
m_postfixSortKeys = postfixSortKeys;
m_discriminator = discriminatorVar;
}
#endregion
#region private state
private VarVec m_keys; // keys for this operation
private Var m_discriminator; // Var describing the discriminator
List m_postfixSortKeys; // list of postfix sort keys
#endregion
}
///
/// Represents a multi-stream nest operation. The first input represents the
/// container row, while all the other inputs represent collections
///
internal class MultiStreamNestOp : NestBaseOp
{
#region publics
///
/// Visitor pattern method
///
/// The BasicOpVisitor that is visiting this Op
/// The Node that references this Op
[DebuggerNonUserCode]
internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); }
///
/// Visitor pattern method for visitors with a return value
///
/// The visitor
/// The node in question
/// An instance of TResultType
[DebuggerNonUserCode]
internal override TResultType Accept(BasicOpVisitorOfT v, Node n) { return v.Visit(this, n); }
#endregion
#region constructors
internal MultiStreamNestOp(List prefixSortKeys, VarVec outputVars,
List collectionInfoList)
: base(OpType.MultiStreamNest, prefixSortKeys, outputVars, collectionInfoList)
{
}
#endregion
#region private state
#endregion
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ScriptControl.cs
- DoubleAnimationUsingKeyFrames.cs
- TextParaClient.cs
- ValidationHelper.cs
- CompilerTypeWithParams.cs
- WebControlsSection.cs
- EnumerableWrapperWeakToStrong.cs
- TagMapInfo.cs
- TableDetailsRow.cs
- XmlUtil.cs
- LiteralControl.cs
- DataGridViewLinkCell.cs
- Timer.cs
- SelectedGridItemChangedEvent.cs
- SafeEventLogWriteHandle.cs
- StateDesigner.Helpers.cs
- ReadOnlyDictionary.cs
- RegistrySecurity.cs
- DynamicUpdateCommand.cs
- BufferedGraphics.cs
- ContextStack.cs
- TerminatorSinks.cs
- XmlSerializer.cs
- SchemaObjectWriter.cs
- Semaphore.cs
- Normalizer.cs
- NullableIntAverageAggregationOperator.cs
- SqlWebEventProvider.cs
- _Rfc2616CacheValidators.cs
- SqlNotificationEventArgs.cs
- WorkflowRuntimeEndpoint.cs
- Drawing.cs
- CodeCatchClause.cs
- TimersDescriptionAttribute.cs
- EncryptedPackageFilter.cs
- ConfigXmlSignificantWhitespace.cs
- MobileErrorInfo.cs
- mediaeventargs.cs
- AspCompat.cs
- TimeEnumHelper.cs
- UpdateManifestForBrowserApplication.cs
- CodeSnippetTypeMember.cs
- ValidationEventArgs.cs
- Animatable.cs
- NativeMethods.cs
- PrimaryKeyTypeConverter.cs
- DeleteWorkflowOwnerCommand.cs
- AncillaryOps.cs
- DataKeyCollection.cs
- CalendarKeyboardHelper.cs
- Activator.cs
- ScrollContentPresenter.cs
- loginstatus.cs
- ReadOnlyDictionary.cs
- WrapPanel.cs
- FrugalMap.cs
- Visual3DCollection.cs
- ProtocolsConfigurationHandler.cs
- OleDbSchemaGuid.cs
- CalloutQueueItem.cs
- BamlResourceDeserializer.cs
- StorageComplexTypeMapping.cs
- GeneralTransformGroup.cs
- ExtensionSimplifierMarkupObject.cs
- KeyedQueue.cs
- KeyConstraint.cs
- FullTextBreakpoint.cs
- SQLGuid.cs
- LambdaCompiler.Logical.cs
- ExceptionValidationRule.cs
- Command.cs
- _NetworkingPerfCounters.cs
- CalendarDateChangedEventArgs.cs
- TemplateControlCodeDomTreeGenerator.cs
- SelectionRangeConverter.cs
- StatusBar.cs
- ViewEventArgs.cs
- TdsParserStateObject.cs
- CharAnimationBase.cs
- UdpRetransmissionSettings.cs
- ComponentSerializationService.cs
- PropertyGridCommands.cs
- HyperLinkColumn.cs
- SafePEFileHandle.cs
- HtmlLink.cs
- MailHeaderInfo.cs
- ScrollViewerAutomationPeer.cs
- ToolBarButton.cs
- ImportContext.cs
- SafeRightsManagementPubHandle.cs
- InkCanvasSelectionAdorner.cs
- AlternateView.cs
- AudioFormatConverter.cs
- DataControlFieldTypeEditor.cs
- AuthStoreRoleProvider.cs
- RoleServiceManager.cs
- UIElementIsland.cs
- TimerEventSubscription.cs
- CqlIdentifiers.cs
- _ShellExpression.cs