kumarUjjawal commented on code in PR #24943:
URL: https://github.com/apache/datafusion/pull/24943#discussion_r3934677228


##########
datafusion/spark/src/function/math/factorial.rs:
##########
@@ -43,7 +47,14 @@ impl Default for SparkFactorial {
 impl SparkFactorial {
     pub fn new() -> Self {
         Self {
-            signature: Signature::exact(vec![Int32], Volatility::Immutable),
+            signature: Signature::coercible(
+                vec![Coercion::new_implicit(

Review Comment:
   Could we use `Coercion::new_implicit_native(logical_int32(), 
vec![TypeSignatureClass::Integer])` here? That constructor was added for 
native-target coercions so the desired `Int32` type and `NativeType::Int32` 
cannot accidentally diverge. It would also remove the `NativeType` import.



##########
datafusion/sqllogictest/test_files/spark/math/factorial.slt:
##########
@@ -62,5 +62,35 @@ NULL
 NULL
 NULL
 
-query error Error during planning: Failed to coerce arguments to satisfy a 
call to 'factorial' function
-SELECT factorial(5::BIGINT);
+# Spark declares factorial(INT) with ImplicitCastInputTypes, so every integer 
width is
+# accepted; an untyped literal (Int64 in DataFusion) must work too. Values 
from Spark 4.2.0.

Review Comment:
   Could we clarify the test provenance here? This row includes `UInt64`, but 
Spark has no unsigned integer type, so that expected value cannot come from 
Spark 4.2.0. I suggest identifying the signed cases as Spark-verified and the 
unsigned case as DataFusion-specific coverage, or removing the unsigned case.



-- 
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]

Reply via email to