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));
        }
Пример #2
0
        public void TestQueryPlan2Stream()
        {
            var epl           = "select * from S0 as s0 unidirectional, S1.win:keepall() ";
            var fullTableScan = SupportQueryPlanBuilder.Start(2)
                                .SetIndexFullTableScan(1, "a")
                                .SetLookupPlanInner(0, new FullTableScanLookupPlan(0, 1, GetIndexKey("a"))).Get();

            // 2-stream unidirectional joins
            RunAssertion(epl, fullTableScan);

            var planEquals = SupportQueryPlanBuilder.Start(2)
                             .AddIndexHashSingleNonUnique(1, "a", "p10")
                             .SetLookupPlanInner(0, new IndexedTableLookupPlanSingle(0, 1, GetIndexKey("a"), SupportExprNodeFactory.MakeKeyed("p00"))).Get();

            RunAssertion(epl + "where p00 = p10", planEquals);
            RunAssertion(epl + "where p00 = p10 and p00 in (p11, p12, p13)", planEquals);

            var planInMultiInner = SupportQueryPlanBuilder.Start(2)
                                   .AddIndexHashSingleNonUnique(1, "a", "p11")
                                   .AddIndexHashSingleNonUnique(1, "b", "p12")
                                   .SetLookupPlanInner(0, new InKeywordTableLookupPlanMultiIdx(0, 1, GetIndexKeys("a", "b"), SupportExprNodeFactory.MakeIdentExprNode("p00"))).Get();

            RunAssertion(epl + "where p00 in (p11, p12)", planInMultiInner);
            RunAssertion(epl + "where p00 = p11 or p00 = p12", planInMultiInner);

            var planInMultiOuter = SupportQueryPlanBuilder.Start(planInMultiInner)
                                   .SetLookupPlanOuter(0, new InKeywordTableLookupPlanMultiIdx(0, 1, GetIndexKeys("a", "b"), SupportExprNodeFactory.MakeIdentExprNode("p00"))).Get();
            var eplOuterJoin = "select * from S0 as s0 unidirectional full outer join S1.win:keepall() ";

            RunAssertion(eplOuterJoin + "where p00 in (p11, p12)", planInMultiOuter);

            var planInMultiWConst = SupportQueryPlanBuilder.Start(2)
                                    .AddIndexHashSingleNonUnique(1, "a", "p11")
                                    .AddIndexHashSingleNonUnique(1, "b", "p12")
                                    .SetLookupPlanInner(0, new InKeywordTableLookupPlanMultiIdx(0, 1, GetIndexKeys("a", "b"), SupportExprNodeFactory.MakeConstExprNode("A"))).Get();

            RunAssertion(epl + "where 'A' in (p11, p12)", planInMultiWConst);
            RunAssertion(epl + "where 'A' = p11 or 'A' = p12", planInMultiWConst);

            var planInMultiWAddConst = SupportQueryPlanBuilder.Start(2)
                                       .AddIndexHashSingleNonUnique(1, "a", "p12")
                                       .SetLookupPlanInner(0, new InKeywordTableLookupPlanMultiIdx(0, 1, GetIndexKeys("a"), SupportExprNodeFactory.MakeConstExprNode("A"))).Get();

            RunAssertion(epl + "where 'A' in ('B', p12)", planInMultiWAddConst);
            RunAssertion(epl + "where 'A' in ('B', 'C')", fullTableScan);

            var planInSingle = SupportQueryPlanBuilder.Start(2)
                               .AddIndexHashSingleNonUnique(1, "a", "p10")
                               .SetLookupPlanInner(0, new InKeywordTableLookupPlanSingleIdx(0, 1, GetIndexKey("a"), SupportExprNodeFactory.MakeIdentExprNodes("p00", "p01"))).Get();

            RunAssertion(epl + "where p10 in (p00, p01)", planInSingle);

            var planInSingleWConst = SupportQueryPlanBuilder.Start(2)
                                     .AddIndexHashSingleNonUnique(1, "a", "p10")
                                     .SetLookupPlanInner(0, new InKeywordTableLookupPlanSingleIdx(0, 1, GetIndexKey("a"), SupportExprNodeFactory.MakeConstAndIdentNode("A", "p01"))).Get();

            RunAssertion(epl + "where p10 in ('A', p01)", planInSingleWConst);

            var planInSingleJustConst = SupportQueryPlanBuilder.Start(2)
                                        .AddIndexHashSingleNonUnique(1, "a", "p10")
                                        .SetLookupPlanInner(0, new InKeywordTableLookupPlanSingleIdx(0, 1, GetIndexKey("a"), SupportExprNodeFactory.MakeConstAndConstNode("A", "B"))).Get();

            RunAssertion(epl + "where p10 in ('A', 'B')", planInSingleJustConst);
        }
