notfilippo commented on issue #11513: URL: https://github.com/apache/datafusion/issues/11513#issuecomment-2247283135
@jayzhan211 & @doki23 -- I'll try to answer both with a single comment: the proposal includes (you can see it where LogicalPhysicalType is defined) an implementation of the `From<DataType>` trait for `LogicalType`. This implies that if we introduce a LogicalPhysicalSchema type, containing LogicalPhysicalFields a possible way to convert between types would be: ```rust let schema = Schema::new(/* ... */); let logical_physical_schema: LogicalPhysicalSchema = schema.into(); // Suppose that DFSchema is edited to support LogicalPhysicalSchemaRef instead of SchemaRef let df_schema = DFSchema::try_from_qualified_schema("t1", &logical_physical_schema).unwrap(); ``` The `into()` call will convert all known arrow::DataTypes in the schema to a `NativeType` which will keep a reference to the original DataType and its logical representation. ```rust let string_view = DataType::StringView; let logical_string_view: LogicalPhysicalType = string_view.into(); // logical_string_view will be: // LogicalPhysicalType(Arc(NativeType { logical: Utf8, physical: StringView })) ``` Instead for user defined types instead of converting an arrow::Schema into a LogicalPhysicalSchema you would directly define a LogicalPhysicalSchema where you can use your own arrow-compatible LogicalPhysicalTypes. -- 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