示例#1
0
        private void RunAssertionMultipleIndexHints(bool namedWindow)
        {
            var eplCreate = namedWindow ?
                            "@Hint('enable_window_subquery_indexshare') create window MyInfra#keepall as select * from SSB1" :
                            "create table MyInfra(S1 String primary key, I1 int  primary key, D1 double primary key, L1 long primary key)";

            _epService.EPAdministrator.CreateEPL(eplCreate);
            _epService.EPAdministrator.CreateEPL("create unique index I1 on MyInfra (S1)");
            _epService.EPAdministrator.CreateEPL("create unique index I2 on MyInfra (I1)");

            _epService.EPAdministrator.CreateEPL(INDEX_CALLBACK_HOOK +
                                                 "@Hint('index(subquery(1), I1, bust)')\n" +
                                                 "@Hint('index(subquery(0), I2, bust)')\n" +
                                                 "select " +
                                                 "(select * from MyInfra where S1 = ssb2.S2 and I1 = ssb2.I2) as sub1," +
                                                 "(select * from MyInfra where I1 = ssb2.I2 and S1 = ssb2.S2) as sub2 " +
                                                 "from SSB2 ssb2");
            var subqueries = SupportQueryPlanIndexHook.GetAndResetSubqueries();

            Collections.SortInPlace(subqueries, (o1, o2) => o1.Tables[0].IndexName.CompareTo(o2.Tables[0].IndexName));
            SupportQueryPlanIndexHook.AssertSubquery(subqueries[0], 1, "I1", "unique hash={S1(string)} btree={}");
            SupportQueryPlanIndexHook.AssertSubquery(subqueries[1], 0, "I2", "unique hash={I1(int)} btree={}");

            _epService.EPAdministrator.DestroyAllStatements();
            _epService.EPAdministrator.Configuration.RemoveEventType("MyInfra", false);
        }
示例#2
0
        private void RunAssertionMultipleIndexHints(EPServiceProvider epService, bool namedWindow)
        {
            string eplCreate = namedWindow ?
                               "@Hint('enable_window_subquery_indexshare') create window MyInfraMIH#keepall as select * from SSB1" :
                               "create table MyInfraMIH(s1 string primary key, i1 int  primary key, d1 double primary key, l1 long primary key)";

            epService.EPAdministrator.CreateEPL(eplCreate);
            epService.EPAdministrator.CreateEPL("create unique index I1 on MyInfraMIH (s1)");
            epService.EPAdministrator.CreateEPL("create unique index I2 on MyInfraMIH (i1)");

            epService.EPAdministrator.CreateEPL(INDEX_CALLBACK_HOOK +
                                                "@Hint('index(subquery(1), I1, bust)')\n" +
                                                "@Hint('index(subquery(0), I2, bust)')\n" +
                                                "select " +
                                                "(select * from MyInfraMIH where s1 = ssb2.s2 and i1 = ssb2.i2) as sub1," +
                                                "(select * from MyInfraMIH where i1 = ssb2.i2 and s1 = ssb2.s2) as sub2 " +
                                                "from SSB2 ssb2");
            List <QueryPlanIndexDescSubquery> subqueries = SupportQueryPlanIndexHook.GetAndResetSubqueries();

            subqueries.Sort((o1, o2) => o1.Tables[0].IndexName.CompareTo(o2.Tables[0].IndexName));
            SupportQueryPlanIndexHook.AssertSubquery(subqueries[0], 1, "I1", "unique hash={s1(string)} btree={} advanced={}");
            SupportQueryPlanIndexHook.AssertSubquery(subqueries[1], 0, "I2", "unique hash={i1(int)} btree={} advanced={}");

            epService.EPAdministrator.DestroyAllStatements();
            epService.EPAdministrator.Configuration.RemoveEventType("MyInfraMIH", false);
        }
示例#3
0
            public void Run(RegressionEnvironment env)
            {
                var path = new RegressionPath();
                var eplCreate = namedWindow
                    ? "@Hint('enable_window_subquery_indexshare') create window MyInfraMIH#keepall as select * from SupportSimpleBeanOne"
                    : "create table MyInfraMIH(S1 String primary key, I1 int primary key, D1 double primary key, L1 long primary key)";
                env.CompileDeploy(eplCreate, path);
                env.CompileDeploy("create unique index I1 on MyInfraMIH (S1)", path);
                env.CompileDeploy("create unique index I2 on MyInfraMIH (I1)", path);

                env.CompileDeploy(
                    INDEX_CALLBACK_HOOK +
                    "@Hint('index(subquery(1), I1, bust)')\n" +
                    "@Hint('index(subquery(0), I2, bust)')\n" +
                    "select " +
                    "(select * from MyInfraMIH where S1 = ssb2.S2 and I1 = ssb2.I2) as sub1," +
                    "(select * from MyInfraMIH where I1 = ssb2.I2 and S1 = ssb2.S2) as sub2 " +
                    "from SupportSimpleBeanTwo ssb2",
                    path);
                var subqueries = SupportQueryPlanIndexHook.GetAndResetSubqueries();
                subqueries.SortInPlace(
                    (
                        o1,
                        o2) => {
                        return o1.Tables[0].IndexName.CompareTo(o2.Tables[0].IndexName);
                    });
                SupportQueryPlanIndexHook.AssertSubquery(
                    subqueries[0],
                    1,
                    "I1",
                    "unique hash={S1(string)} btree={} advanced={}");
                SupportQueryPlanIndexHook.AssertSubquery(
                    subqueries[1],
                    0,
                    "I2",
                    "unique hash={I1(int)} btree={} advanced={}");

                env.UndeployAll();
            }