Пример #3
0
        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));
        }
        private void RunAssertionQueryPlan2Stream(EPServiceProvider epService)
        {
            var epl = "select * from S0 as s0 unidirectional, S1#keepall ";
            var fullTableScan = SupportQueryPlanBuilder.Start(2)
                .SetIndexFullTableScan(1, "a")
                .SetLookupPlanInner(0, new FullTableScanLookupPlan(0, 1, GetIndexKey("a")))
                .Get();

            // 2-stream unidirectional joins
            TryAssertion(epService, epl, fullTableScan);

            var planEquals = SupportQueryPlanBuilder.Start(2)
                .AddIndexHashSingleNonUnique(1, "a", "P10")
                .SetLookupPlanInner(
                    0,
                    new IndexedTableLookupPlanSingle(0, 1, GetIndexKey("a"), SupportExprNodeFactory.MakeKeyed("P00")))
                .Get();
            TryAssertion(epService, epl + "where P00 = P10", planEquals);
            TryAssertion(epService, epl + "where P00 = P10 and P00 in (P11, P12, P13)", planEquals);

            var planInMultiInner = SupportQueryPlanBuilder.Start(2)
                .AddIndexHashSingleNonUnique(1, "a", "P11")
                .AddIndexHashSingleNonUnique(1, "b", "P12")
                .SetLookupPlanInner(
                    0,
                    new InKeywordTableLookupPlanMultiIdx(
                        0, 1, GetIndexKeys("a", "b"), SupportExprNodeFactory.MakeIdentExprNode("P00")))
                .Get();
            TryAssertion(epService, epl + "where P00 in (P11, P12)", planInMultiInner);
            TryAssertion(epService, epl + "where P00 = P11 or P00 = P12", planInMultiInner);

            var planInMultiOuter = SupportQueryPlanBuilder.Start(planInMultiInner)
                .SetLookupPlanOuter(
                    0,
                    new InKeywordTableLookupPlanMultiIdx(
                        0, 1, GetIndexKeys("a", "b"), SupportExprNodeFactory.MakeIdentExprNode("P00")))
                .Get();
            var eplOuterJoin = "select * from S0 as s0 unidirectional full outer join S1#keepall ";
            TryAssertion(epService, eplOuterJoin + "where P00 in (P11, P12)", planInMultiOuter);

            var planInMultiWConst = SupportQueryPlanBuilder.Start(2)
                .AddIndexHashSingleNonUnique(1, "a", "P11")
                .AddIndexHashSingleNonUnique(1, "b", "P12")
                .SetLookupPlanInner(
                    0,
                    new InKeywordTableLookupPlanMultiIdx(
                        0, 1, GetIndexKeys("a", "b"), SupportExprNodeFactory.MakeConstExprNode("A")))
                .Get();
            TryAssertion(epService, epl + "where 'A' in (P11, P12)", planInMultiWConst);
            TryAssertion(epService, epl + "where 'A' = P11 or 'A' = P12", planInMultiWConst);

            var planInMultiWAddConst = SupportQueryPlanBuilder.Start(2)
                .AddIndexHashSingleNonUnique(1, "a", "P12")
                .SetLookupPlanInner(
                    0,
                    new InKeywordTableLookupPlanMultiIdx(
                        0, 1, GetIndexKeys("a"), SupportExprNodeFactory.MakeConstExprNode("A")))
                .Get();
            TryAssertion(epService, epl + "where 'A' in ('B', P12)", planInMultiWAddConst);
            TryAssertion(epService, epl + "where 'A' in ('B', 'C')", fullTableScan);

            var planInSingle = SupportQueryPlanBuilder.Start(2)
                .AddIndexHashSingleNonUnique(1, "a", "P10")
                .SetLookupPlanInner(
                    0,
                    new InKeywordTableLookupPlanSingleIdx(
                        0, 1, GetIndexKey("a"), SupportExprNodeFactory.MakeIdentExprNodes("P00", "P01")))
                .Get();
            TryAssertion(epService, epl + "where P10 in (P00, P01)", planInSingle);

            var planInSingleWConst = SupportQueryPlanBuilder.Start(2)
                .AddIndexHashSingleNonUnique(1, "a", "P10")
                .SetLookupPlanInner(
                    0,
                    new InKeywordTableLookupPlanSingleIdx(
                        0, 1, GetIndexKey("a"), SupportExprNodeFactory.MakeConstAndIdentNode("A", "P01")))
                .Get();
            TryAssertion(epService, epl + "where P10 in ('A', P01)", planInSingleWConst);

            var planInSingleJustConst = SupportQueryPlanBuilder.Start(2)
                .AddIndexHashSingleNonUnique(1, "a", "P10")
                .SetLookupPlanInner(
                    0,
                    new InKeywordTableLookupPlanSingleIdx(
                        0, 1, GetIndexKey("a"), SupportExprNodeFactory.MakeConstAndConstNode("A", "B")))
                .Get();
            TryAssertion(epService, epl + "where P10 in ('A', 'B')", planInSingleJustConst);
        }
