theirix commented on code in PR #21737:
URL: https://github.com/apache/datafusion/pull/21737#discussion_r3804653416


##########
datafusion/catalog/src/information_schema.rs:
##########
@@ -411,26 +412,136 @@ impl InformationSchemaConfig {
     }
 }
 
+/// Resolve a native type `NativeType` to `DataType` for use in the 
information schema
+/// Since it is one-to-many, use the most representative type on tie
+fn get_data_type_for_schema(native_type: &NativeType) -> Result<DataType> {
+    match native_type {
+        NativeType::Null => Ok(DataType::Null),
+        NativeType::Boolean => Ok(DataType::Boolean),
+        NativeType::Int8 => Ok(DataType::Int8),
+        NativeType::Int16 => Ok(DataType::Int16),
+        NativeType::Int32 => Ok(DataType::Int32),

Review Comment:
   @Jefffrey , thank you for this! I took another look and reworked it 
significantly.
   
   I agree, UDF's field and return type resolvers are still on physical Arrow 
types, and the high-level rework should be done as part of the bigger #12622 
epic. I think this could be a small step toward that migration.
   
   Instead of moving a huge mapping around, I decided to reuse the existing 
`LogicalType::default_cast_for` logical-physical mapping. It is much leaner 
now, and all the logic is consolidated in one place, not spread across crates. 
We can reason on logical types for the catalog. When we remove the deprecated 
`get_example_types`, there won't be any traces of the mapping in the high-level 
catalog and expr crates. What do you think?
   
   @martin-g, regarding your concern - the details of mapping, `keys_sorted`, 
and nested structures are now the responsibility of a `LogicalType`



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