martin-g commented on code in PR #19224:
URL: https://github.com/apache/datafusion/pull/19224#discussion_r2602608519
##########
datafusion/spark/src/function/bitwise/bitwise_not.rs:
##########
@@ -64,8 +66,21 @@ impl ScalarUDFImpl for SparkBitwiseNot {
&self.signature
}
- fn return_type(&self, arg_types: &[DataType]) -> Result<DataType> {
- Ok(arg_types[0].clone())
+ fn return_type(&self, _arg_types: &[DataType]) -> Result<DataType> {
+ plan_err!("SparkBitwiseNot: return_type() is not used;
return_field_from_args() is implemented")
+ }
+
+ fn return_field_from_args(&self, args: ReturnFieldArgs) ->
Result<FieldRef> {
+ if args.arg_fields.len() != 1 {
+ return plan_err!("bitwise_not expects exactly 1 argument");
+ }
+
+ let input_field = &args.arg_fields[0];
+
+ let out_dt = input_field.data_type().clone();
+ let out_nullable = input_field.is_nullable();
+
+ Ok(Arc::new(Field::new("bitwise_not", out_dt, out_nullable)))
Review Comment:
```suggestion
Ok(Arc::new(Field::new(self.name(), out_dt, out_nullable)))
```
##########
datafusion/spark/src/function/bitwise/bitwise_not.rs:
##########
@@ -64,8 +66,21 @@ impl ScalarUDFImpl for SparkBitwiseNot {
&self.signature
}
- fn return_type(&self, arg_types: &[DataType]) -> Result<DataType> {
- Ok(arg_types[0].clone())
+ fn return_type(&self, _arg_types: &[DataType]) -> Result<DataType> {
+ plan_err!("SparkBitwiseNot: return_type() is not used;
return_field_from_args() is implemented")
Review Comment:
```suggestion
internal_err!("SparkBitwiseNot: return_type() is not used;
return_field_from_args() is implemented")
```
The other similar functions use `internal_err!()`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]