public override bool IsExistsProperty(EventBean eventBean)
 {
     return(true); // Property exists as the property is not dynamic (unchecked)
 }
 public bool IsExistsProperty(EventBean eventBean)
 {
     var record = (GenericRecord) eventBean.Underlying;
     var inner = (GenericRecord) record.Get(_top);
     return AvroEventBeanGetterDynamicPoly.GetAvroFieldValuePolyExists(inner, _getters);
 }
 public ICollection<object> EvaluateEventGetROCollectionScalar(
     EventBean @event,
     ExprEvaluatorContext context)
 {
     return EvaluateInternal<object>(@event);
 }
Example #4
0
 // Users are assigned an index
 public EventBean GetRelativeToEvent(
     EventBean theEvent,
     int priorToIndex)
 {
     return priorEventMap.Get(theEvent);
 }
        public EventBean Process(EventBean[] eventsPerStream, bool isNewData, bool isSynthesize, ExprEvaluatorContext exprEvaluatorContext)
        {
            EventBean theEvent = _joinWildcardProcessor.Process(eventsPerStream, isNewData, isSynthesize, exprEvaluatorContext);

            return(_vaeProcessor.GetValueAddEventBean(theEvent));
        }
Example #6
0
 public override EventBean ProcessFirstCol(Object result)
 {
     EventBean wrappedEvent = base.EventAdapterService.AdapterForTypedMap(
         (IDictionary<string, object>) result, Wrapper.UnderlyingEventType);
     return base.EventAdapterService.AdapterForTypedWrapper(wrappedEvent, Collections.EmptyDataMap, Wrapper);
 }
