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 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 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(); }
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(); }
private void AssertIndexChoice(EPServiceProvider epService, string hint, string expectedIndexName) { var epl = IndexBackingTableInfo.INDEX_CALLBACK_HOOK + hint + "on SupportSpatialAABB as aabb select mpw.id as c0 from MyPointWindow as mpw " + "where aabb.category = mpw.category and point(px, py).inside(rectangle(x, y, width, height))\n"; var stmt = epService.EPAdministrator.CreateEPL(epl); var listener = new SupportUpdateListener(); stmt.Events += listener.Update; var plan = SupportQueryPlanIndexHook.AssertOnExprAndReset(); Assert.AreEqual(expectedIndexName, plan.Tables[0].IndexName); epService.EPRuntime.SendEvent(new SupportSpatialAABB("R1", 9, 14, 1.0001, 1.0001, "Y")); Assert.AreEqual("P2", listener.AssertOneGetNewAndReset().Get("c0")); stmt.Dispose(); }