jayzhan211 commented on code in PR #9304:
URL: https://github.com/apache/arrow-datafusion/pull/9304#discussion_r1505182329
##########
datafusion/core/tests/user_defined/user_defined_scalar_functions.rs:
##########
@@ -498,6 +503,83 @@ async fn test_user_defined_functions_zero_argument() ->
Result<()> {
Ok(())
}
+#[derive(Debug)]
+struct CastToI64UDF {
+ signature: Signature,
+}
+
+impl CastToI64UDF {
+ fn new() -> Self {
+ Self {
+ signature: Signature::any(1, Volatility::Immutable),
+ }
+ }
+}
+
+impl ScalarUDFImpl for CastToI64UDF {
+ fn as_any(&self) -> &dyn Any {
+ self
+ }
+ fn name(&self) -> &str {
+ "cast_to_i64"
+ }
+ fn signature(&self) -> &Signature {
+ &self.signature
+ }
+ fn return_type(&self, _args: &[DataType]) -> Result<DataType> {
+ Ok(DataType::Int64)
+ }
+ // Wrap with Expr::Cast() to Int64
+ fn simplify(&self, args: &[Expr]) -> Result<Simplified> {
+ let dfs = DFSchema::new_with_metadata(
Review Comment:
SimpliyContext has DFSchemaRef, so I change the type to DFSchemaRef, I think
it is also fine
--
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]