File tree 4 files changed +10
-9
lines changed
4 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -280,7 +280,7 @@ where
280
280
/// unimplemented!()
281
281
/// }
282
282
/// fn field(&self, field_args: WindowUDFFieldArgs) -> Result<Field> {
283
- /// if let Some(DataType::Int32) = field_args.get_input_type(0 ) {
283
+ /// if let Some(DataType::Int32) = field_args.get_input_field(0).map(|f| f.data_type().clone() ) {
284
284
/// Ok(Field::new(field_args.name(), DataType::Int32, false))
285
285
/// } else {
286
286
/// plan_err!("smooth_it only accepts Int32 arguments")
Original file line number Diff line number Diff line change @@ -303,11 +303,11 @@ fn parse_expr_type(input_fields: &[Field]) -> Result<Field> {
303
303
304
304
// Handles the most common case where NULL is unexpected
305
305
if !expr_field. data_type ( ) . is_null ( ) {
306
- return Ok ( expr_field. clone ( ) ) ;
306
+ return Ok ( expr_field. clone ( ) . with_nullable ( true ) ) ;
307
307
}
308
308
309
309
let default_value_field = input_fields. get ( 2 ) . unwrap_or ( & null_field) ;
310
- Ok ( default_value_field. clone ( ) )
310
+ Ok ( default_value_field. clone ( ) . with_nullable ( true ) )
311
311
}
312
312
313
313
/// Handles type coercion and null value refinement for default value
Original file line number Diff line number Diff line change @@ -286,7 +286,7 @@ macro_rules! get_or_init_udwf {
286
286
/// # fn field(&self, field_args: WindowUDFFieldArgs) -> datafusion_common::Result<Field> {
287
287
/// # Ok(Field::new(
288
288
/// # field_args.name(),
289
- /// # field_args.get_input_type (0).unwrap(),
289
+ /// # field_args.get_input_field (0).unwrap().data_type().clone (),
290
290
/// # false,
291
291
/// # ))
292
292
/// # }
@@ -557,7 +557,7 @@ macro_rules! create_udwf_expr {
557
557
/// # fn field(&self, field_args: WindowUDFFieldArgs) -> datafusion_common::Result<Field> {
558
558
/// # Ok(Field::new(
559
559
/// # field_args.name(),
560
- /// # field_args.get_input_type (0).unwrap(),
560
+ /// # field_args.get_input_field (0).unwrap().data_type().clone (),
561
561
/// # false,
562
562
/// # ))
563
563
/// # }
@@ -646,7 +646,7 @@ macro_rules! create_udwf_expr {
646
646
/// # fn field(&self, field_args: WindowUDFFieldArgs) -> datafusion_common::Result<Field> {
647
647
/// # Ok(Field::new(
648
648
/// # field_args.name(),
649
- /// # field_args.get_input_type (0).unwrap(),
649
+ /// # field_args.get_input_field (0).unwrap().data_type().clone (),
650
650
/// # false,
651
651
/// # ))
652
652
/// # }
Original file line number Diff line number Diff line change @@ -270,13 +270,14 @@ impl WindowUDFImpl for NthValue {
270
270
}
271
271
272
272
fn field ( & self , field_args : WindowUDFFieldArgs ) -> Result < Field > {
273
- let return_field = field_args
273
+ let return_type = field_args
274
274
. input_fields ( )
275
275
. first ( )
276
+ . map ( |f| f. data_type ( ) )
276
277
. cloned ( )
277
- . unwrap_or ( Field :: new ( "f" , DataType :: Null , true ) ) ;
278
+ . unwrap_or ( DataType :: Null ) ;
278
279
279
- Ok ( return_field . with_name ( field_args. name ( ) ) )
280
+ Ok ( Field :: new ( field_args. name ( ) , return_type , true ) )
280
281
}
281
282
282
283
fn reverse_expr ( & self ) -> ReversedUDWF {
You can’t perform that action at this time.
0 commit comments