1919// Originally authored by goldmedal
2020
2121use datafusion:: arrow:: array:: { ArrayRef , Float64Array , UInt64Array } ;
22- use datafusion:: arrow:: datatypes:: { DataType , Field } ;
22+ use datafusion:: arrow:: datatypes:: { DataType , Field , FieldRef } ;
2323use datafusion:: common:: cast:: as_float64_array;
2424use datafusion:: common:: { Result , ScalarValue , downcast_value} ;
25- use datafusion:: error:: DataFusionError ;
2625use datafusion:: logical_expr:: function:: { AccumulatorArgs , StateFieldsArgs } ;
2726use datafusion:: logical_expr:: { Accumulator , AggregateUDFImpl , Signature , Volatility } ;
2827use std:: any:: Any ;
@@ -57,7 +56,7 @@ impl Default for KurtosisPopFunction {
5756impl KurtosisPopFunction {
5857 pub fn new ( ) -> Self {
5958 Self {
60- signature : Signature :: coercible ( vec ! [ DataType :: Float64 ] , Volatility :: Immutable ) ,
59+ signature : Signature :: exact ( vec ! [ DataType :: Float64 ] , Volatility :: Immutable ) ,
6160 }
6261 }
6362}
@@ -79,13 +78,13 @@ impl AggregateUDFImpl for KurtosisPopFunction {
7978 Ok ( DataType :: Float64 )
8079 }
8180
82- fn state_fields ( & self , _args : StateFieldsArgs ) -> Result < Vec < Field > > {
81+ fn state_fields ( & self , _args : StateFieldsArgs ) -> Result < Vec < FieldRef > > {
8382 Ok ( vec ! [
84- Field :: new( "count" , DataType :: UInt64 , true ) ,
85- Field :: new( "sum" , DataType :: Float64 , true ) ,
86- Field :: new( "sum_sqr" , DataType :: Float64 , true ) ,
87- Field :: new( "sum_cub" , DataType :: Float64 , true ) ,
88- Field :: new( "sum_four" , DataType :: Float64 , true ) ,
83+ Field :: new( "count" , DataType :: UInt64 , true ) . into ( ) ,
84+ Field :: new( "sum" , DataType :: Float64 , true ) . into ( ) ,
85+ Field :: new( "sum_sqr" , DataType :: Float64 , true ) . into ( ) ,
86+ Field :: new( "sum_cub" , DataType :: Float64 , true ) . into ( ) ,
87+ Field :: new( "sum_four" , DataType :: Float64 , true ) . into ( ) ,
8988 ] )
9089 }
9190
0 commit comments