本文整理汇总了C#中VarVec.Or方法的典型用法代码示例。如果您正苦于以下问题:C# VarVec.Or方法的具体用法?C# VarVec.Or怎么用?C# VarVec.Or使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VarVec
的用法示例。
在下文中一共展示了VarVec.Or方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertToNestOpInput
// <summary>
// Convert a CollectOp subtree (when used as the defining expression for a
// VarDefOp) into a reasonable input to a NestOp.
// </summary>
// <remarks>
// There are a couple of cases that we handle here:
// (a) PhysicalProject(X) ==> X
// (b) PhysicalProject(Sort(X)) ==> Sort(X)
// </remarks>
// <param name="physicalProjectNode"> the child of the CollectOp </param>
// <param name="collectionVar"> the collectionVar being defined </param>
// <param name="collectionInfoList"> where to append the new collectionInfo </param>
// <param name="collectionNodes"> where to append the collectionNode </param>
// <param name="externalReferences"> a bit vector of external references of the physicalProject </param>
// <param name="collectionReferences"> a bit vector of collection vars </param>
private void ConvertToNestOpInput(
Node physicalProjectNode, Var collectionVar, List<CollectionInfo> collectionInfoList, List<Node> collectionNodes,
VarVec externalReferences, VarVec collectionReferences)
{
// Keep track of any external references the physicalProjectOp has
externalReferences.Or(Command.GetNodeInfo(physicalProjectNode).ExternalReferences);
// Case: (a) PhysicalProject(X) ==> X
var nestOpInput = physicalProjectNode.Child0;
// Now build the collectionInfo for this input, including the flattened
// list of vars, which is essentially the outputs from the physicalProject
// with the sortKey vars that aren't already in the outputs we already
// have.
var physicalProjectOp = (PhysicalProjectOp)physicalProjectNode.Op;
var flattenedElementVarList = Command.CreateVarList(physicalProjectOp.Outputs);
var flattenedElementVarVec = Command.CreateVarVec(flattenedElementVarList); // Use a VarVec to make the lookups faster
List<SortKey> sortKeys = null;
if (OpType.Sort
== nestOpInput.Op.OpType)
{
// Case: (b) PhysicalProject(Sort(X)) ==> Sort(X)
var sortOp = (SortOp)nestOpInput.Op;
sortKeys = OpCopier.Copy(Command, sortOp.Keys);
foreach (var sk in sortKeys)
{
if (!flattenedElementVarVec.IsSet(sk.Var))
{
flattenedElementVarList.Add(sk.Var);
flattenedElementVarVec.Set(sk.Var);
}
}
}
else
{
sortKeys = new List<SortKey>();
}
// Get the keys for the collection
var keyVars = Command.GetExtendedNodeInfo(nestOpInput).Keys.KeyVars;
//Check whether all key are projected
var keyVarsClone = keyVars.Clone();
keyVarsClone.Minus(flattenedElementVarVec);
var keys = (keyVarsClone.IsEmpty) ? keyVars.Clone() : Command.CreateVarVec();
// Create the collectionInfo
var collectionInfo = Command.CreateCollectionInfo(
collectionVar, physicalProjectOp.ColumnMap.Element, flattenedElementVarList, keys, sortKeys, null /*discriminatorValue*/);
// Now update the collections we're tracking.
collectionInfoList.Add(collectionInfo);
collectionNodes.Add(nestOpInput);
collectionReferences.Set(collectionVar);
}