private void RunAssertion(EPServiceProvider epService, SupportUpdateListener listener, CaseEnum caseEnum, string uniqueFields, string whereClause, bool unique, IndexAssertionEventSend assertion) { SupportQueryPlanIndexHook.Reset(); string eplUnique = INDEX_CALLBACK_HOOK + "select * from "; if (caseEnum == CaseEnum.UNIDIRECTIONAL || caseEnum == CaseEnum.UNIDIRECTIONAL_3STREAM) { eplUnique += "SSB1 as ssb1 unidirectional "; } else { eplUnique += "SSB1#lastevent as ssb1 "; } eplUnique += ", SSB2#unique(" + uniqueFields + ") as ssb2 "; if (caseEnum == CaseEnum.UNIDIRECTIONAL_3STREAM || caseEnum == CaseEnum.MULTIDIRECTIONAL_3STREAM) { eplUnique += ", SupportBean#lastevent "; } eplUnique += whereClause; EPStatement stmtUnique = epService.EPAdministrator.CreateEPL(eplUnique); stmtUnique.Events += listener.Update; SupportQueryPlanIndexHook.AssertJoinOneStreamAndReset(unique); epService.EPRuntime.SendEvent(new SupportBean("JOINEVENT", 1)); assertion.Invoke(); stmtUnique.Dispose(); }
private static void TryAssertion( RegressionEnvironment env, bool disableImplicitUniqueIdx, string uniqueFields, string whereClause, string backingTable, IndexAssertionEventSend assertion) { SupportQueryPlanIndexHook.Reset(); var eplUnique = "@Name('s0')" + INDEX_CALLBACK_HOOK + "select S1 as c0, " + "(select S2 from SupportSimpleBeanTwo#unique(" + uniqueFields + ") as ssb2 " + whereClause + ") as c1 " + "from SupportSimpleBeanOne as ssb1"; if (disableImplicitUniqueIdx) { eplUnique = "@Hint('DISABLE_UNIQUE_IMPLICIT_IDX')" + eplUnique; } env.CompileDeploy(eplUnique).AddListener("s0"); SupportQueryPlanIndexHook.AssertSubqueryBackingAndReset(SUBQUERY_NUM_FIRST, null, backingTable); assertion.Invoke(); env.UndeployAll(); }
private void RunAssertionDocSample(EPServiceProvider epService) { epService.EPAdministrator.Configuration.AddEventType(typeof(AEvent)); epService.EPAdministrator.Configuration.AddEventType(typeof(BEvent)); var hints = new string[] { "@Hint('Exclude_plan(true)')", "@Hint('Exclude_plan(opname=\"equals\")')", "@Hint('Exclude_plan(opname=\"equals\" and from_streamname=\"a\")')", "@Hint('Exclude_plan(opname=\"equals\" and from_streamname=\"b\")')", "@Hint('Exclude_plan(exprs[0]=\"aprop\")')" }; foreach (string hint in hints) { epService.EPAdministrator.CreateEPL("@Audit " + hint + "select * from AEvent#keepall as a, BEvent#keepall as b where aprop = bprop"); } // test subquery SupportQueryPlanIndexHook.Reset(); epService.EPAdministrator.CreateEPL(INDEX_CALLBACK_HOOK + "@Hint('Exclude_plan(true)') select (select * from S0#unique(p00) as s0 where s1.p10 = p00) from S1 as s1"); QueryPlanIndexDescSubquery subq = SupportQueryPlanIndexHook.GetAndResetSubqueries()[0]; Assert.AreEqual(typeof(SubordFullTableScanLookupStrategyFactory).Name, subq.TableLookupStrategy); // test named window epService.EPAdministrator.CreateEPL("create window S0Window#keepall as S0"); epService.EPAdministrator.CreateEPL(INDEX_CALLBACK_HOOK + "@Hint('Exclude_plan(true)') on S1 as s1 select * from S0Window as s0 where s1.p10 = s0.p00"); QueryPlanIndexDescOnExpr onExpr = SupportQueryPlanIndexHook.GetAndResetOnExpr(); Assert.AreEqual(typeof(SubordWMatchExprLookupStrategyFactoryAllFiltered).Name, onExpr.StrategyName); epService.EPAdministrator.DestroyAllStatements(); }
private void RunAssertionMultiIdxConstants(EPServiceProvider epService) { SupportQueryPlanIndexHook.Reset(); var epl = INDEX_CALLBACK_HOOK + "select * from S0 as s0 unidirectional, S1#keepall as s1 " + "where 'a' in (P10, P11)"; var fields = "s0.Id,s1.Id".Split(','); var stmt = epService.EPAdministrator.CreateEPL(epl); var listener = new SupportUpdateListener(); stmt.Events += listener.Update; var items = SupportQueryPlanIndexHook.AssertJoinAndReset().IndexSpecs[1].Items; Assert.AreEqual("[P10][P11]", SupportQueryPlanIndexHelper.GetIndexedExpressions(items)); epService.EPRuntime.SendEvent(new SupportBean_S1(100, "x", "y")); epService.EPRuntime.SendEvent(new SupportBean_S1(101, "x", "a")); epService.EPRuntime.SendEvent(new SupportBean_S0(1)); EPAssertionUtil.AssertPropsPerRowAnyOrder( listener.GetAndResetLastNewData(), fields, new[] {new object[] {1, 101}}); epService.EPRuntime.SendEvent(new SupportBean_S1(102, "b", "a")); epService.EPRuntime.SendEvent(new SupportBean_S0(2)); EPAssertionUtil.AssertPropsPerRowAnyOrder( listener.GetAndResetLastNewData(), fields, new[] {new object[] {2, 101}, new object[] {2, 102}}); stmt.Dispose(); }
private void RunAssertionMultiIdxMultipleInAndMultirow(EPServiceProvider epService) { // assert join SupportQueryPlanIndexHook.Reset(); var epl = INDEX_CALLBACK_HOOK + "select * from S0 as s0 unidirectional, S1#keepall as s1 " + "where P00 in (P10, P11) and P01 in (P12, P13)"; var stmt = epService.EPAdministrator.CreateEPL(epl); var listener = new SupportUpdateListener(); stmt.Events += listener.Update; var items = SupportQueryPlanIndexHook.AssertJoinAndReset().IndexSpecs[1].Items; Assert.AreEqual("[P10][P11]", SupportQueryPlanIndexHelper.GetIndexedExpressions(items)); TryAssertionMultiIdx(epService, listener); epService.EPAdministrator.DestroyAllStatements(); // assert named window epService.EPAdministrator.CreateEPL("create window S1Window#keepall as S1"); epService.EPAdministrator.CreateEPL("insert into S1Window select * from S1"); var eplNamedWindow = INDEX_CALLBACK_HOOK + "on S0 as s0 select * from S1Window as s1 " + "where P00 in (P10, P11) and P01 in (P12, P13)"; var stmtNamedWindow = epService.EPAdministrator.CreateEPL(eplNamedWindow); stmtNamedWindow.Events += listener.Update; var onExprNamedWindow = SupportQueryPlanIndexHook.AssertOnExprAndReset(); Assert.AreEqual( typeof(SubordInKeywordMultiTableLookupStrategyFactory).Name, onExprNamedWindow.TableLookupStrategy); TryAssertionMultiIdx(epService, listener); // assert table epService.EPAdministrator.CreateEPL( "create table S1Table(" + "Id int primary key, " + "P10 string primary key, " + "P11 string primary key, " + "P12 string primary key, " + "P13 string primary key)" ); epService.EPAdministrator.CreateEPL("insert into S1Table select * from S1"); epService.EPAdministrator.CreateEPL("create index S1Idx1 on S1Table(P10)"); epService.EPAdministrator.CreateEPL("create index S1Idx2 on S1Table(P11)"); epService.EPAdministrator.CreateEPL("create index S1Idx3 on S1Table(P12)"); epService.EPAdministrator.CreateEPL("create index S1Idx4 on S1Table(P13)"); var eplTable = INDEX_CALLBACK_HOOK + "on S0 as s0 select * from S1Table as s1 " + "where P00 in (P10, P11) and P01 in (P12, P13)"; var stmtTable = epService.EPAdministrator.CreateEPL(eplTable); stmtTable.Events += listener.Update; var onExprTable = SupportQueryPlanIndexHook.AssertOnExprAndReset(); Assert.AreEqual( typeof(SubordInKeywordMultiTableLookupStrategyFactory).Name, onExprTable.TableLookupStrategy); TryAssertionMultiIdx(epService, listener); epService.EPAdministrator.DestroyAllStatements(); }
public void Run(RegressionEnvironment env) { SupportQueryPlanIndexHook.Reset(); var epl = "@Name('s0') " + INDEX_CALLBACK_HOOK + "select S1.Id as c0," + "(select * from SupportBean_S0#keepall as S0 " + " where S0.P00 in (S1.P10, SupportBean_S1.P11) and S0.P01 in (S1.P12, SupportBean_S1.P13))" + ".selectFrom(a->SupportBean_S0.Id) as c1 " + " from SupportBean_S1 as S1"; env.CompileDeploy(epl).AddListener("s0"); var subquery = SupportQueryPlanIndexHook.AssertSubqueryAndReset(); Assert.AreEqual(typeof(SubordInKeywordSingleTableLookupStrategyFactoryForge).Name, subquery.TableLookupStrategy); // single row tests env.SendEventBean(new SupportBean_S0(100, "a", "c")); env.SendEventBean(new SupportBean_S1(1, "a1", "b", "c", "d")); AssertSubqueryC0C1(env, 1, null); env.SendEventBean(new SupportBean_S1(2, "a", "b", "x", "d")); AssertSubqueryC0C1(env, 2, null); env.SendEventBean(new SupportBean_S1(3, "a", "b", "c", "d")); AssertSubqueryC0C1(env, 3, new int?[] {100}); env.SendEventBean(new SupportBean_S1(4, "x", "a", "x", "c")); AssertSubqueryC0C1(env, 4, new int?[] {100}); // 2-rows available tests env.SendEventBean(new SupportBean_S0(101, "a", "d")); env.SendEventBean(new SupportBean_S1(10, "a1", "b", "c", "d")); AssertSubqueryC0C1(env, 10, null); env.SendEventBean(new SupportBean_S1(11, "a", "b", "x", "c1")); AssertSubqueryC0C1(env, 11, null); env.SendEventBean(new SupportBean_S1(12, "a", "b", "c", "d")); AssertSubqueryC0C1(env, 12, new int?[] {100, 101}); env.SendEventBean(new SupportBean_S1(13, "x", "a", "x", "c")); AssertSubqueryC0C1(env, 13, new int?[] {100}); env.SendEventBean(new SupportBean_S1(14, "x", "a", "d", "x")); AssertSubqueryC0C1(env, 14, new int?[] {101}); // 3-rows available tests env.SendEventBean(new SupportBean_S0(102, "b", "c")); env.SendEventBean(new SupportBean_S1(20, "a1", "b", "c1", "d")); AssertSubqueryC0C1(env, 20, null); env.SendEventBean(new SupportBean_S1(21, "a", "b", "x", "c1")); AssertSubqueryC0C1(env, 21, null); env.SendEventBean(new SupportBean_S1(22, "a", "b", "c", "d")); AssertSubqueryC0C1(env, 22, new int?[] {100, 101, 102}); env.SendEventBean(new SupportBean_S1(23, "b", "a", "x", "c")); AssertSubqueryC0C1(env, 23, new int?[] {100, 102}); env.SendEventBean(new SupportBean_S1(24, "b", "a", "d", "c")); AssertSubqueryC0C1(env, 24, new int?[] {100, 101, 102}); env.SendEventBean(new SupportBean_S1(25, "b", "x", "x", "c")); AssertSubqueryC0C1(env, 25, new int?[] {102}); env.UndeployAll(); // test coercion absence - types the same var eplCoercion = INDEX_CALLBACK_HOOK + "select *," + "(select * from SupportBean#keepall as sb where sb.LongPrimitive in (S0.Id)) from SupportBean_S0 as S0"; env.CompileDeploy(eplCoercion); var subqueryCoercion = SupportQueryPlanIndexHook.AssertSubqueryAndReset(); Assert.AreEqual(typeof(SubordFullTableScanLookupStrategyFactoryForge).Name, subqueryCoercion.TableLookupStrategy); env.UndeployAll(); }
public void SetUp() { Configuration config = SupportConfigFactory.GetConfiguration(); config.EngineDefaults.LoggingConfig.IsEnableQueryPlan = true; _epService = EPServiceProviderManager.GetDefaultProvider(config); _epService.Initialize(); _listener = new SupportUpdateListener(); SupportQueryPlanIndexHook.Reset(); }
private void TryAssertion(EPServiceProvider epService, string epl, QueryPlan expectedPlan) { SupportQueryPlanIndexHook.Reset(); epl = INDEX_CALLBACK_HOOK + epl; epService.EPAdministrator.CreateEPL(epl); var actualPlan = SupportQueryPlanIndexHook.AssertJoinAndReset(); SupportQueryPlanIndexHelper.CompareQueryPlans(expectedPlan, actualPlan); epService.EPAdministrator.DestroyAllStatements(); }
public void Run(RegressionEnvironment env) { SupportQueryPlanIndexHook.Reset(); var epl = INDEX_CALLBACK_HOOK + "select * from SupportBean_S0 as S0 unidirectional, SupportBean_S1#keepall as S1 " + "where P00 not in (P10, P11)"; env.CompileDeploy(epl); var items = SupportQueryPlanIndexHook.AssertJoinAndReset().IndexSpecs[1].Items; Assert.AreEqual("[]", SupportQueryPlanIndexHelper.GetIndexedExpressions(items)); env.UndeployAll(); }
public override void Configure(Configuration configuration) { configuration.EngineDefaults.Logging.IsEnableQueryPlan = true; configuration.AddPlugInVirtualDataWindow("test", "vdw", typeof(SupportVirtualDWFactory).FullName); configuration.AddPlugInVirtualDataWindow("invalid", "invalid", typeof(InvalidTypeForTest)); configuration.AddPlugInVirtualDataWindow("test", "testnoindex", typeof(SupportVirtualDWInvalidFactory)); configuration.AddPlugInVirtualDataWindow("test", "exceptionvdw", typeof(SupportVirtualDWExceptionFactory)); configuration.AddEventType <SupportBean>(); configuration.AddEventType("SupportBean_ST0", typeof(SupportBean_ST0)); configuration.AddEventType("SupportBeanRange", typeof(SupportBeanRange)); SupportQueryPlanIndexHook.Reset(); }
private static void TryAssertion( RegressionEnvironment env, string epl, QueryPlanForge expectedPlan) { SupportQueryPlanIndexHook.Reset(); epl = INDEX_CALLBACK_HOOK + epl; env.CompileDeploy(epl); var actualPlan = SupportQueryPlanIndexHook.AssertJoinAndReset(); SupportQueryPlanIndexHelper.CompareQueryPlans(expectedPlan, actualPlan); env.UndeployAll(); }
public void TestMultiIdxMultipleInAndMultirow() { // assert join SupportQueryPlanIndexHook.Reset(); var epl = INDEX_CALLBACK_HOOK + "select * from S0 as s0 unidirectional, S1.win:keepall() as s1 " + "where p00 in (p10, p11) and p01 in (p12, p13)"; var stmt = _epService.EPAdministrator.CreateEPL(epl); stmt.AddListener(_listener); var items = SupportQueryPlanIndexHook.AssertJoinAndReset().IndexSpecs[1].Items; Assert.AreEqual("[p10][p11]", SupportQueryPlanIndexHelper.GetIndexedExpressions(items)); RunAssertionMultiIdx(); _epService.EPAdministrator.DestroyAllStatements(); // assert named window _epService.EPAdministrator.CreateEPL("create window S1Window.win:keepall() as S1"); _epService.EPAdministrator.CreateEPL("insert into S1Window select * from S1"); var eplNamedWindow = INDEX_CALLBACK_HOOK + "on S0 as s0 select * from S1Window as s1 " + "where P00 in (P10, p11) and P01 in (P12, P13)"; var stmtNamedWindow = _epService.EPAdministrator.CreateEPL(eplNamedWindow); stmtNamedWindow.AddListener(_listener); var onExprNamedWindow = SupportQueryPlanIndexHook.AssertOnExprAndReset(); Assert.AreEqual(typeof(SubordInKeywordMultiTableLookupStrategyFactory).Name, onExprNamedWindow.TableLookupStrategy); RunAssertionMultiIdx(); // assert table _epService.EPAdministrator.CreateEPL("create table S1Table(Id int primary key, P10 string primary key, P11 string primary key, P12 string primary key, P13 string primary key)"); _epService.EPAdministrator.CreateEPL("insert into S1Table select * from S1"); _epService.EPAdministrator.CreateEPL("create index S1Idx1 on S1Table(P10)"); _epService.EPAdministrator.CreateEPL("create index S1Idx2 on S1Table(P11)"); _epService.EPAdministrator.CreateEPL("create index S1Idx3 on S1Table(P12)"); _epService.EPAdministrator.CreateEPL("create index S1Idx4 on S1Table(P13)"); var eplTable = INDEX_CALLBACK_HOOK + "on S0 as s0 select * from S1Table as s1 " + "where P00 in (P10, P11) and P01 in (P12, P13)"; var stmtTable = _epService.EPAdministrator.CreateEPL(eplTable); stmtTable.AddListener(_listener); var onExprTable = SupportQueryPlanIndexHook.AssertOnExprAndReset(); Assert.AreEqual(typeof(SubordInKeywordMultiTableLookupStrategyFactory).Name, onExprTable.TableLookupStrategy); RunAssertionMultiIdx(); }
public void TestNotIn() { SupportQueryPlanIndexHook.Reset(); var epl = INDEX_CALLBACK_HOOK + "select * from S0 as s0 unidirectional, S1.win:keepall() as s1 " + "where p00 not in (p10, p11)"; var stmt = _epService.EPAdministrator.CreateEPL(epl); stmt.AddListener(_listener); var items = SupportQueryPlanIndexHook.AssertJoinAndReset().IndexSpecs[1].Items; Assert.AreEqual("null", SupportQueryPlanIndexHelper.GetIndexedExpressions(items)); }
public void SetUp() { var config = SupportConfigFactory.GetConfiguration(); config.EngineDefaults.LoggingConfig.IsEnableQueryPlan = true; _epService = EPServiceProviderManager.GetDefaultProvider(config); _epService.Initialize(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.StartTest(_epService, this.GetType(), GetType().FullName); } SupportQueryPlanIndexHook.Reset(); }
public void TestSingleIdxMultipleInAndMultirow() { // assert join SupportQueryPlanIndexHook.Reset(); var epl = INDEX_CALLBACK_HOOK + "select * from S0#keepall as s0, S1 as s1 unidirectional " + "where P00 in (P10, P11) and P01 in (P12, P13)"; var stmt = _epService.EPAdministrator.CreateEPL(epl); stmt.AddListener(_listener); var items = SupportQueryPlanIndexHook.AssertJoinAndReset().IndexSpecs[0].Items; Assert.AreEqual("[P00]", SupportQueryPlanIndexHelper.GetIndexedExpressions(items)); RunAssertionSingleIdx(); _epService.EPAdministrator.DestroyAllStatements(); // assert named window _epService.EPAdministrator.CreateEPL("create window S0Window#keepall as S0"); _epService.EPAdministrator.CreateEPL("insert into S0Window select * from S0"); var eplNamedWindow = INDEX_CALLBACK_HOOK + "on S1 as s1 select * from S0Window as s0 " + "where P00 in (P10, P11) and P01 in (P12, P13)"; var stmtNamedWindow = _epService.EPAdministrator.CreateEPL(eplNamedWindow); stmtNamedWindow.AddListener(_listener); var onExprNamedWindow = SupportQueryPlanIndexHook.AssertOnExprAndReset(); Assert.AreEqual(typeof(SubordInKeywordSingleTableLookupStrategyFactory).Name, onExprNamedWindow.TableLookupStrategy); RunAssertionSingleIdx(); // assert table _epService.EPAdministrator.CreateEPL("create table S0Table(Id int primary key, P00 string primary key, P01 string primary key, P02 string primary key, P03 string primary key)"); _epService.EPAdministrator.CreateEPL("insert into S0Table select * from S0"); _epService.EPAdministrator.CreateEPL("create index S0Idx1 on S0Table(P00)"); _epService.EPAdministrator.CreateEPL("create index S0Idx2 on S0Table(P01)"); var eplTable = INDEX_CALLBACK_HOOK + "on S1 as s1 select * from S0Table as s0 " + "where P00 in (P10, P11) and P01 in (P12, P13)"; var stmtTable = _epService.EPAdministrator.CreateEPL(eplTable); stmtTable.AddListener(_listener); var onExprTable = SupportQueryPlanIndexHook.AssertOnExprAndReset(); Assert.AreEqual(typeof(SubordInKeywordSingleTableLookupStrategyFactory).Name, onExprTable.TableLookupStrategy); RunAssertionSingleIdx(); }
private void RunAssertionNotIn(EPServiceProvider epService) { SupportQueryPlanIndexHook.Reset(); var epl = INDEX_CALLBACK_HOOK + "select * from S0 as s0 unidirectional, S1#keepall as s1 " + "where P00 not in (P10, P11)"; var stmt = epService.EPAdministrator.CreateEPL(epl); var listener = new SupportUpdateListener(); stmt.Events += listener.Update; var items = SupportQueryPlanIndexHook.AssertJoinAndReset().IndexSpecs[1].Items; Assert.AreEqual("null", SupportQueryPlanIndexHelper.GetIndexedExpressions(items)); stmt.Dispose(); }
public void Run(RegressionEnvironment env) { var schema = "create schema AEvent as " + typeof(AEvent).MaskTypeName() + ";\n" + "create schema BEvent as " + typeof(BEvent).MaskTypeName() + ";\n"; var path = new RegressionPath(); env.CompileDeploy(schema, path); string[] hints = { "@Hint('exclude_plan(true)')", "@Hint('exclude_plan(opname=\"equals\")')", "@Hint('exclude_plan(opname=\"equals\" and from_streamname=\"a\")')", "@Hint('exclude_plan(opname=\"equals\" and from_streamname=\"b\")')", "@Hint('exclude_plan(exprs[0]=\"aprop\")')" }; foreach (var hint in hints) { env.CompileDeploy( "@Audit " + hint + "select * from AEvent#keepall as a, BEvent#keepall as b where aprop = bprop", path); } // test subquery SupportQueryPlanIndexHook.Reset(); env.CompileDeploy( INDEX_CALLBACK_HOOK + "@Hint('exclude_plan(true)') select (select * from SupportBean_S0#unique(P00) as S0 where S1.P10 = P00) from SupportBean_S1 as S1", path); var subq = SupportQueryPlanIndexHook.GetAndResetSubqueries()[0]; Assert.AreEqual(typeof(SubordFullTableScanLookupStrategyFactoryForge).Name, subq.TableLookupStrategy); // test named window env.CompileDeploy("create window S0Window#keepall as SupportBean_S0", path); env.CompileDeploy( INDEX_CALLBACK_HOOK + "@Hint('exclude_plan(true)') on SupportBean_S1 as S1 select * from S0Window as S0 where S1.P10 = S0.P00", path); var onExpr = SupportQueryPlanIndexHook.GetAndResetOnExpr(); Assert.AreEqual(typeof(SubordWMatchExprLookupStrategyAllFilteredForge).Name, onExpr.StrategyName); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { // assert join SupportQueryPlanIndexHook.Reset(); var epl = "@Name('s0') " + INDEX_CALLBACK_HOOK + "select * from SupportBean_S0 as S0 unidirectional, SupportBean_S1#keepall as S1 " + "where P00 in (P10, P11) and P01 in (P12, P13)"; env.CompileDeploy(epl).AddListener("s0"); var items = SupportQueryPlanIndexHook.AssertJoinAndReset().IndexSpecs[1].Items; Assert.AreEqual("[\"P10\"][\"P11\"]", SupportQueryPlanIndexHelper.GetIndexedExpressions(items)); TryAssertionMultiIdx(env); env.UndeployAll(); // assert named window var path = new RegressionPath(); env.CompileDeploy("create window S1Window#keepall as SupportBean_S1", path); env.CompileDeploy("insert into S1Window select * from SupportBean_S1", path); var eplNamedWindow = "@Name('s0') " + INDEX_CALLBACK_HOOK + "on SupportBean_S0 as S0 select * from S1Window as S1 " + "where P00 in (P10, P11) and P01 in (P12, P13)"; env.CompileDeploy(eplNamedWindow, path).AddListener("s0"); var onExprNamedWindow = SupportQueryPlanIndexHook.AssertOnExprAndReset(); Assert.AreEqual(typeof(SubordInKeywordMultiTableLookupStrategyFactoryForge).Name, onExprNamedWindow.TableLookupStrategy); TryAssertionMultiIdx(env); // assert table path.Clear(); env.CompileDeploy( "create table S1Table(Id int primary key, P10 string primary key, P11 string primary key, P12 string primary key, P13 string primary key)", path); env.CompileDeploy("insert into S1Table select * from SupportBean_S1", path); env.CompileDeploy("create index S1Idx1 on S1Table(P10)", path); env.CompileDeploy("create index S1Idx2 on S1Table(P11)", path); env.CompileDeploy("create index S1Idx3 on S1Table(P12)", path); env.CompileDeploy("create index S1Idx4 on S1Table(P13)", path); var eplTable = "@Name('s0') " + INDEX_CALLBACK_HOOK + "on SupportBean_S0 as S0 select * from S1Table as S1 " + "where P00 in (P10, P11) and P01 in (P12, P13)"; env.CompileDeploy(eplTable, path).AddListener("s0"); var onExprTable = SupportQueryPlanIndexHook.AssertOnExprAndReset(); Assert.AreEqual(typeof(SubordInKeywordMultiTableLookupStrategyFactoryForge).Name, onExprTable.TableLookupStrategy); TryAssertionMultiIdx(env); env.UndeployAll(); }
public void SetUp() { var config = SupportConfigFactory.GetConfiguration(); config.EngineDefaults.Logging.IsEnableQueryPlan = true; _epService = EPServiceProviderManager.GetDefaultProvider(config); _epService.Initialize(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.StartTest(_epService, this.GetType(), GetType().FullName); } _epRuntime = _epService.EPRuntime; _epService.EPAdministrator.Configuration.AddEventType <SupportBean>(); _epService.EPAdministrator.Configuration.AddEventType("ABean", typeof(SupportBean_S0)); _epService.EPAdministrator.Configuration.AddEventType("SB2", typeof(SupportBeanTwo)); _listenerStmtOne = new SupportUpdateListener(); SupportQueryPlanIndexHook.Reset(); }
private void TryAssertionVirtualDW( RegressionEnvironment env, CaseEnum caseEnum, string uniqueFields, string whereClause, bool unique, IndexAssertionEventSend assertion) { SupportQueryPlanIndexHook.Reset(); SupportVirtualDWForge.UniqueKeys = new HashSet<string>(Arrays.AsList(uniqueFields.SplitCsv())); var path = new RegressionPath(); env.CompileDeploy("create window MyVDW.test:vdw() as SupportBean", path); var window = (SupportVirtualDW) GetFromContext(env, "/virtualdw/MyVDW"); var supportBean = new SupportBean("S1", 101); supportBean.DoublePrimitive = 102; supportBean.LongPrimitive = 103; window.Data = Collections.SingletonSet<object>(supportBean); var eplUnique = IndexBackingTableInfo.INDEX_CALLBACK_HOOK + "@Name('s0') select * from "; if (caseEnum == CaseEnum.UNIDIRECTIONAL) { eplUnique += "SupportSimpleBeanOne as ssb1 unidirectional "; } else { eplUnique += "SupportSimpleBeanOne#lastevent as ssb1 "; } eplUnique += ", MyVDW as vdw "; eplUnique += whereClause; env.CompileDeploy(eplUnique, path).AddListener("s0"); // assert query plan SupportQueryPlanIndexHook.AssertJoinOneStreamAndReset(unique); // run assertion assertion.Invoke(); env.UndeployAll(); SupportVirtualDWForge.UniqueKeys = null; }
private void TryAssertion(EPServiceProvider epService, SupportUpdateListener listener, bool disableImplicitUniqueIdx, string uniqueFields, string whereClause, string backingTable, IndexAssertionEventSend assertion) { SupportQueryPlanIndexHook.Reset(); string eplUnique = INDEX_CALLBACK_HOOK + "select s1 as c0, " + "(select s2 from SSB2#unique(" + uniqueFields + ") as ssb2 " + whereClause + ") as c1 " + "from SSB1 as ssb1"; if (disableImplicitUniqueIdx) { eplUnique = "@Hint('DISABLE_UNIQUE_IMPLICIT_IDX')" + eplUnique; } EPStatement stmtUnique = epService.EPAdministrator.CreateEPL(eplUnique); stmtUnique.Events += listener.Update; SupportQueryPlanIndexHook.AssertSubqueryBackingAndReset(0, null, backingTable); assertion.Invoke(); stmtUnique.Dispose(); }
private void TryAssertionVirtualDW(EPServiceProvider epService, SupportUpdateListener listener, CaseEnum caseEnum, string uniqueFields, string whereClause, bool unique, IndexAssertionEventSend assertion) { SupportQueryPlanIndexHook.Reset(); SupportVirtualDWFactory.UniqueKeys = new HashSet <string>(uniqueFields.Split(',')); epService.EPAdministrator.CreateEPL("create window MyVDW.test:vdw() as SupportBean"); SupportVirtualDW window = (SupportVirtualDW)GetFromContext(epService, "/virtualdw/MyVDW"); var supportBean = new SupportBean("S1", 101); supportBean.DoublePrimitive = 102; supportBean.LongPrimitive = 103; window.Data = Collections.SingletonList <object>(supportBean); string eplUnique = INDEX_CALLBACK_HOOK + "select * from "; if (caseEnum == CaseEnum.UNIDIRECTIONAL) { eplUnique += "SSB1 as ssb1 unidirectional "; } else { eplUnique += "SSB1#lastevent as ssb1 "; } eplUnique += ", MyVDW as vdw "; eplUnique += whereClause; EPStatement stmtUnique = epService.EPAdministrator.CreateEPL(eplUnique); stmtUnique.Events += listener.Update; // assert query plan SupportQueryPlanIndexHook.AssertJoinOneStreamAndReset(unique); // run assertion assertion.Invoke(); epService.EPAdministrator.DestroyAllStatements(); DestroyStmtsRemoveTypes(epService); }
public void SetUp() { _listener = new SupportUpdateListener(); var configuration = SupportConfigFactory.GetConfiguration(); configuration.EngineDefaults.LoggingConfig.IsEnableQueryPlan = true; configuration.AddPlugInVirtualDataWindow("test", "vdw", typeof(SupportVirtualDWFactory).FullName); configuration.AddPlugInVirtualDataWindow("invalid", "invalid", typeof(InvalidTypeForTest).FullName); configuration.AddPlugInVirtualDataWindow("test", "testnoindex", typeof(SupportVirtualDWInvalidFactory).FullName); configuration.AddPlugInVirtualDataWindow("test", "exceptionvdw", typeof(SupportVirtualDWExceptionFactory).FullName); configuration.AddEventType("SupportBean", typeof(SupportBean)); configuration.AddEventType("SupportBean_ST0", typeof(SupportBean_ST0)); configuration.AddEventType("SupportBeanRange", typeof(SupportBeanRange)); _epService = EPServiceProviderManager.GetDefaultProvider(configuration); _epService.Initialize(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.StartTest(_epService, GetType(), GetType().FullName); } SupportQueryPlanIndexHook.Reset(); }
public void Run(RegressionEnvironment env) { SupportQueryPlanIndexHook.Reset(); var epl = "@Name('s0') " + INDEX_CALLBACK_HOOK + "select * from SupportBean_S0 as S0 unidirectional, SupportBean_S1#keepall as S1 " + "where 'a' in (P10, P11)"; var fields = new[] {"S0.Id", "S1.Id"}; env.CompileDeploy(epl).AddListener("s0"); var items = SupportQueryPlanIndexHook.AssertJoinAndReset().IndexSpecs[1].Items; Assert.AreEqual("[\"P10\"][\"P11\"]", SupportQueryPlanIndexHelper.GetIndexedExpressions(items)); env.SendEventBean(new SupportBean_S1(100, "x", "y")); env.SendEventBean(new SupportBean_S1(101, "x", "a")); env.SendEventBean(new SupportBean_S0(1)); EPAssertionUtil.AssertPropsPerRowAnyOrder(env.Listener("s0").GetAndResetLastNewData(), fields, new[] {new object[] {1, 101}}); env.SendEventBean(new SupportBean_S1(102, "b", "a")); env.SendEventBean(new SupportBean_S0(2)); EPAssertionUtil.AssertPropsPerRowAnyOrder( env.Listener("s0").GetAndResetLastNewData(), fields, new[] {new object[] {2, 101}, new object[] {2, 102}}); env.UndeployAll(); }
private void RunAssertion( RegressionEnvironment env, AtomicLong milestone, CaseEnum caseEnum, string uniqueFields, string whereClause, bool unique, IndexAssertionEventSend assertion) { SupportQueryPlanIndexHook.Reset(); var eplUnique = IndexBackingTableInfo.INDEX_CALLBACK_HOOK + "@Name('s0') select * from "; if (caseEnum == CaseEnum.UNIDIRECTIONAL || caseEnum == CaseEnum.UNIDIRECTIONAL_3STREAM) { eplUnique += "SupportSimpleBeanOne as ssb1 unidirectional "; } else { eplUnique += "SupportSimpleBeanOne#lastevent as ssb1 "; } eplUnique += ", SupportSimpleBeanTwo#unique(" + uniqueFields + ") as ssb2 "; if (caseEnum == CaseEnum.UNIDIRECTIONAL_3STREAM || caseEnum == CaseEnum.MULTIDIRECTIONAL_3STREAM) { eplUnique += ", SupportBean#lastevent "; } eplUnique += whereClause; env.CompileDeployAddListenerMile(eplUnique, "s0", milestone.GetAndIncrement()); SupportQueryPlanIndexHook.AssertJoinOneStreamAndReset(unique); env.SendEventBean(new SupportBean("JOINEVENT", 1)); assertion.Invoke(); env.UndeployAll(); }
public void TestMultiIdxConstants() { SupportQueryPlanIndexHook.Reset(); var epl = INDEX_CALLBACK_HOOK + "select * from S0 as s0 unidirectional, S1.win:keepall() as s1 " + "where 'a' in (p10, p11)"; var fields = "s0.id,s1.id".Split(','); var stmt = _epService.EPAdministrator.CreateEPL(epl); stmt.AddListener(_listener); var items = SupportQueryPlanIndexHook.AssertJoinAndReset().IndexSpecs[1].Items; Assert.AreEqual("[p10][p11]", SupportQueryPlanIndexHelper.GetIndexedExpressions(items)); _epService.EPRuntime.SendEvent(new SupportBean_S1(100, "x", "y")); _epService.EPRuntime.SendEvent(new SupportBean_S1(101, "x", "a")); _epService.EPRuntime.SendEvent(new SupportBean_S0(1)); EPAssertionUtil.AssertPropsPerRowAnyOrder(_listener.GetAndResetLastNewData(), fields, new object[][] { new object[] { 1, 101 } }); _epService.EPRuntime.SendEvent(new SupportBean_S1(102, "b", "a")); _epService.EPRuntime.SendEvent(new SupportBean_S0(2)); EPAssertionUtil.AssertPropsPerRowAnyOrder(_listener.GetAndResetLastNewData(), fields, new object[][] { new object[] { 2, 101 }, new object[] { 2, 102 } }); }
public override void Run(EPServiceProvider epService) { SupportQueryPlanIndexHook.Reset(); var fields = new string[] { "TheString", "IntPrimitive" }; // create window string stmtTextCreate = "create window MyWindow#keepall as select * from " + typeof(SupportBean).FullName; EPStatement stmtCreate = epService.EPAdministrator.CreateEPL(stmtTextCreate); // create insert into string stmtTextInsertOne = "insert into MyWindow select * from " + typeof(SupportBean).FullName + "(TheString like 'E%')"; epService.EPAdministrator.CreateEPL(stmtTextInsertOne); // create on-select stmt string stmtTextSelect = "on " + typeof(SupportBean_A).FullName + " insert into MyStream select mywin.* from MyWindow as mywin order by TheString asc"; EPStatement stmtSelect = epService.EPAdministrator.CreateEPL(stmtTextSelect); var listenerSelect = new SupportUpdateListener(); stmtSelect.Events += listenerSelect.Update; Assert.AreEqual(StatementType.ON_INSERT, ((EPStatementSPI)stmtSelect).StatementMetadata.StatementType); // create consuming statement string stmtTextConsumer = "select * from default.MyStream"; EPStatement stmtConsumer = epService.EPAdministrator.CreateEPL(stmtTextConsumer); var listenerConsumer = new SupportUpdateListener(); stmtConsumer.Events += listenerConsumer.Update; // create second inserting statement string stmtTextInsertTwo = "insert into MyStream select * from " + typeof(SupportBean).FullName + "(TheString like 'I%')"; epService.EPAdministrator.CreateEPL(stmtTextInsertTwo); // send event SendSupportBean(epService, "E1", 1); Assert.IsFalse(listenerSelect.IsInvoked); Assert.IsFalse(listenerConsumer.IsInvoked); EPAssertionUtil.AssertPropsPerRow(stmtCreate.GetEnumerator(), fields, new object[][] { new object[] { "E1", 1 } }); // fire trigger SendSupportBean_A(epService, "A1"); EPAssertionUtil.AssertProps(listenerSelect.AssertOneGetNewAndReset(), fields, new object[] { "E1", 1 }); EPAssertionUtil.AssertProps(listenerConsumer.AssertOneGetNewAndReset(), fields, new object[] { "E1", 1 }); // insert via 2nd insert into SendSupportBean(epService, "I2", 2); Assert.IsFalse(listenerSelect.IsInvoked); EPAssertionUtil.AssertProps(listenerConsumer.AssertOneGetNewAndReset(), fields, new object[] { "I2", 2 }); EPAssertionUtil.AssertPropsPerRow(stmtCreate.GetEnumerator(), fields, new object[][] { new object[] { "E1", 1 } }); // send event SendSupportBean(epService, "E3", 3); Assert.IsFalse(listenerSelect.IsInvoked); Assert.IsFalse(listenerConsumer.IsInvoked); EPAssertionUtil.AssertPropsPerRow(stmtCreate.GetEnumerator(), fields, new object[][] { new object[] { "E1", 1 }, new object[] { "E3", 3 } }); // fire trigger SendSupportBean_A(epService, "A2"); Assert.AreEqual(1, listenerSelect.NewDataList.Count); EPAssertionUtil.AssertPropsPerRow(listenerSelect.LastNewData, fields, new object[][] { new object[] { "E1", 1 }, new object[] { "E3", 3 } }); listenerSelect.Reset(); Assert.AreEqual(2, listenerConsumer.NewDataList.Count); EPAssertionUtil.AssertPropsPerRow(listenerConsumer.GetNewDataListFlattened(), fields, new object[][] { new object[] { "E1", 1 }, new object[] { "E3", 3 } }); listenerConsumer.Reset(); // check type EventType consumerType = stmtConsumer.EventType; Assert.AreEqual(typeof(string), consumerType.GetPropertyType("TheString")); Assert.IsTrue(consumerType.PropertyNames.Length > 10); Assert.AreEqual(typeof(SupportBean), consumerType.UnderlyingType); // check type EventType onSelectType = stmtSelect.EventType; Assert.AreEqual(typeof(string), onSelectType.GetPropertyType("TheString")); Assert.IsTrue(onSelectType.PropertyNames.Length > 10); Assert.AreEqual(typeof(SupportBean), onSelectType.UnderlyingType); // delete all from named window string stmtTextDelete = "on " + typeof(SupportBean_B).FullName + " delete from MyWindow"; epService.EPAdministrator.CreateEPL(stmtTextDelete); SendSupportBean_B(epService, "B1"); // fire trigger - nothing to insert SendSupportBean_A(epService, "A3"); stmtConsumer.Dispose(); stmtSelect.Dispose(); stmtCreate.Dispose(); }
public void Run(RegressionEnvironment env) { SupportQueryPlanIndexHook.Reset(); string[] fields = {"TheString", "IntPrimitive"}; var path = new RegressionPath(); var epl = "@Name('create') create window MyWindow#keepall as select * from SupportBean;\n" + "insert into MyWindow select * from SupportBean(TheString like 'E%');\n" + "@Name('select') on SupportBean_A insert into MyStream select mywin.* from MyWindow as mywin order by TheString asc;\n" + "@Name('consumer') select * from MyStream;\n" + "insert into MyStream select * from SupportBean(TheString like 'I%');\n"; env.CompileDeploy(epl, path).AddListener("select").AddListener("consumer"); Assert.AreEqual( StatementType.ON_INSERT, env.Statement("select").GetProperty(StatementProperty.STATEMENTTYPE)); // send event SendSupportBean(env, "E1", 1); Assert.IsFalse(env.Listener("select").IsInvoked); Assert.IsFalse(env.Listener("consumer").IsInvoked); EPAssertionUtil.AssertPropsPerRow( env.GetEnumerator("create"), fields, new[] {new object[] {"E1", 1}}); // fire trigger SendSupportBean_A(env, "A1"); EPAssertionUtil.AssertProps( env.Listener("select").AssertOneGetNewAndReset(), fields, new object[] {"E1", 1}); EPAssertionUtil.AssertProps( env.Listener("consumer").AssertOneGetNewAndReset(), fields, new object[] {"E1", 1}); // insert via 2nd insert into SendSupportBean(env, "I2", 2); Assert.IsFalse(env.Listener("select").IsInvoked); EPAssertionUtil.AssertProps( env.Listener("consumer").AssertOneGetNewAndReset(), fields, new object[] {"I2", 2}); EPAssertionUtil.AssertPropsPerRow( env.GetEnumerator("create"), fields, new[] {new object[] {"E1", 1}}); // send event SendSupportBean(env, "E3", 3); Assert.IsFalse(env.Listener("select").IsInvoked); Assert.IsFalse(env.Listener("consumer").IsInvoked); EPAssertionUtil.AssertPropsPerRow( env.GetEnumerator("create"), fields, new[] {new object[] {"E1", 1}, new object[] {"E3", 3}}); // fire trigger SendSupportBean_A(env, "A2"); Assert.AreEqual(1, env.Listener("select").NewDataList.Count); EPAssertionUtil.AssertPropsPerRow( env.Listener("select").LastNewData, fields, new[] {new object[] {"E1", 1}, new object[] {"E3", 3}}); env.Listener("select").Reset(); Assert.AreEqual(2, env.Listener("consumer").NewDataList.Count); EPAssertionUtil.AssertPropsPerRow( env.Listener("consumer").NewDataListFlattened, fields, new[] {new object[] {"E1", 1}, new object[] {"E3", 3}}); env.Listener("consumer").Reset(); // check type var consumerType = env.Statement("consumer").EventType; Assert.AreEqual(typeof(string), consumerType.GetPropertyType("TheString")); Assert.IsTrue(consumerType.PropertyNames.Length > 10); Assert.AreEqual(typeof(SupportBean), consumerType.UnderlyingType); // check type var onSelectType = env.Statement("select").EventType; Assert.AreEqual(typeof(string), onSelectType.GetPropertyType("TheString")); Assert.IsTrue(onSelectType.PropertyNames.Length > 10); Assert.AreEqual(typeof(SupportBean), onSelectType.UnderlyingType); // delete all from named window var stmtTextDelete = "@Name('delete') on SupportBean_B delete from MyWindow"; env.CompileDeploy(stmtTextDelete, path); SendSupportBean_B(env, "B1"); // fire trigger - nothing to insert SendSupportBean_A(env, "A3"); env.UndeployModuleContaining("delete"); env.UndeployModuleContaining("create"); }
private void RunAssertionSingleIdxSubquery(EPServiceProvider epService) { SupportQueryPlanIndexHook.Reset(); var epl = INDEX_CALLBACK_HOOK + "select s1.Id as c0," + "(select * from S0#keepall as s0 " + " where s0.P00 in (s1.P10, s1.P11) and s0.P01 in (s1.P12, s1.P13))" + ".selectFrom(a=>S0.Id) as c1 " + " from S1 as s1"; var stmt = epService.EPAdministrator.CreateEPL(epl); var listener = new SupportUpdateListener(); stmt.Events += listener.Update; var subquery = SupportQueryPlanIndexHook.AssertSubqueryAndReset(); Assert.AreEqual(typeof(SubordInKeywordSingleTableLookupStrategyFactory).Name, subquery.TableLookupStrategy); // single row tests epService.EPRuntime.SendEvent(new SupportBean_S0(100, "a", "c")); epService.EPRuntime.SendEvent(new SupportBean_S1(1, "a1", "b", "c", "d")); AssertSubqueryC0C1(listener, 1, null); epService.EPRuntime.SendEvent(new SupportBean_S1(2, "a", "b", "x", "d")); AssertSubqueryC0C1(listener, 2, null); epService.EPRuntime.SendEvent(new SupportBean_S1(3, "a", "b", "c", "d")); AssertSubqueryC0C1(listener, 3, new int?[] {100}); epService.EPRuntime.SendEvent(new SupportBean_S1(4, "x", "a", "x", "c")); AssertSubqueryC0C1(listener, 4, new int?[] {100}); // 2-rows available tests epService.EPRuntime.SendEvent(new SupportBean_S0(101, "a", "d")); epService.EPRuntime.SendEvent(new SupportBean_S1(10, "a1", "b", "c", "d")); AssertSubqueryC0C1(listener, 10, null); epService.EPRuntime.SendEvent(new SupportBean_S1(11, "a", "b", "x", "c1")); AssertSubqueryC0C1(listener, 11, null); epService.EPRuntime.SendEvent(new SupportBean_S1(12, "a", "b", "c", "d")); AssertSubqueryC0C1(listener, 12, new int?[] {100, 101}); epService.EPRuntime.SendEvent(new SupportBean_S1(13, "x", "a", "x", "c")); AssertSubqueryC0C1(listener, 13, new int?[] {100}); epService.EPRuntime.SendEvent(new SupportBean_S1(14, "x", "a", "d", "x")); AssertSubqueryC0C1(listener, 14, new int?[] {101}); // 3-rows available tests epService.EPRuntime.SendEvent(new SupportBean_S0(102, "b", "c")); epService.EPRuntime.SendEvent(new SupportBean_S1(20, "a1", "b", "c1", "d")); AssertSubqueryC0C1(listener, 20, null); epService.EPRuntime.SendEvent(new SupportBean_S1(21, "a", "b", "x", "c1")); AssertSubqueryC0C1(listener, 21, null); epService.EPRuntime.SendEvent(new SupportBean_S1(22, "a", "b", "c", "d")); AssertSubqueryC0C1(listener, 22, new int?[] {100, 101, 102}); epService.EPRuntime.SendEvent(new SupportBean_S1(23, "b", "a", "x", "c")); AssertSubqueryC0C1(listener, 23, new int?[] {100, 102}); epService.EPRuntime.SendEvent(new SupportBean_S1(24, "b", "a", "d", "c")); AssertSubqueryC0C1(listener, 24, new int?[] {100, 101, 102}); epService.EPRuntime.SendEvent(new SupportBean_S1(25, "b", "x", "x", "c")); AssertSubqueryC0C1(listener, 25, new int?[] {102}); stmt.Dispose(); // test coercion absence - types the same var eplCoercion = INDEX_CALLBACK_HOOK + "select *," + "(select * from SupportBean#keepall as sb where sb.LongPrimitive in (s0.Id)) from S0 as s0"; stmt = epService.EPAdministrator.CreateEPL(eplCoercion); var subqueryCoercion = SupportQueryPlanIndexHook.AssertSubqueryAndReset(); Assert.AreEqual( typeof(SubordFullTableScanLookupStrategyFactory).Name, subqueryCoercion.TableLookupStrategy); stmt.Dispose(); }
public void TestSingleIdxSubquery() { SupportQueryPlanIndexHook.Reset(); var epl = INDEX_CALLBACK_HOOK + "select s1.id as c0," + "(select * from S0.win:keepall() as s0 " + " where s0.p00 in (s1.p10, s1.p11) and s0.p01 in (s1.p12, s1.p13))" + ".selectFrom(a=>S0.id) as c1 " + " from S1 as s1"; var stmt = _epService.EPAdministrator.CreateEPL(epl); stmt.AddListener(_listener); var subquery = SupportQueryPlanIndexHook.AssertSubqueryAndReset(); Assert.AreEqual(typeof(SubordInKeywordSingleTableLookupStrategyFactory).Name, subquery.TableLookupStrategy); // single row tests _epService.EPRuntime.SendEvent(new SupportBean_S0(100, "a", "c")); _epService.EPRuntime.SendEvent(new SupportBean_S1(1, "a1", "b", "c", "d")); AssertSubqueryC0C1(1, null); _epService.EPRuntime.SendEvent(new SupportBean_S1(2, "a", "b", "x", "d")); AssertSubqueryC0C1(2, null); _epService.EPRuntime.SendEvent(new SupportBean_S1(3, "a", "b", "c", "d")); AssertSubqueryC0C1(3, new int?[] { 100 }); _epService.EPRuntime.SendEvent(new SupportBean_S1(4, "x", "a", "x", "c")); AssertSubqueryC0C1(4, new int?[] { 100 }); // 2-rows available tests _epService.EPRuntime.SendEvent(new SupportBean_S0(101, "a", "d")); _epService.EPRuntime.SendEvent(new SupportBean_S1(10, "a1", "b", "c", "d")); AssertSubqueryC0C1(10, null); _epService.EPRuntime.SendEvent(new SupportBean_S1(11, "a", "b", "x", "c1")); AssertSubqueryC0C1(11, null); _epService.EPRuntime.SendEvent(new SupportBean_S1(12, "a", "b", "c", "d")); AssertSubqueryC0C1(12, new int?[] { 100, 101 }); _epService.EPRuntime.SendEvent(new SupportBean_S1(13, "x", "a", "x", "c")); AssertSubqueryC0C1(13, new int?[] { 100 }); _epService.EPRuntime.SendEvent(new SupportBean_S1(14, "x", "a", "d", "x")); AssertSubqueryC0C1(14, new int?[] { 101 }); // 3-rows available tests _epService.EPRuntime.SendEvent(new SupportBean_S0(102, "b", "c")); _epService.EPRuntime.SendEvent(new SupportBean_S1(20, "a1", "b", "c1", "d")); AssertSubqueryC0C1(20, null); _epService.EPRuntime.SendEvent(new SupportBean_S1(21, "a", "b", "x", "c1")); AssertSubqueryC0C1(21, null); _epService.EPRuntime.SendEvent(new SupportBean_S1(22, "a", "b", "c", "d")); AssertSubqueryC0C1(22, new int?[] { 100, 101, 102 }); _epService.EPRuntime.SendEvent(new SupportBean_S1(23, "b", "a", "x", "c")); AssertSubqueryC0C1(23, new int?[] { 100, 102 }); _epService.EPRuntime.SendEvent(new SupportBean_S1(24, "b", "a", "d", "c")); AssertSubqueryC0C1(24, new int?[] { 100, 101, 102 }); _epService.EPRuntime.SendEvent(new SupportBean_S1(25, "b", "x", "x", "c")); AssertSubqueryC0C1(25, new int?[] { 102 }); // test coercion absence - types the same var eplCoercion = INDEX_CALLBACK_HOOK + "select *," + "(select * from SupportBean.win:keepall() as sb where sb.LongPrimitive in (s0.id)) from S0 as s0"; _epService.EPAdministrator.CreateEPL(eplCoercion); var subqueryCoercion = SupportQueryPlanIndexHook.AssertSubqueryAndReset(); Assert.AreEqual(typeof(SubordFullTableScanLookupStrategyFactory).Name, subqueryCoercion.TableLookupStrategy); }