Пример #5
0
 public void Run(RegressionEnvironment env)
 {
     var types = new EventType[2];
     var epl = "select * from SupportBean_S0 as S0 unidirectional, SupportBean_S1#keepall ";
     var fullTableScan = SupportQueryPlanBuilder.Start(2)
         .SetIndexFullTableScan(1, "a")
         .SetLookupPlanInner(0, new FullTableScanLookupPlanForge(0, 1, false, types, GetIndexKey("a")))
         .Get();
     // 2-stream unidirectional joins
     TryAssertion(env, epl, fullTableScan);
     var planEquals = SupportQueryPlanBuilder.Start(2)
         .AddIndexHashSingleNonUnique(1, "a", "P10")
         .SetLookupPlanInner(
             0,
             new IndexedTableLookupPlanHashedOnlyForge(
                 0,
                 1,
                 false,
                 types,
                 GetIndexKey("a"),
                 new[] {SupportExprNodeFactory.MakeKeyed("P00")},
                 null,
                 null,
                 null))
         .Get();
     TryAssertion(env, epl + "where P00 = P10", planEquals);
     TryAssertion(env, epl + "where P00 = P10 and P00 in (P11, P12, P13)", planEquals);
     var planInMultiInner = SupportQueryPlanBuilder.Start(2)
         .AddIndexHashSingleNonUnique(1, "a", "P11")
         .AddIndexHashSingleNonUnique(1, "b", "P12")
         .SetLookupPlanInner(
             0,
             new InKeywordTableLookupPlanMultiIdxForge(0, 1, false, types, GetIndexKeys("a", "b"), SupportExprNodeFactory.MakeIdentExprNode("P00")))
         .Get();
     TryAssertion(env, epl + "where P00 in (P11, P12)", planInMultiInner);
     TryAssertion(env, epl + "where P00 = P11 or P00 = P12", planInMultiInner);
     var planInMultiOuter = SupportQueryPlanBuilder.Start(planInMultiInner)
         .SetLookupPlanOuter(
             0,
             new InKeywordTableLookupPlanMultiIdxForge(0, 1, false, types, GetIndexKeys("a", "b"), SupportExprNodeFactory.MakeIdentExprNode("P00")))
         .Get();
     var eplOuterJoin = "select * from SupportBean_S0 as S0 unidirectional full outer join SupportBean_S1#keepall ";
     TryAssertion(env, eplOuterJoin + "where P00 in (P11, P12)", planInMultiOuter);
     var planInMultiWConst = SupportQueryPlanBuilder.Start(2)
         .AddIndexHashSingleNonUnique(1, "a", "P11")
         .AddIndexHashSingleNonUnique(1, "b", "P12")
         .SetLookupPlanInner(
             0,
             new InKeywordTableLookupPlanMultiIdxForge(0, 1, false, types, GetIndexKeys("a", "b"), SupportExprNodeFactory.MakeConstExprNode("A")))
         .Get();
     TryAssertion(env, epl + "where 'A' in (P11, P12)", planInMultiWConst);
     TryAssertion(env, epl + "where 'A' = P11 or 'A' = P12", planInMultiWConst);
     var planInMultiWAddConst = SupportQueryPlanBuilder.Start(2)
         .AddIndexHashSingleNonUnique(1, "a", "P12")
         .SetLookupPlanInner(
             0,
             new InKeywordTableLookupPlanMultiIdxForge(0, 1, false, types, GetIndexKeys("a"), SupportExprNodeFactory.MakeConstExprNode("A")))
         .Get();
     TryAssertion(env, epl + "where 'A' in ('B', P12)", planInMultiWAddConst);
     TryAssertion(env, epl + "where 'A' in ('B', 'C')", fullTableScan);
     var planInSingle = SupportQueryPlanBuilder.Start(2)
         .AddIndexHashSingleNonUnique(1, "a", "P10")
         .SetLookupPlanInner(
             0,
             new InKeywordTableLookupPlanSingleIdxForge(
                 0,
                 1,
                 false,
                 types,
                 GetIndexKey("a"),
                 SupportExprNodeFactory.MakeIdentExprNodes("P00", "P01")))
         .Get();
     TryAssertion(env, epl + "where P10 in (P00, P01)", planInSingle);
     var planInSingleWConst = SupportQueryPlanBuilder.Start(2)
         .AddIndexHashSingleNonUnique(1, "a", "P10")
         .SetLookupPlanInner(
             0,
             new InKeywordTableLookupPlanSingleIdxForge(
                 0,
                 1,
                 false,
                 types,
                 GetIndexKey("a"),
                 SupportExprNodeFactory.MakeConstAndIdentNode("A", "P01")))
         .Get();
     TryAssertion(env, epl + "where P10 in ('A', P01)", planInSingleWConst);
     var planInSingleJustConst = SupportQueryPlanBuilder.Start(2)
         .AddIndexHashSingleNonUnique(1, "a", "P10")
         .SetLookupPlanInner(
             0,
             new InKeywordTableLookupPlanSingleIdxForge(
                 0,
                 1,
                 false,
                 types,
                 GetIndexKey("a"),
                 SupportExprNodeFactory.MakeConstAndConstNode("A", "B")))
         .Get();
     TryAssertion(env, epl + "where P10 in ('A', 'B')", planInSingleJustConst);
 }
