// effects: Determines if the childNode can be added as a child of the // groupNode using te operation "opTypeToIsolate". E.g., if // opTypeToIsolate is inner join, we can add child to group node if // childNode and groupNode have the same multiconstantsets, i.e., they have // the same selection condition // Modifies groupNode to contain groupNode at the appropriate // position (for LOJs, the child could be added to the beginning) private bool TryAddChildToGroup( CellTreeOpType opTypeToIsolate, CellTreeNode childNode, OpCellTreeNode groupNode) { switch (opTypeToIsolate) { case CellTreeOpType.IJ: // For Inner join, the constants of the node and // the child must be the same, i.e., if the cells // are producing exactly same tuples (same selection) if (IsEquivalentTo(childNode, groupNode)) { groupNode.Add(childNode); return(true); } break; case CellTreeOpType.LOJ: // If one cell's selection condition subsumes // another, we can use LOJ. We need to check for // "subsumes" on both sides if (IsContainedIn(childNode, groupNode)) { groupNode.Add(childNode); return(true); } else if (IsContainedIn(groupNode, childNode)) { // child subsumes the whole group -- add it first groupNode.AddFirst(childNode); return(true); } break; case CellTreeOpType.Union: // If the selection conditions are disjoint, we can use UNION ALL // We cannot use active domain here; disjointness is guaranteed only // if we check the entire selection domain if (IsDisjoint(childNode, groupNode)) { groupNode.Add(childNode); return(true); } break; } return(false); }
private bool TryAddChildToGroup( CellTreeOpType opTypeToIsolate, CellTreeNode childNode, OpCellTreeNode groupNode) { switch (opTypeToIsolate) { case CellTreeOpType.Union: if (this.IsDisjoint(childNode, (CellTreeNode)groupNode)) { groupNode.Add(childNode); return(true); } break; case CellTreeOpType.LOJ: if (this.IsContainedIn(childNode, (CellTreeNode)groupNode)) { groupNode.Add(childNode); return(true); } if (this.IsContainedIn((CellTreeNode)groupNode, childNode)) { groupNode.AddFirst(childNode); return(true); } break; case CellTreeOpType.IJ: if (this.IsEquivalentTo(childNode, (CellTreeNode)groupNode)) { groupNode.Add(childNode); return(true); } break; } return(false); }
// effects: Determines if the childNode can be added as a child of the // groupNode using te operation "opTypeToIsolate". E.g., if // opTypeToIsolate is inner join, we can add child to group node if // childNode and groupNode have the same multiconstantsets, i.e., they have // the same selection condition // Modifies groupNode to contain groupNode at the appropriate // position (for LOJs, the child could be added to the beginning) private bool TryAddChildToGroup( CellTreeOpType opTypeToIsolate, CellTreeNode childNode, OpCellTreeNode groupNode) { switch (opTypeToIsolate) { case CellTreeOpType.IJ: // For Inner join, the constants of the node and // the child must be the same, i.e., if the cells // are producing exactly same tuples (same selection) if (IsEquivalentTo(childNode, groupNode)) { groupNode.Add(childNode); return true; } break; case CellTreeOpType.LOJ: // If one cell's selection condition subsumes // another, we can use LOJ. We need to check for // "subsumes" on both sides if (IsContainedIn(childNode, groupNode)) { groupNode.Add(childNode); return true; } else if (IsContainedIn(groupNode, childNode)) { // child subsumes the whole group -- add it first groupNode.AddFirst(childNode); return true; } break; case CellTreeOpType.Union: // If the selection conditions are disjoint, we can use UNION ALL // We cannot use active domain here; disjointness is guaranteed only // if we check the entire selection domain if (IsDisjoint(childNode, groupNode)) { groupNode.Add(childNode); return true; } break; } return false; }