Exemplo n.º 1
0
        private void AssertNoPlan(string epl)
        {
            var theEpl = PLAN_CALLBACK_HOOK + epl;

            _epService.EPAdministrator.CreateEPL(theEpl);
            Assert.IsNull(SupportAggLevelPlanHook.GetAndReset());
        }
Exemplo n.º 2
0
        public void SetUp()
        {
            _listener = new SupportUpdateListener();
            var config = SupportConfigFactory.GetConfiguration();

            _epService = EPServiceProviderManager.GetDefaultProvider(config);
            _epService.Initialize();

            foreach (var clazz in new Type[] { typeof(SupportBean), typeof(SupportBean_S0), typeof(SupportBean_S1) })
            {
                _epService.EPAdministrator.Configuration.AddEventType(clazz);
            }
            SupportAggLevelPlanHook.GetAndReset();

            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.StartTest(_epService, this.GetType(), this.GetType().FullName);
            }
        }
Exemplo n.º 3
0
        private void AssertCountColsAndLevels(string epl, int colCount, int lvlCount)
        {
            var theEpl = PLAN_CALLBACK_HOOK + epl;

            _epService.EPAdministrator.CreateEPL(theEpl);
            Pair <AggregationGroupByLocalGroupDesc, AggregationLocalGroupByPlan> plan = SupportAggLevelPlanHook.GetAndReset();

            Assert.AreEqual(colCount, plan.First.NumColumns);
            Assert.AreEqual(lvlCount, plan.First.Levels.Length);
        }
Exemplo n.º 4
0
        public void TestPlanning()
        {
            AssertNoPlan("select sum(group_by:(),IntPrimitive) as c0 from SupportBean");
            AssertNoPlan("select sum(group_by:(TheString),IntPrimitive) as c0 from SupportBean group by TheString");
            AssertNoPlan("select sum(group_by:(TheString, IntPrimitive),LongPrimitive) as c0 from SupportBean group by TheString, IntPrimitive");
            AssertNoPlan("select sum(group_by:(IntPrimitive, TheString),LongPrimitive) as c0 from SupportBean group by TheString, IntPrimitive");

            // provide column count stays at 1
            AssertCountColsAndLevels("select sum(group_by:(TheString),IntPrimitive) as c0, sum(group_by:(TheString),IntPrimitive) as c1 from SupportBean",
                                     1, 1);

            // prove order of group-by expressions does not matter
            AssertCountColsAndLevels("select sum(group_by:(IntPrimitive, TheString),LongPrimitive) as c0, sum(LongPrimitive, group_by:(TheString, IntPrimitive)) as c1 from SupportBean",
                                     1, 1);

            // prove the number of levels stays the same even when group-by expressions vary
            AssertCountColsAndLevels("select sum(group_by:(IntPrimitive, TheString),LongPrimitive) as c0, count(*, group_by:(TheString, IntPrimitive)) as c1 from SupportBean",
                                     2, 1);

            // prove there is one shared state factory
            var theEpl = PLAN_CALLBACK_HOOK + "select window(*, group_by:TheString), last(*, group_by:TheString) from SupportBean#length(2)";

            _epService.EPAdministrator.CreateEPL(theEpl);
            Pair <AggregationGroupByLocalGroupDesc, AggregationLocalGroupByPlan> plan = SupportAggLevelPlanHook.GetAndReset();

            Assert.AreEqual(1, plan.Second.AllLevels.Length);
            Assert.AreEqual(1, plan.Second.AllLevels[0].StateFactories.Length);
        }