Class: Norikra::UDFSpecHelper::UDFAggregationFactoryInstance
- Inherits:
-
Object
- Object
- Norikra::UDFSpecHelper::UDFAggregationFactoryInstance
- Includes:
- UDFHelper
- Defined in:
- lib/norikra/udf_spec_helper.rb
Instance Method Summary collapse
-
#check(func_name, value_type, parameters, distinct, windowed) ⇒ Object
parameters => [[parameterType, constant?, contantValue], … ].
- #create ⇒ Object
-
#initialize(classname) ⇒ UDFAggregationFactoryInstance
constructor
A new instance of UDFAggregationFactoryInstance.
Methods included from UDFHelper
Constructor Details
#initialize(classname) ⇒ UDFAggregationFactoryInstance
Returns a new instance of UDFAggregationFactoryInstance.
94 95 96 |
# File 'lib/norikra/udf_spec_helper.rb', line 94 def initialize(classname) @factory = classObject(classname).new end |
Instance Method Details
#check(func_name, value_type, parameters, distinct, windowed) ⇒ Object
parameters => [[parameterType, constant?, contantValue], … ]
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/norikra/udf_spec_helper.rb', line 99 def check(func_name, value_type, parameters, distinct, windowed) @factory.setFunctionName(func_name) unless @factory.getValueType == value_type.java_class raise "Aggregation UDF value type mismatch, expected '#{value_type}', actually '#{@factory.getValueType}'" end parameterTypes = parameters.map{|t,bc,c| t.java_class } constantValue = parameters.map{|t,bc,c| bc.nil? ? false : bc } constantValues = parameters.map{|t,bc,c| c } # public AggregationValidationContext(java.lang.Class[] parameterTypes, # boolean[] constantValue, # java.lang.Object[] constantValues, # boolean distinct, # boolean windowed, # ExprNode[] expressions) context_class = com.espertech.esper.epl.agg.service.AggregationValidationContext context = context_class.new(parameterTypes, constantValue, constantValues, distinct, windowed, []) @factory.validate(context) true end |
#create ⇒ Object
121 122 123 |
# File 'lib/norikra/udf_spec_helper.rb', line 121 def create UDFAggregationInstance.new(@factory.newAggregator) end |