public void Run(RegressionEnvironment env) { var milestone = new AtomicLong(); var filtersAB = new[] { "(TheString = 'a' and IntPrimitive = 1) or (TheString = 'b' and IntPrimitive = 2)", "(IntPrimitive = 1 and TheString = 'a') or (IntPrimitive = 2 and TheString = 'b')", "(TheString = 'b' and IntPrimitive = 2) or (TheString = 'a' and IntPrimitive = 1)", }; foreach (var filter in filtersAB) { var epl = "@Name('s0') select * from SupportBean(" + filter + ")"; env.CompileDeployAddListenerMile(epl, "s0", milestone.GetAndIncrement()); if (SupportFilterOptimizableHelper.HasFilterIndexPlanBasicOrMore(env)) { SupportFilterServiceHelper.AssertFilterSvcByTypeMulti( env.Statement("s0"), "SupportBean", new[] { new[] {new FilterItem("TheString", FilterOperator.EQUAL), new FilterItem("IntPrimitive", FilterOperator.EQUAL)}, new[] {new FilterItem("TheString", FilterOperator.EQUAL), new FilterItem("IntPrimitive", FilterOperator.EQUAL)}, }); } SendAssertEvents( env, new[] {MakeEvent("a", 1), MakeEvent("b", 2)}, new[] {MakeEvent("x", 0), MakeEvent("a", 0), MakeEvent("a", 2), MakeEvent("b", 1)} ); env.UndeployAll(); } }
public void Run(RegressionEnvironment env) { var milestone = new AtomicLong(); // test 'or' rewrite var filtersAB = new[] { "select * from SupportBean(TheString = 'a' or IntPrimitive = 1)", "select * from SupportBean(TheString = 'a' or 1 = IntPrimitive)", "select * from SupportBean('a' = TheString or 1 = IntPrimitive)", "select * from SupportBean('a' = TheString or IntPrimitive = 1)", }; foreach (var filter in filtersAB) { env.CompileDeployAddListenerMile("@Name('s0')" + filter, "s0", milestone.GetAndIncrement()); if (SupportFilterOptimizableHelper.HasFilterIndexPlanBasicOrMore(env)) { SupportFilterServiceHelper.AssertFilterSvcByTypeMulti( env.Statement("s0"), "SupportBean", new[] { new[] {new FilterItem("IntPrimitive", FilterOperator.EQUAL)}, new[] {new FilterItem("TheString", FilterOperator.EQUAL)}, }); } env.SendEventBean(new SupportBean("a", 0)); env.Listener("s0").AssertOneGetNewAndReset(); env.SendEventBean(new SupportBean("b", 1)); env.Listener("s0").AssertOneGetNewAndReset(); env.SendEventBean(new SupportBean("c", 0)); Assert.IsFalse(env.Listener("s0").GetAndClearIsInvoked()); env.UndeployAll(); } }
public void Run(RegressionEnvironment env) { var milestone = new AtomicLong(); var filters = new[] { "A!=1 and A!=2 and (B=1 or C=1)", }; foreach (var filter in filters) { var epl = "@Name('s0') select * from SupportBean_IntAlphabetic(" + filter + ")"; env.CompileDeployAddListenerMile(epl, "s0", milestone.GetAndIncrement()); if (SupportFilterOptimizableHelper.HasFilterIndexPlanBasicOrMore(env)) { SupportFilterServiceHelper.AssertFilterSvcByTypeMulti( env.Statement("s0"), "SupportBean_IntAlphabetic", new[] { new[] {new FilterItem("A", FilterOperator.NOT_IN_LIST_OF_VALUES), new FilterItem("B", FilterOperator.EQUAL)}, new[] {new FilterItem("A", FilterOperator.NOT_IN_LIST_OF_VALUES), new FilterItem("C", FilterOperator.EQUAL)}, }); } SendAssertEvents( env, new object[] {IntEvent(3, 1, 0), IntEvent(3, 0, 1), IntEvent(0, 1, 0)}, new object[] {IntEvent(2, 0, 0), IntEvent(1, 0, 0), IntEvent(3, 0, 0)} ); env.UndeployAll(); } }
public void Run(RegressionEnvironment env) { var milestone = new AtomicLong(); var filters = new[] { "A like 'a%' and (B='b' or C='c')", }; foreach (var filter in filters) { var epl = "@Name('s0') select * from SupportBean_StringAlphabetic(" + filter + ")"; env.CompileDeployAddListenerMile(epl, "s0", milestone.GetAndIncrement()); if (SupportFilterOptimizableHelper.HasFilterIndexPlanBasic(env)) { SupportFilterServiceHelper.AssertFilterSvcByTypeMulti( env.Statement("s0"), "SupportBean_StringAlphabetic", new[] { new[] {new FilterItem("B", FilterOperator.EQUAL), FilterItem.BoolExprFilterItem}, new[] {new FilterItem("C", FilterOperator.EQUAL), FilterItem.BoolExprFilterItem}, }); } SendAssertEvents( env, new object[] {StringEvent("a1", "b", null), StringEvent("a1", null, "c")}, new object[] {StringEvent("x", "b", null), StringEvent("a1", null, null), StringEvent("a1", null, "x")} ); env.UndeployAll(); } }
public void Run(RegressionEnvironment env) { if (SupportFilterOptimizableHelper.HasFilterIndexPlanBasicOrMore(env)) { // we do not coerce TryInvalidFilter(env, "select * from SupportBean(IntPrimitive in (1L, 10L))"); TryInvalidFilter(env, "select * from SupportBean(IntPrimitive in (1, 10L))"); TryInvalidFilter(env, "select * from SupportBean(IntPrimitive in (1, 'x'))"); var expr = "select * from pattern [a=SupportBean -> b=SupportBean(IntPrimitive in (a.LongPrimitive, a.LongBoxed))]"; TryInvalidFilter(env, expr); } }
public void Run(RegressionEnvironment env) { var milestone = new AtomicLong(); var filtersAB = new[] { "TheString = 'a' or IntPrimitive=1 or LongPrimitive=10 or DoublePrimitive=100 or BoolPrimitive=true or " + "IntBoxed=2 or LongBoxed=20 or DoubleBoxed=200", "LongBoxed=20 or TheString = 'a' or BoolPrimitive=true or IntBoxed=2 or LongPrimitive=10 or DoublePrimitive=100 or " + "IntPrimitive=1 or DoubleBoxed=200", }; foreach (var filter in filtersAB) { var epl = "@Name('s0') select * from SupportBean(" + filter + ")"; env.CompileDeployAddListenerMile(epl, "s0", milestone.GetAndIncrement()); if (SupportFilterOptimizableHelper.HasFilterIndexPlanBasicOrMore(env)) { SupportFilterServiceHelper.AssertFilterSvcByTypeMulti( env.Statement("s0"), "SupportBean", new[] { new[] {new FilterItem("TheString", FilterOperator.EQUAL)}, new[] {new FilterItem("IntPrimitive", FilterOperator.EQUAL)}, new[] {new FilterItem("LongPrimitive", FilterOperator.EQUAL)}, new[] {new FilterItem("DoublePrimitive", FilterOperator.EQUAL)}, new[] {new FilterItem("BoolPrimitive", FilterOperator.EQUAL)}, new[] {new FilterItem("IntBoxed", FilterOperator.EQUAL)}, new[] {new FilterItem("LongBoxed", FilterOperator.EQUAL)}, new[] {new FilterItem("DoubleBoxed", FilterOperator.EQUAL)}, }); } SendAssertEvents( env, new[] { MakeEvent("a", 1, 10, 100, true, 2, 20, 200), MakeEvent("a", 0, 0, 0, true, 0, 0, 0), MakeEvent("a", 0, 0, 0, true, 0, 20, 0), MakeEvent("x", 0, 0, 100, false, 0, 0, 0), MakeEvent("x", 1, 0, 0, false, 0, 0, 200), MakeEvent("x", 0, 0, 0, false, 0, 0, 200), }, new[] {MakeEvent("x", 0, 0, 0, false, 0, 0, 0)} ); env.UndeployAll(); } }