public bool IsAggregationMethod(string name, ExprNode[] parameters, ExprValidationContext validationContext){ // always obtain a new handler since the name may have changes var configPair = validationContext.ImportService.ResolveAggregationMultiFunction( AggregationFunctionName, validationContext.ClassProvidedExtension); if (configPair == null) { return false; } AggregationMultiFunctionForge forge; if (configPair.Second != null) { forge = TypeHelper.Instantiate<AggregationMultiFunctionForge>(configPair.Second); } else { forge = TypeHelper.Instantiate<AggregationMultiFunctionForge>( configPair.First.MultiFunctionForgeClassName, validationContext.ImportService.ClassForNameProvider); } ValidateParamsUnless(validationContext, parameters); var ctx = new AggregationMultiFunctionValidationContext( name, validationContext.StreamTypeService.EventTypes, parameters, validationContext.StatementName, validationContext, Config, parameters, null); Handler = forge.ValidateGetHandler(ctx); return Handler.GetAggregationMethodMode(new AggregationMultiFunctionAggregationMethodContext(name, parameters, validationContext)) != null; }
public AggregationMultiFunctionHandler ValidateGetHandler( AggregationMultiFunctionValidationContext validationContext) { if (validationContext.FunctionName.Equals("referenceCountedMap")) { return new SupportReferenceCountedMapRCMFunctionHandler( SHARED_STATE_KEY, validationContext.ParameterExpressions); } if (validationContext.FunctionName.Equals("referenceCountLookup")) { var eval = validationContext.ParameterExpressions[0]; return new SupportReferenceCountedMapRCLFunctionHandler(eval); } throw new ArgumentException("Unexpected function name '" + validationContext.FunctionName); }
public override AggregationForgeFactory ValidateAggregationChild(ExprValidationContext validationContext) { ValidatePositionals(validationContext); // validate using the context provided by the 'outside' streams to determine parameters // at this time 'inside' expressions like 'window(IntPrimitive)' are not handled ExprNodeUtilityValidate.GetValidatedSubtree(ExprNodeOrigin.AGGPARAM, ChildNodes, validationContext); var ctx = new AggregationMultiFunctionValidationContext( functionName, validationContext.StreamTypeService.EventTypes, positionalParams, validationContext.StatementName, validationContext, config, null, ChildNodes, optionalFilter); var handlerPlugin = aggregationMultiFunctionForge.ValidateGetHandler(ctx); factory = new AggregationForgeFactoryAccessPlugin(this, handlerPlugin); return factory; }
public AggregationTableReadDesc ValidateAggregationTableRead( ExprValidationContext validationContext, TableMetadataColumnAggregation tableAccessColumn, TableMetaData table) { // child node validation ExprNodeUtilityValidate.GetValidatedSubtree(ExprNodeOrigin.AGGPARAM, ChildNodes, validationContext); // portable validation var validation = tableAccessColumn.AggregationPortableValidation; if (!(validation is AggregationPortableValidationPluginMultiFunc)) { throw new ExprValidationException("Invalid aggregation column type"); } // obtain handler var ctx = new AggregationMultiFunctionValidationContext( functionName, validationContext.StreamTypeService.EventTypes, positionalParams, validationContext.StatementName, validationContext, config, null, ChildNodes, optionalFilter); var handler = aggregationMultiFunctionForge.ValidateGetHandler(ctx); // set of reader var epType = handler.ReturnType; Type returnType = EPTypeHelper.GetNormalizedClass(epType); var forge = new AggregationTableAccessAggReaderForgePlugIn( returnType, (AggregationMultiFunctionTableReaderModeManaged) handler.TableReaderMode); EventType eventTypeCollection = EPTypeHelper.OptionalIsEventTypeColl(epType); EventType eventTypeSingle = EPTypeHelper.OptionalIsEventTypeSingle(epType); Type componentTypeCollection = EPTypeHelper.OptionalIsComponentTypeColl(epType); return new AggregationTableReadDesc(forge, eventTypeCollection, componentTypeCollection, eventTypeSingle); }
private static void TryAssertion(RegressionEnvironment env) { var fields = "c0,c1".SplitCsv(); var eventType = env.Statement("s0").EventType; foreach (var prop in fields) { Assert.AreEqual(typeof(SupportBean), eventType.GetPropertyDescriptor(prop).PropertyType); Assert.AreEqual(true, eventType.GetPropertyDescriptor(prop).IsFragment); Assert.AreEqual(typeof(SupportBean).FullName, eventType.GetFragmentType(prop).FragmentType.Name); } // there should be just 1 forge instance for all of the registered functions for this statement Assert.AreEqual(1, SupportAggMFMultiRTForge.Forges.Count); Assert.AreEqual(2, SupportAggMFMultiRTForge.FunctionDeclContexts.Count); for (var i = 0; i < 2; i++) { AggregationMultiFunctionDeclarationContext contextDecl = SupportAggMFMultiRTForge.FunctionDeclContexts[i]; Assert.AreEqual(i == 0 ? "se1" : "se2", contextDecl.FunctionName); Assert.IsFalse(contextDecl.IsDistinct()); Assert.IsNotNull(contextDecl.Configuration); AggregationMultiFunctionValidationContext contextValid = SupportAggMFMultiRTForge.FunctionHandlerValidationContexts[i]; Assert.AreEqual(i == 0 ? "se1" : "se2", contextValid.FunctionName); Assert.IsNotNull(contextValid.ParameterExpressions); Assert.IsNotNull(contextValid.AllParameterExpressions); Assert.AreEqual("someinfovalue", contextValid.Config.AdditionalConfiguredProperties.Get("someinfokey")); Assert.IsNotNull(contextValid.EventTypes); Assert.IsNotNull(contextValid.ValidationContext); Assert.IsNotNull(contextValid.StatementName); } Assert.AreEqual(2, SupportAggMFMultiRTHandler.ProviderKeys.Count); if (!SupportAggMFMultiRTHandler.AccessorModes.IsEmpty()) { Assert.AreEqual(2, SupportAggMFMultiRTHandler.AccessorModes.Count); Assert.AreEqual(1, SupportAggMFMultiRTHandler.StateFactoryModes.Count); } Assert.AreEqual(0, SupportAggMFMultiRTSingleEventStateFactory.StateContexts.Count); // group 1 var eventOne = new SupportBean("E1", 1); env.SendEventBean(eventOne); EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields, new object[] { eventOne, eventOne }); if (!SupportAggMFMultiRTSingleEventStateFactory.StateContexts.IsEmpty()) { Assert.AreEqual(1, SupportAggMFMultiRTSingleEventStateFactory.StateContexts.Count); SupportAggMFMultiRTSingleEventState context = SupportAggMFMultiRTSingleEventStateFactory.StateContexts[0]; // Not available: assertEquals("E1", context.getGroupKey()); } // group 2 var eventTwo = new SupportBean("E2", 2); env.SendEventBean(eventTwo); EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields, new object[] { eventTwo, eventTwo }); if (!SupportAggMFMultiRTSingleEventStateFactory.StateContexts.IsEmpty()) { Assert.AreEqual(2, SupportAggMFMultiRTSingleEventStateFactory.StateContexts.Count); } env.UndeployAll(); }
public AggregationMultiFunctionHandler ValidateGetHandler( AggregationMultiFunctionValidationContext validationContext) { return new SupportAggMFEventsAsListHandler(); }
public AggregationMultiFunctionHandler ValidateGetHandler( AggregationMultiFunctionValidationContext validationContext) { FunctionHandlerValidationContexts.Add(validationContext); return new SupportAggMFMultiRTHandler(validationContext); }
public SupportAggMFMultiRTHandler(AggregationMultiFunctionValidationContext validationContext) { this.validationContext = validationContext; }