findepi commented on code in PR #17531:
URL: https://github.com/apache/datafusion/pull/17531#discussion_r2343170077


##########
datafusion/expr/src/type_coercion/functions.rs:
##########
@@ -913,6 +916,10 @@ fn coerced_from<'a>(
             Some(_) => Some(FixedSizeList(Arc::clone(f_into), *size_from)),
             _ => None,
         },
+        // should be able to coerce wildcard fixed size binary to non wildcard 
fixed size binary
+        (FixedSizeBinary(FIXED_SIZE_BINARY_WILDCARD), 
FixedSizeBinary(size_from)) => {

Review Comment:
   technically speaking, `FixedSizeBinary(-2147483647)` is not a valid type, so 
it's not meaningful to define a coercion between it and any other type. I can 
see how it may be useful in case of function signatures though. What we 
actually want is generic signatures in functions. i.e. a signature that is not 
a type itself, but matches a type.



##########
datafusion/expr-common/src/signature.rs:
##########
@@ -43,6 +43,13 @@ pub const TIMEZONE_WILDCARD: &str = "+TZ";
 /// valid length. It exists to avoid the need to enumerate all possible fixed 
size list lengths.
 pub const FIXED_SIZE_LIST_WILDCARD: i32 = i32::MIN;
 
+/// Constant that is used as a placeholder for any valid fixed size binary.
+/// This is used where a function can accept a fixed size binary type with any
+/// valid length. It exists to avoid the need to enumerate all possible fixed 
size binary lengths.
+///
+/// The value is offset by 1 to make it distinct from 
[`FIXED_SIZE_LIST_WILDCARD`].

Review Comment:
   Doesn't have to be different?



##########
datafusion/spark/src/function/bitmap/bitmap_count.rs:
##########
@@ -48,8 +49,16 @@ impl Default for BitmapCount {
 impl BitmapCount {
     pub fn new() -> Self {
         Self {
-            // TODO: add definitive TypeSignature after 
https://github.com/apache/datafusion/issues/17291 is done
-            signature: Signature::any(1, Volatility::Immutable),
+            signature: Signature::uniform(
+                1,
+                vec![
+                    Binary,
+                    BinaryView,
+                    LargeBinary,
+                    FixedSizeBinary(FIXED_SIZE_BINARY_WILDCARD),

Review Comment:
   Rather than use this invalid type hack, i'd recommend implementing this for 
now as a "user defined signature"
   
   long term solution is to have `Signature::uniform` accept generic types 
(type patterns).



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

Reply via email to