Example #7
0
        public void TestCaseSyntax2StringsNBranches()
        {
            // Test of the various coercion user cases.
            String caseExpr = "select case IntPrimitive" +
                              " when 1 then CompatExtensions.Render(BoolPrimitive) " +
                              " when 2 then CompatExtensions.Render(BoolBoxed) " +
                              " when 3 then CompatExtensions.Render(IntPrimitive) " +
                              " when 4 then CompatExtensions.Render(IntBoxed)" +
                              " when 5 then CompatExtensions.Render(LongPrimitive) " +
                              " when 6 then CompatExtensions.Render(LongBoxed) " +
                              " when 7 then CompatExtensions.Render(CharPrimitive) " +
                              " when 8 then CompatExtensions.Render(CharBoxed) " +
                              " when 9 then CompatExtensions.Render(ShortPrimitive) " +
                              " when 10 then CompatExtensions.Render(ShortBoxed) " +
                              " when 11 then CompatExtensions.Render(BytePrimitive) " +
                              " when 12 then CompatExtensions.Render(ByteBoxed) " +
                              " when 13 then CompatExtensions.Render(FloatPrimitive) " +
                              " when 14 then CompatExtensions.Render(FloatBoxed) " +
                              " when 15 then CompatExtensions.Render(DoublePrimitive) " +
                              " when 16 then CompatExtensions.Render(DoubleBoxed) " +
                              " when 17 then TheString " +
                              " else 'x' end as p1 " +
                              " from " + typeof(SupportBean).FullName + ".win:length(1)";

            EPStatement selectTestCase = _epService.EPAdministrator.CreateEPL(caseExpr);

            selectTestCase.Events += _testListener.Update;
            Assert.AreEqual(typeof(string), selectTestCase.EventType.GetPropertyType("p1"));

            SendSupportBeanEvent(true, false, 1, 0, 0L, 0L, '0', 'a', 0, 0, 0, (0), 0.0f, 0f, 0.0, 0.0, null, SupportEnum.ENUM_VALUE_1);
            EventBean theEvent = _testListener.GetAndResetLastNewData()[0];

            Assert.AreEqual("True", theEvent.Get("p1"));

            SendSupportBeanEvent(true, false, 2, 0, 0L, 0L, '0', 'a', 0, 0, 0, (0), 0.0f, 0f, 0.0, 0.0, null, SupportEnum.ENUM_VALUE_1);
            theEvent = _testListener.GetAndResetLastNewData()[0];
            Assert.AreEqual("False", theEvent.Get("p1"));

            SendSupportBeanEvent(true, false, 3, 0, 0L, 0L, '0', 'a', 0, 0, 0, (0), 0.0f, 0f, 0.0, 0.0, null, SupportEnum.ENUM_VALUE_1);
            theEvent = _testListener.GetAndResetLastNewData()[0];
            Assert.AreEqual("3", theEvent.Get("p1"));

            SendSupportBeanEvent(true, false, 4, 4, 0L, 0L, '0', 'a', 0, 0, 0, (0), 0.0f, 0f, 0.0, 0.0, null, SupportEnum.ENUM_VALUE_1);
            theEvent = _testListener.GetAndResetLastNewData()[0];
            Assert.AreEqual("4", theEvent.Get("p1"));

            SendSupportBeanEvent(true, false, 5, 0, 5L, 0L, '0', 'a', 0, 0, 0, (0), 0.0f, 0f, 0.0, 0.0, null, SupportEnum.ENUM_VALUE_1);
            theEvent = _testListener.GetAndResetLastNewData()[0];
            Assert.AreEqual("5", theEvent.Get("p1"));

            SendSupportBeanEvent(true, false, 6, 0, 0L, 6L, '0', 'a', 0, 0, 0, (0), 0.0f, 0f, 0.0, 0.0, null, SupportEnum.ENUM_VALUE_1);
            theEvent = _testListener.GetAndResetLastNewData()[0];
            Assert.AreEqual("6", theEvent.Get("p1"));

            SendSupportBeanEvent(true, false, 7, 0, 0L, 0L, 'A', 'a', 0, 0, 0, (0), 0.0f, 0f, 0.0, 0.0, null, SupportEnum.ENUM_VALUE_1);
            theEvent = _testListener.GetAndResetLastNewData()[0];
            Assert.AreEqual("A", theEvent.Get("p1"));

            SendSupportBeanEvent(true, false, 8, 0, 0L, 0L, 'A', 'a', 0, 0, 0, (0), 0.0f, 0f, 0.0, 0.0, null, SupportEnum.ENUM_VALUE_1);
            theEvent = _testListener.GetAndResetLastNewData()[0];
            Assert.AreEqual("a", theEvent.Get("p1"));

            SendSupportBeanEvent(true, false, 9, 0, 0L, 0L, 'A', 'a', 9, 0, 0, (0), 0.0f, 0f, 0.0, 0.0, null, SupportEnum.ENUM_VALUE_1);
            theEvent = _testListener.GetAndResetLastNewData()[0];
            Assert.AreEqual("9", theEvent.Get("p1"));

            SendSupportBeanEvent(true, false, 10, 0, 0L, 0L, 'A', 'a', 9, 10, 11, (12), 13.0f, 14f, 15.0, 16.0, "testCoercion", SupportEnum.ENUM_VALUE_1);
            theEvent = _testListener.GetAndResetLastNewData()[0];
            Assert.AreEqual("10", theEvent.Get("p1"));

            SendSupportBeanEvent(true, false, 11, 0, 0L, 0L, 'A', 'a', 9, 10, 11, (12), 13.0f, 14f, 15.0, 16.0, "testCoercion", SupportEnum.ENUM_VALUE_1);
            theEvent = _testListener.GetAndResetLastNewData()[0];
            Assert.AreEqual("11", theEvent.Get("p1"));

            SendSupportBeanEvent(true, false, 12, 0, 0L, 0L, 'A', 'a', 9, 10, 11, (12), 13.0f, 14f, 15.0, 16.0, "testCoercion", SupportEnum.ENUM_VALUE_1);
            theEvent = _testListener.GetAndResetLastNewData()[0];
            Assert.AreEqual("12", theEvent.Get("p1"));

            SendSupportBeanEvent(true, false, 13, 0, 0L, 0L, 'A', 'a', 9, 10, 11, (12), 13.0f, 14f, 15.0, 16.0, "testCoercion", SupportEnum.ENUM_VALUE_1);
            theEvent = _testListener.GetAndResetLastNewData()[0];
            Assert.AreEqual("13.0", theEvent.Get("p1"));

            SendSupportBeanEvent(true, false, 14, 0, 0L, 0L, 'A', 'a', 9, 10, 11, (12), 13.0f, 14f, 15.0, 16.0, "testCoercion", SupportEnum.ENUM_VALUE_1);
            theEvent = _testListener.GetAndResetLastNewData()[0];
            Assert.AreEqual("14.0", theEvent.Get("p1"));

            SendSupportBeanEvent(true, false, 15, 0, 0L, 0L, 'A', 'a', 9, 10, 11, (12), 13.0f, 14f, 15.0, 16.0, "testCoercion", SupportEnum.ENUM_VALUE_1);
            theEvent = _testListener.GetAndResetLastNewData()[0];
            Assert.AreEqual("15.0", theEvent.Get("p1"));

            SendSupportBeanEvent(true, false, 16, 0, 0L, 0L, 'A', 'a', 9, 10, 11, (12), 13.0f, 14f, 15.0, 16.0, "testCoercion", SupportEnum.ENUM_VALUE_1);
            theEvent = _testListener.GetAndResetLastNewData()[0];
            Assert.AreEqual("16.0", theEvent.Get("p1"));

            SendSupportBeanEvent(true, false, 17, 0, 0L, 0L, 'A', 'a', 9, 10, 11, (12), 13.0f, 14f, 15.0, 16.0, "testCoercion", SupportEnum.ENUM_VALUE_1);
            theEvent = _testListener.GetAndResetLastNewData()[0];
            Assert.AreEqual("testCoercion", theEvent.Get("p1"));

            SendSupportBeanEvent(true, false, -1, 0, 0L, 0L, 'A', 'a', 9, 10, 11, (12), 13.0f, 14f, 15.0, 16.0, "testCoercion", SupportEnum.ENUM_VALUE_1);
            theEvent = _testListener.GetAndResetLastNewData()[0];
            Assert.AreEqual("x", theEvent.Get("p1"));
        }
 public bool IsExistsProperty(EventBean eventBean)
 {
     return true; // Property exists as the property is not dynamic (unchecked)
 }
 public object GetFragment(EventBean eventBean)
 {
     return null; // no fragments provided by revision events
 }
