Ejemplo n.º 1
0
        public void TestInKeywordMultiIndex()
        {
            _epServiceRetained.EPAdministrator.Configuration.AddEventType <SupportBean_S0>("S0");

            String stmtText = INDEX_CALLBACK_HOOK + "select * from S0 s0, " +
                              " sql:MyDB ['select mycol1, mycol2, mycol3 from mytesttable_large'] as s1 " +
                              " where p00 in (mycol2, mycol1)";
            EPStatement statement = _epServiceRetained.EPAdministrator.CreateEPL(stmtText);

            _listener         = new SupportUpdateListener();
            statement.Events += _listener.Update;

            QueryPlanIndexDescHistorical historical = SupportQueryPlanIndexHook.AssertHistoricalAndReset();

            Assert.That(historical.IndexName, Is.EqualTo(typeof(PollResultIndexingStrategyIndexSingleArray).Name));
            Assert.That(historical.StrategyName, Is.EqualTo(typeof(HistoricalIndexLookupStrategyInKeywordMulti).Name));

            var delta = PerformanceObserver.TimeMillis(
                () =>
            {
                for (int i = 0; i < 2000; i++)
                {
                    _epServiceRetained.EPRuntime.SendEvent(new SupportBean_S0(i, "815"));
                    Assert.AreEqual(815, _listener.AssertOneGetNewAndReset().Get("s1.mycol3"));
                }
            });

            Log.Info("delta=" + delta);
            Assert.That(delta, Is.LessThan(500));
        }
        private void RunAssertionInKeywordMultiIndex(EPServiceProvider epService)
        {
            epService.EPAdministrator.Configuration.AddEventType("S0", typeof(SupportBean_S0));

            var stmtText = INDEX_CALLBACK_HOOK + "select * from S0 s0, " +
                           " sql:MyDB ['select mycol1, mycol2, mycol3 from mytesttable_large'] as s1 " +
                           " where p00 in (mycol2, mycol1)";
            var statement = epService.EPAdministrator.CreateEPL(stmtText);
            var listener  = new SupportUpdateListener();

            statement.AddListener(listener);

            var historical = SupportQueryPlanIndexHook.AssertHistoricalAndReset();

            Assert.AreEqual(typeof(PollResultIndexingStrategyIndexSingleArray).Name, historical.IndexName);
            Assert.AreEqual(typeof(HistoricalIndexLookupStrategyInKeywordMulti).Name, historical.StrategyName);

            var startTime = PerformanceObserver.MilliTime;

            for (var i = 0; i < 2000; i++)
            {
                epService.EPRuntime.SendEvent(new SupportBean_S0(i, "815"));
                Assert.AreEqual(815, listener.AssertOneGetNewAndReset().Get("s1.mycol3"));
            }

            var endTime = PerformanceObserver.MilliTime;
            var delta   = endTime - startTime;

            Log.Info("delta=" + delta);
            Assert.IsTrue(delta < 500, "Delta=" + delta);

            statement.Dispose();
        }
Ejemplo n.º 3
0
            public void Run(RegressionEnvironment env)
            {
                var stmtText = "@Name('s0') " +
                               INDEX_CALLBACK_HOOK +
                               "select * from SupportBean_S0 S0, " +
                               " sql:MyDBWithLRU100000 ['select mycol1, mycol2, mycol3 from mytesttable_large'] as S1 " +
                               " where P00 in (mycol2, mycol1)";
                env.CompileDeploy(stmtText).AddListener("s0");

                var historical = SupportQueryPlanIndexHook.AssertHistoricalAndReset();
                Assert.AreEqual(typeof(PollResultIndexingStrategyInKeywordMultiForge).Name, historical.IndexName);
                Assert.AreEqual(typeof(HistoricalIndexLookupStrategyInKeywordMultiForge).Name, historical.StrategyName);

                var startTime = PerformanceObserver.MilliTime;
                for (var i = 0; i < 2000; i++) {
                    env.SendEventBean(new SupportBean_S0(i, "815"));
                    Assert.AreEqual(815, env.Listener("s0").AssertOneGetNewAndReset().Get("S1.mycol3"));
                }

                var endTime = PerformanceObserver.MilliTime;
                var delta = endTime - startTime;
                // log.info("delta=" + delta);
                Assert.That(delta, Is.LessThan(500), "Delta=" + delta);

                env.UndeployAll();
            }