berkaysynnada commented on code in PR #13130: URL: https://github.com/apache/datafusion/pull/13130#discussion_r1827466731
########## datafusion/functions/src/datetime/from_unixtime.rs: ########## @@ -59,28 +63,63 @@ impl ScalarUDFImpl for FromUnixtimeFunc { &self.signature } + fn return_type_from_exprs( + &self, + args: &[Expr], + _schema: &dyn ExprSchema, + arg_types: &[DataType], + ) -> Result<DataType> { + match arg_types.len() { + 1 => Ok(Timestamp(Second, None)), + 2 => match &args[1] { + Expr::Literal(ScalarValue::Utf8(Some(tz))) => Ok(Timestamp(Second, Some(Arc::from(tz.to_string())))), + _ => exec_err!( + "Second argument for `from_unixtime` must be non-null utf8, received {:?}", + arg_types[1]), + }, + _ => exec_err!( + "from_unixtime function requires 1 or 2 arguments, got {}", + arg_types.len() + ), + } + } + fn return_type(&self, _arg_types: &[DataType]) -> Result<DataType> { - Ok(Timestamp(Second, None)) + internal_err!("return_type should not be called") Review Comment: I mean making the error message directing to `return_type_from_exprs`. `internal_err!("call return_type_from_exprs instead")` -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org