Example #10
0
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="earlier">the latch before this latch that this latch should be waiting for</param>
 /// <param name="msecTimeout">the timeout after which delivery occurs</param>
 /// <param name="payload">the payload is an event to deliver</param>
 public InsertIntoLatchWait(InsertIntoLatchWait earlier, long msecTimeout, EventBean payload)
 {
     _earlier     = earlier;
     _msecTimeout = (int)msecTimeout;
     _payload     = payload;
 }
Example #11
0
 public override void Process(EventBean lookupEvent, EventBean[] prefillPath, ICollection <EventBean[]> result, ExprEvaluatorContext exprEvaluatorContext)
 {
     LastPrefillPath = prefillPath;
 }
 /// <summary>
 /// Return the value for the property in the event object specified when the instance was obtained.
 /// Useful for fast access to event properties. Throws a PropertyAccessException if the getter instance
 /// doesn't match the EventType it was obtained from, and to indicate other property access problems.
 /// </summary>
 /// <param name="eventBean">is the event to get the value of a property from</param>
 /// <param name="mapKey">the map key value</param>
 /// <returns>value of property in event</returns>
 /// <throws>com.espertech.esper.client.PropertyAccessException to indicate that property access failed</throws>
 public Object Get(EventBean eventBean, String mapKey)
 {
     return(ProcGet.Invoke(eventBean, mapKey));
 }
Example #13
0
 public void Add(EventBean @event)
 {
     _event = @event;
 }
