Exemplo n.º 1
0
        private static RegressionPath PreloadData(
            RegressionEnvironment env,
            bool indexShare)
        {
            var path = new RegressionPath();
            var createEpl = "create window AWindow#keepall as SupportCountAccessEvent";
            if (indexShare) {
                createEpl = "@Hint('enable_window_subquery_indexshare') " + createEpl;
            }

            env.CompileDeploy(createEpl, path);
            env.CompileDeploy("insert into AWindow select * from SupportCountAccessEvent", path);
            env.CompileDeploy("create index I1 on AWindow(P00)", path);
            SupportCountAccessEvent.GetAndResetCountGetterCalled();
            for (var i = 0; i < 100; i++) {
                env.SendEventBean(new SupportCountAccessEvent(i, "E" + i));
            }

            env.SendEventBean(new SupportCountAccessEvent(-1, "x"));
            Assert.AreEqual(101, SupportCountAccessEvent.GetAndResetCountGetterCalled());
            return path;
        }
Exemplo n.º 2
0
        public void Run(RegressionEnvironment env)
        {
            // prepare
            var path = PreloadData(env, false);

            // test join
            var eplJoin = "@Name('s0') select * from SupportBean_S0 as S0 unidirectional, AWindow(P00='x') as aw where aw.Id = S0.Id";
            env.CompileDeploy(eplJoin, path).AddListener("s0");
            Assert.AreEqual(2, SupportCountAccessEvent.GetAndResetCountGetterCalled());

            env.SendEventBean(new SupportBean_S0(-1, "x"));
            Assert.IsTrue(env.Listener("s0").GetAndClearIsInvoked());

            // test subquery no-index-share
            var eplSubqueryNoIndexShare =
                "@Name('s1') select (select Id from AWindow(P00='x') as aw where aw.Id = S0.Id) " +
                "from SupportBean_S0 as S0 unidirectional";
            env.CompileDeploy(eplSubqueryNoIndexShare, path).AddListener("s1");
            Assert.AreEqual(2, SupportCountAccessEvent.GetAndResetCountGetterCalled());

            env.SendEventBean(new SupportBean_S0(-1, "x"));
            env.UndeployAll();

            // test subquery with index share
            path = PreloadData(env, true);

            var eplSubqueryWithIndexShare =
                "@Name('s2') select (select Id from AWindow(P00='x') as aw where aw.Id = S0.Id) " +
                "from SupportBean_S0 as S0 unidirectional";
            env.CompileDeploy(eplSubqueryWithIndexShare, path).AddListener("s2");
            Assert.AreEqual(2, SupportCountAccessEvent.GetAndResetCountGetterCalled());

            env.SendEventBean(new SupportBean_S0(-1, "x"));
            Assert.IsTrue(env.Listener("s2").IsInvoked);

            env.UndeployAll();
        }