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 = 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 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 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) { // 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 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(); }
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 } }); }