tobixdev commented on code in PR #18552:
URL: https://github.com/apache/datafusion/pull/18552#discussion_r2693331022


##########
datafusion/expr/src/registry.rs:
##########
@@ -215,3 +217,232 @@ impl FunctionRegistry for MemoryFunctionRegistry {
         self.udwfs.keys().cloned().collect()
     }
 }
+
+/// The registration of an extension type.
+///
+/// Implementations of this trait are responsible for *creating* instances of 
[LogicalType] that
+/// represent the semantics of an extension type. One cannot directly register 
the [LogicalType]
+/// instances because some extension types may have parameters that are 
unknown at compile time
+/// (e.g., the unknown type in [Opaque](arrow_schema::extension::Opaque)).
+pub trait ExtensionTypeRegistration: Debug + Send + Sync {

Review Comment:
   Trait:
   
   The trait is necessary if the `LogicalType` should be parameterizable. For 
example, in the case of opaque, the parameters "type_name" and "vendor_name" 
should be part of the [logical type 
signature](https://github.com/apache/datafusion/blob/eadbed51b5c711423bc5f1a4d72fbf1e5be5d975/datafusion/common/src/types/logical.rs#L26)
 as the signature is used to check type equality. 
   
   The `ExtensionTypeRegistration` is basically the "factory" that produces the 
concrete isntances and can extract the type parameters from the `Field` etc. If 
we have a solution that does not need such a trait, I am all for it.
   
   Opaque:
   
   This was just my thought of representing an unknown extension type. I am 
also happy with using the pyhsical type or adding a new logical type 
"DFUnknown<Physical>" that just does the same thing as the Physical type for 
all operations.



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