Example #14
0
 public void Add(EventBean @event)
 {
     events.Add(@event);
 }
 public EventBean EvaluateEventGetEventBean(EventBean @event, ExprEvaluatorContext context)
 {
     return(null);
 }
Example #16
0
 public int GetIds(EventBean @event, string name)
 {
     return 999999;
 }
 public ICollection <EventBean> EvaluateEventGetROCollectionEvents(EventBean @event, ExprEvaluatorContext context)
 {
     return(null);
 }
Example #18
0
 public object Get(EventBean eventBean)
 {
     var record = (GenericRecord) eventBean.Underlying;
     return GetAvroFieldValue(record);
 }
        public override void MatchEvent(
            EventBean theEvent,
            ICollection<FilterHandle> matches,
            ExprEvaluatorContext ctx)
        {
            var propertyValue = Lookupable.Eval.Eval(theEvent, ctx);
            if (InstrumentationHelper.ENABLED) {
                InstrumentationHelper.Get().QFilterReverseIndex(this, propertyValue);
            }

            if (propertyValue == null) {
                if (InstrumentationHelper.ENABLED) {
                    InstrumentationHelper.Get().AFilterReverseIndex(false);
                }

                return;
            }

            var filterOperator = this.FilterOperator;

            // Look up in table
            using (constantsMapRWLock.ReadLock.Acquire())
            {
                // Get the head or tail end of the map depending on comparison type
                IDictionary<object, EventEvaluator> subMap;

                if ((filterOperator == FilterOperator.GREATER) ||
                    (filterOperator == FilterOperator.GREATER_OR_EQUAL)) {
                    // At the head of the map are those with a lower numeric constants
                    subMap = constantsMap.Head(propertyValue);
                }
                else {
                    subMap = constantsMap.Tail(propertyValue);
                }

                // All entries in the subMap are elgibile, with an exception
                EventEvaluator exactEquals = null;
                if (filterOperator == FilterOperator.LESS) {
                    exactEquals = constantsMap.Get(propertyValue);
                }

                foreach (var matcher in subMap.Values) {
                    // For the LESS comparison type we ignore the exactly equal case
                    // The subMap is sorted ascending, thus the exactly equals case is the first
                    if (exactEquals != null) {
                        exactEquals = null;
                        continue;
                    }

                    matcher.MatchEvent(theEvent, matches, ctx);
                }

                if (filterOperator == FilterOperator.GREATER_OR_EQUAL) {
                    var matcher = constantsMap.Get(propertyValue);
                    if (matcher != null) {
                        matcher.MatchEvent(theEvent, matches, ctx);
                    }
                }
            }

            if (InstrumentationHelper.ENABLED) {
                InstrumentationHelper.Get().AFilterReverseIndex(null);
            }
        }
Example #20
0
 public bool IsExistsProperty(EventBean eventBean)
 {
     return IsExistsPropertyAvro((GenericRecord) eventBean.Underlying);
 }
Example #21
0
 public RegexPartitionState GetState(EventBean theEvent, bool collect)
 {
     return(_singletonState);
 }
Example #22
0
 public object GetFragment(EventBean eventBean)
 {
     return null;
 }
        /// <summary>
        ///     Returns the access into window contents given an event.
        /// </summary>
        /// <param name="theEvent">to which the method returns relative access from</param>
        /// <returns>buffer</returns>
        public RelativeAccessByEventNIndex GetAccessor(EventBean theEvent)
        {
            var iStreamRelativeAccess = accessorByEvent.Get(theEvent);

            return iStreamRelativeAccess;
        }
