public void testLateStartIndex() { // prepare preloadData(false); // test join String eplJoin = "select * from SupportBean_S0 as s0 unidirectional, AWindow(p00='x') as aw where aw.id = s0.id"; epService.getEPAdministrator().createEPL(eplJoin).addListener(listener); assertEquals(2, MyCountAccessEvent.getAndResetCountGetterCalled()); epService.getEPRuntime().sendEvent(new SupportBean_S0(-1, "x")); assertTrue(listener.getAndClearIsInvoked()); // test subquery no-index-share String eplSubqueryNoIndexShare = "select (select id from AWindow(p00='x') as aw where aw.id = s0.id) " + "from SupportBean_S0 as s0 unidirectional"; epService.getEPAdministrator().createEPL(eplSubqueryNoIndexShare).addListener(listener); assertEquals(2, MyCountAccessEvent.getAndResetCountGetterCalled()); epService.getEPRuntime().sendEvent(new SupportBean_S0(-1, "x")); // test subquery with index share epService.getEPAdministrator().destroyAllStatements(); preloadData(true); String eplSubqueryWithIndexShare = "select (select id from AWindow(p00='x') as aw where aw.id = s0.id) " + "from SupportBean_S0 as s0 unidirectional"; epService.getEPAdministrator().createEPL(eplSubqueryWithIndexShare).addListener(listener); assertEquals(2, MyCountAccessEvent.getAndResetCountGetterCalled()); epService.getEPRuntime().sendEvent(new SupportBean_S0(-1, "x")); assertTrue(listener.isInvoked()); }
private void preloadData(boolean indexShare) { String createEpl = "create window AWindow.win:keepall() as MyCountAccessEvent"; if (indexShare) { createEpl = "@Hint('enable_window_subquery_indexshare') " + createEpl; } epService.getEPAdministrator().createEPL(createEpl); epService .getEPAdministrator() .createEPL("insert into AWindow select * from MyCountAccessEvent"); epService.getEPAdministrator().createEPL("create index I1 on AWindow(p00)"); MyCountAccessEvent.getAndResetCountGetterCalled(); for (int i = 0; i < 100; i++) { epService.getEPRuntime().sendEvent(new MyCountAccessEvent(i, "E" + i)); } epService.getEPRuntime().sendEvent(new MyCountAccessEvent(-1, "x")); assertEquals(101, MyCountAccessEvent.getAndResetCountGetterCalled()); }