/// <summary> /// NOTE: Code-generation-invoked method, method name and parameter order matters /// </summary> /// <param name="streamNum">stream num</param> /// <param name="eventsPerStream">events</param> /// <returns>value</returns> public static AggregationRow TableColumnRow( int streamNum, EventBean[] eventsPerStream) { var oa = (ObjectArrayBackedEventBean) eventsPerStream[streamNum]; return ExprTableEvalStrategyUtil.GetRow(oa); }
public void ApplyLeave(EventBean[] eventsPerStream, object optionalGroupKeyPerRow, ExprEvaluatorContext exprEvaluatorContext) { // acquire table-level write lock ExprTableEvalLockUtil.ObtainLockUnless(_tableStateInstance.TableLevelRWLock.WriteLock, exprEvaluatorContext); var @event = _tableStateInstance.GetCreateRowIntoTable(null, exprEvaluatorContext); var row = ExprTableEvalStrategyUtil.GetRow(@event); var evaluateParams = new EvaluateParams(eventsPerStream, false, exprEvaluatorContext); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().QAggregationUngroupedApplyEnterLeave(false, row.Methods.Length, row.States.Length); } for (var i = 0; i < _methodPairs.Length; i++) { var methodPair = _methodPairs[i]; var method = row.Methods[methodPair.TargetIndex]; if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().QAggNoAccessEnterLeave(false, i, method, methodPair.AggregationNode); } var columnResult = methodPair.Evaluator.Evaluate(evaluateParams); method.Leave(columnResult); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().AAggNoAccessEnterLeave(false, i, method); } } for (var i = 0; i < _targetStates.Length; i++) { var state = row.States[_targetStates[i]]; if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().QAggAccessEnterLeave(false, i, state, _accessStateExpr[i]); } _agents[i].ApplyLeave(eventsPerStream, exprEvaluatorContext, state); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().AAggAccessEnterLeave(false, i, state); } } _tableStateInstance.HandleRowUpdated(@event); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().AAggregationUngroupedApplyEnterLeave(false); } }
/// <summary> /// NOTE: Code-generation-invoked method, method name and parameter order matters /// </summary> /// <param name="streamNum">stream num</param> /// <param name="eventsPerStream">events</param> public static void TableAggReset( int streamNum, EventBean[] eventsPerStream) { var oa = (ObjectArrayBackedEventBean) eventsPerStream[streamNum]; var row = ExprTableEvalStrategyUtil.GetRow(oa); row.Clear(); }
/// <summary> /// NOTE: Code-generation-invoked method, method name and parameter order matters /// </summary> /// <param name="streamNum">stream num</param> /// <param name="column">col</param> /// <param name="eventsPerStream">events</param> /// <param name="isNewData">new-data flow</param> /// <param name="ctx">context</param> /// <returns>value</returns> public static object TableColumnAggValue( int streamNum, int column, EventBean[] eventsPerStream, bool isNewData, ExprEvaluatorContext ctx) { var oa = (ObjectArrayBackedEventBean) eventsPerStream[streamNum]; var row = ExprTableEvalStrategyUtil.GetRow(oa); return row.GetValue(column, eventsPerStream, isNewData, ctx); }
private AggregationState GetState(EventBean[] eventsPerStream) { EventBean @event = eventsPerStream[_streamNum]; if (@event == null) { return(null); } AggregationRowPair row = ExprTableEvalStrategyUtil.GetRow((ObjectArrayBackedEventBean)@event); return(row.States[_tableAccessColumn.AccessAccessorSlotPair.Slot]); }
/// <summary> /// NOTE: Code-generation-invoked method, method name and parameter order matters /// </summary> /// <param name="streamNum">stream number</param> /// <param name="reader">reader</param> /// <param name="aggColNum">agg col</param> /// <param name="eventsPerStream">events</param> /// <param name="isNewData">new-data flag</param> /// <param name="exprEvaluatorContext">expr ctx</param> /// <returns>value</returns> public static ICollection<object> EvaluateTableWithReaderCollectionScalar( int streamNum, AggregationMultiFunctionTableReader reader, int aggColNum, EventBean[] eventsPerStream, bool isNewData, ExprEvaluatorContext exprEvaluatorContext) { var @event = eventsPerStream[streamNum]; if (@event == null) { return null; } var row = ExprTableEvalStrategyUtil.GetRow((ObjectArrayBackedEventBean) @event); return reader.GetValueCollectionScalar(aggColNum, row, eventsPerStream, isNewData, exprEvaluatorContext); }
public EventBean GetEventBean( int column, EventBean[] eventsPerStream, bool isNewData, ExprEvaluatorContext context) { // acquire table-level write lock TableEvalLockUtil.ObtainLockUnless(tableInstance.TableLevelRWLock.WriteLock, context); var @event = tableInstance.EventUngrouped; if (@event == null) { return null; } var row = ExprTableEvalStrategyUtil.GetRow(@event); return row.GetEventBean(column, eventsPerStream, isNewData, context); }
public object GetValue(int column, int agentInstanceId, EvaluateParams evaluateParams) { // acquire table-level write lock ExprTableEvalLockUtil.ObtainLockUnless(_tableStateInstance.TableLevelRWLock.WriteLock, evaluateParams.ExprEvaluatorContext); var @event = _tableStateInstance.EventUngrouped; if (@event == null) { return null; } var row = ExprTableEvalStrategyUtil.GetRow(@event); var aggregators = row.Methods; if (column < aggregators.Length) { return aggregators[column].Value; } else { var pair = _accessors[column - aggregators.Length]; return pair.Accessor.GetValue(row.States[pair.Slot], evaluateParams); } }
public void ClearResults(ExprEvaluatorContext exprEvaluatorContext) { // acquire table-level write lock ExprTableEvalLockUtil.ObtainLockUnless(_tableStateInstance.TableLevelRWLock.WriteLock, exprEvaluatorContext); var @event = _tableStateInstance.EventUngrouped; if (@event == null) { return; } var row = ExprTableEvalStrategyUtil.GetRow(@event); var aggregators = row.Methods; foreach (var state in row.States) { state.Clear(); } foreach (var aggregator in aggregators) { aggregator.Clear(); } }
public void ApplyLeave( EventBean[] eventsPerStream, object optionalGroupKeyPerRow, ExprEvaluatorContext exprEvaluatorContext) { // acquire table-level write lock TableEvalLockUtil.ObtainLockUnless(tableInstance.TableLevelRWLock.WriteLock, exprEvaluatorContext); var @event = tableInstance.GetCreateRowIntoTable(exprEvaluatorContext); var row = ExprTableEvalStrategyUtil.GetRow(@event); for (var i = 0; i < methodPairs.Length; i++) { var methodPair = methodPairs[i]; var columnResult = methodPair.Evaluator.Evaluate(eventsPerStream, false, exprEvaluatorContext); row.LeaveAgg(methodPair.Column, columnResult); } for (var i = 0; i < accessAgents.Length; i++) { accessAgents[i].ApplyLeave(eventsPerStream, exprEvaluatorContext, row, accessColumnsZeroOffset[i]); } tableInstance.HandleRowUpdated(@event); }
public object[] ConvertToUnd(EventBean @event, EvaluateParams evalParams) { var bean = (ObjectArrayBackedEventBean)@event; var row = ExprTableEvalStrategyUtil.GetRow(bean); var data = new object[_numColumns]; foreach (var plain in _plains) { data[plain.Dest] = bean.Properties[plain.Source]; } var count = 0; foreach (var access in _accessors) { data[access.Dest] = access.Accessor.GetValue(row.States[count++], evalParams); } count = 0; foreach (var method in _methods) { data[method.Dest] = row.Methods[count++].Value; } return(data); }
public EventBean GetEventBean(int column, EventBean[] eventsPerStream, bool isNewData, ExprEvaluatorContext context) { // acquire table-level write lock ExprTableEvalLockUtil.ObtainLockUnless(_tableStateInstance.TableLevelRWLock.WriteLock, context); var @event = _tableStateInstance.EventReference.Get(); if (@event == null) { return(null); } var row = ExprTableEvalStrategyUtil.GetRow(@event); var aggregators = row.Methods; if (column < aggregators.Length) { return(null); } else { var pair = _accessors[column - aggregators.Length]; return(pair.Accessor.GetEnumerableEvent(row.States[pair.Slot], eventsPerStream, isNewData, context)); } }