Example #24
0
        public void TestSelectArray()
        {
            EPServiceProvider epService = EPServiceProviderManager.GetDefaultProvider(_config);

            epService.Initialize();
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.StartTest(epService, GetType(), GetType().FullName);
            }

            String stmt = "select a, b, a[0] as a0, a[0].id as a0Id, a[1] as a1, a[1].id as a1Id, a[2] as a2, a[2].id as a2Id from pattern [a=A until b=B]";
            SupportUpdateListener listener  = new SupportUpdateListener();
            EPStatement           statement = epService.EPAdministrator.CreateEPL(stmt);

            statement.Events += listener.Update;

            Object eventA1 = new SupportBean_A("A1");

            epService.EPRuntime.SendEvent(eventA1);

            Object eventA2 = new SupportBean_A("A2");

            epService.EPRuntime.SendEvent(eventA2);
            Assert.IsFalse(listener.IsInvoked);

            Object eventB1 = new SupportBean_B("B1");

            epService.EPRuntime.SendEvent(eventB1);

            EventBean theEvent = listener.AssertOneGetNewAndReset();

            EPAssertionUtil.AssertEqualsExactOrder((Object[])theEvent.Get("a"), new Object[] { eventA1, eventA2 });
            Assert.AreSame(eventA1, theEvent.Get("a0"));
            Assert.AreSame(eventA2, theEvent.Get("a1"));
            Assert.IsNull(theEvent.Get("a2"));
            Assert.AreEqual("A1", theEvent.Get("a0Id"));
            Assert.AreEqual("A2", theEvent.Get("a1Id"));
            Assert.IsNull(theEvent.Get("a2Id"));
            Assert.AreSame(eventB1, theEvent.Get("b"));

            // try wildcard
            stmt              = "select * from pattern [a=A until b=B]";
            statement         = epService.EPAdministrator.CreateEPL(stmt);
            statement.Events += listener.Update;

            epService.EPRuntime.SendEvent(eventA1);
            epService.EPRuntime.SendEvent(eventA2);
            Assert.IsFalse(listener.IsInvoked);
            epService.EPRuntime.SendEvent(eventB1);

            theEvent = listener.AssertOneGetNewAndReset();
            EPAssertionUtil.AssertEqualsExactOrder((Object[])theEvent.Get("a"), new Object[] { eventA1, eventA2 });
            Assert.AreSame(eventA1, theEvent.Get("a[0]"));
            Assert.AreSame(eventA2, theEvent.Get("a[1]"));
            Assert.IsNull(theEvent.Get("a[2]"));
            Assert.AreEqual("A1", theEvent.Get("a[0].id"));
            Assert.AreEqual("A2", theEvent.Get("a[1].id"));
            Assert.IsNull(theEvent.Get("a[2].id"));
            Assert.AreSame(eventB1, theEvent.Get("b"));

            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.EndTest();
            }
        }
Example #25
0
 public abstract void MatchFound(EventBean theEvent, ICollection <FilterHandleCallback> allStmtMatches);
Example #26
0
 public override void Write(Object value, EventBean target)
 {
     Invoke(new Object[] { _key, value }, target.Underlying);
 }
 public object GetFragment(EventBean eventBean)
 {
     var record = (GenericRecord) eventBean.Underlying;
     var inner = (GenericRecord) record.Get(_top);
     return AvroEventBeanGetterDynamicPoly.GetAvroFieldFragmentPoly(inner, _getters);
 }
Example #28
0
        public ICollection <object> EvaluateGetROCollectionScalar(EvaluateParams evaluateParams)
        {
            EventBean eventInQuestion = evaluateParams.EventsPerStream[_streamId];

            return(EvaluateEventGetROCollectionScalar(eventInQuestion, evaluateParams.ExprEvaluatorContext));
        }
Example #29
0
 /// <summary>
 /// Perform the matching of an event based on the event property values, adding any callbacks for matches found to the matches list.
 /// </summary>
 /// <param name="theTheEvent">is the event object wrapper to obtain event property values from</param>
 /// <param name="matches">accumulates the matching filter callbacks</param>
 public abstract void MatchEvent(EventBean theTheEvent, ICollection <FilterHandle> matches);
Example #30
0
 public Object Get(EventBean eventBean, int index)
 {
     return(GetBeanPropInternal(eventBean.Underlying, index));
 }