Пример #6
0
 public void Run(RegressionEnvironment env)
 {
     var types = new EventType[3];
     var epl = "@Name('s0') select * from SupportBean_S0 as S0 unidirectional, SupportBean_S1#keepall, SupportBean_S2#keepall ";
     // 3-stream join with in-multiindex directional
     var planInMidx = new InKeywordTableLookupPlanMultiIdxForge(
         0,
         1,
         false,
         types,
         GetIndexKeys("i1a", "i1b"),
         SupportExprNodeFactory.MakeIdentExprNode("P00"));
     TryAssertion(
         env,
         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 LookupInstructionPlanForge(0, "S0", new[] {1}, new TableLookupPlanForge[] {planInMidx}, null, new bool[3]),
                     new LookupInstructionPlanForge(
                         0,
                         "S0",
                         new[] {2},
                         new TableLookupPlanForge[] {new FullTableScanLookupPlanForge(1, 2, false, types, GetIndexKey("i2"))},
                         null,
                         new bool[3])
                 })
             .Get());
     var planInMidxMulitiSrc = new InKeywordTableLookupPlanMultiIdxForge(
         0,
         1,
         false,
         types,
         GetIndexKeys("i1", "i2"),
         SupportExprNodeFactory.MakeIdentExprNode("P00"));
     TryAssertion(
         env,
         epl + " where P00 in (P10, P20)",
         SupportQueryPlanBuilder.Start(3)
             .SetIndexFullTableScan(1, "i1")
             .SetIndexFullTableScan(2, "i2")
             .SetLookupPlanInstruction(
                 0,
                 "S0",
                 new[] {
                     new LookupInstructionPlanForge(
                         0,
                         "S0",
                         new[] {1},
                         new TableLookupPlanForge[] {new FullTableScanLookupPlanForge(0, 1, false, types, GetIndexKey("i1"))},
                         null,
                         new bool[3]),
                     new LookupInstructionPlanForge(
                         0,
                         "S0",
                         new[] {2},
                         new TableLookupPlanForge[] {new FullTableScanLookupPlanForge(1, 2, false, types, GetIndexKey("i2"))},
                         null,
                         new bool[3])
                 })
             .Get());
     // 3-stream join with in-singleindex directional
     var planInSidx = new InKeywordTableLookupPlanSingleIdxForge(
         0,
         1,
         false,
         types,
         GetIndexKey("i1"),
         SupportExprNodeFactory.MakeIdentExprNodes("P00", "P01"));
     TryAssertion(env, epl + " where P10 in (P00, P01)", GetSingleIndexPlan(types, planInSidx));
     // 3-stream join with in-singleindex multi-sourced
     var planInSingleMultiSrc = new InKeywordTableLookupPlanSingleIdxForge(
         0,
         1,
         false,
         types,
         GetIndexKey("i1"),
         SupportExprNodeFactory.MakeIdentExprNodes("P00"));
     TryAssertion(env, epl + " where P10 in (P00, P20)", GetSingleIndexPlan(types, planInSingleMultiSrc));
 }