private void RunAssertionQueryPlan3Stream(EPServiceProvider epService) { var epl = "select * from S0 as s0 unidirectional, S1#keepall, S2#keepall "; // 3-stream join with in-multiindex directional var planInMidx = new InKeywordTableLookupPlanMultiIdx( 0, 1, GetIndexKeys("i1a", "i1b"), SupportExprNodeFactory.MakeIdentExprNode("P00")); TryAssertion( epService, epl + " where P00 in (P10, P11)", SupportQueryPlanBuilder.Start(3) .AddIndexHashSingleNonUnique(1, "i1a", "P10") .AddIndexHashSingleNonUnique(1, "i1b", "P11") .SetIndexFullTableScan(2, "i2") .SetLookupPlanInstruction( 0, "s0", new[] { new LookupInstructionPlan( 0, "s0", new[] {1}, new TableLookupPlan[] {planInMidx}, null, new bool[3]), new LookupInstructionPlan( 0, "s0", new[] {2}, new TableLookupPlan[] {new FullTableScanLookupPlan(1, 2, GetIndexKey("i2"))}, null, new bool[3]) }) .Get()); var planInMidxMulitiSrc = new InKeywordTableLookupPlanMultiIdx( 0, 1, GetIndexKeys("i1", "i2"), SupportExprNodeFactory.MakeIdentExprNode("P00")); TryAssertion( epService, epl + " where P00 in (P10, P20)", SupportQueryPlanBuilder.Start(3) .SetIndexFullTableScan(1, "i1") .SetIndexFullTableScan(2, "i2") .SetLookupPlanInstruction( 0, "s0", new[] { new LookupInstructionPlan( 0, "s0", new[] {1}, new TableLookupPlan[] {new FullTableScanLookupPlan(0, 1, GetIndexKey("i1"))}, null, new bool[3]), new LookupInstructionPlan( 0, "s0", new[] {2}, new TableLookupPlan[] {new FullTableScanLookupPlan(1, 2, GetIndexKey("i2"))}, null, new bool[3]) }) .Get()); // 3-stream join with in-singleindex directional var planInSidx = new InKeywordTableLookupPlanSingleIdx( 0, 1, GetIndexKey("i1"), SupportExprNodeFactory.MakeIdentExprNodes("P00", "P01")); TryAssertion(epService, epl + " where P10 in (P00, P01)", GetSingleIndexPlan(planInSidx)); // 3-stream join with in-singleindex multi-sourced var planInSingleMultiSrc = new InKeywordTableLookupPlanSingleIdx( 0, 1, GetIndexKey("i1"), SupportExprNodeFactory.MakeIdentExprNodes("P00")); TryAssertion(epService, epl + " where P10 in (P00, P20)", GetSingleIndexPlan(planInSingleMultiSrc)); }
public void TestQueryPlan3Stream() { var epl = "select * from S0 as s0 unidirectional, S1.win:keepall(), S2.win:keepall() "; // 3-stream join with in-multiindex directional var planInMidx = new InKeywordTableLookupPlanMultiIdx(0, 1, GetIndexKeys("i1a", "i1b"), SupportExprNodeFactory.MakeIdentExprNode("p00")); RunAssertion(epl + " where p00 in (p10, p11)", SupportQueryPlanBuilder.Start(3) .AddIndexHashSingleNonUnique(1, "i1a", "p10") .AddIndexHashSingleNonUnique(1, "i1b", "p11") .SetIndexFullTableScan(2, "i2") .SetLookupPlanInstruction(0, "s0", new LookupInstructionPlan[] { new LookupInstructionPlan(0, "s0", new int[] { 1 }, new TableLookupPlan[] { planInMidx }, null, new bool[3]), new LookupInstructionPlan(0, "s0", new int[] { 2 }, new TableLookupPlan[] { new FullTableScanLookupPlan(1, 2, GetIndexKey("i2")) }, null, new bool[3]) }) .Get()); var planInMidxMulitiSrc = new InKeywordTableLookupPlanMultiIdx(0, 1, GetIndexKeys("i1", "i2"), SupportExprNodeFactory.MakeIdentExprNode("p00")); RunAssertion(epl + " where p00 in (p10, p20)", SupportQueryPlanBuilder.Start(3) .SetIndexFullTableScan(1, "i1") .SetIndexFullTableScan(2, "i2") .SetLookupPlanInstruction(0, "s0", new LookupInstructionPlan[] { new LookupInstructionPlan(0, "s0", new int[] { 1 }, new TableLookupPlan[] { new FullTableScanLookupPlan(0, 1, GetIndexKey("i1")) }, null, new bool[3]), new LookupInstructionPlan(0, "s0", new int[] { 2 }, new TableLookupPlan[] { new FullTableScanLookupPlan(1, 2, GetIndexKey("i2")) }, null, new bool[3]) }) .Get()); // 3-stream join with in-singleindex directional var planInSidx = new InKeywordTableLookupPlanSingleIdx(0, 1, GetIndexKey("i1"), SupportExprNodeFactory.MakeIdentExprNodes("p00", "p01")); RunAssertion(epl + " where p10 in (p00, p01)", GetSingleIndexPlan(planInSidx)); // 3-stream join with in-singleindex multi-sourced var planInSingleMultiSrc = new InKeywordTableLookupPlanSingleIdx(0, 1, GetIndexKey("i1"), SupportExprNodeFactory.MakeIdentExprNodes("p00")); RunAssertion(epl + " where p10 in (p00, p20)", GetSingleIndexPlan(planInSingleMultiSrc)); }