notfilippo commented on issue #11513:
URL: https://github.com/apache/datafusion/issues/11513#issuecomment-2245278317

   > if we opt for logicalType, how do users then specify the physical types?
   
   @doki23 -- Through the use of a custom implementation of the `TypeRelation` 
trait, which then can be used inside a `LogicalPhysicalSchema`. All type 
sources (see proposal) would need to be edited to support returning this new 
type of schema which will then be embedded into a DFSchema and used to carry 
both the physical and the logical type knowledge throughout logical and 
physical planning.
   
   <details>
   <summary>Example</summary>
   
   ```rust
   #[derive(Debug)]
   struct MyString {
       logical: LogicalType,
       physical: DataType,
   }
   
   impl Default for MyString {
       fn default() -> Self {
           Self {
               logical: LogicalType::Utf8,
               physical: DataType::new_list(DataType::UInt8, false),
           }
       }
   }
   
   impl TypeRelation for MyString {
       fn logical(&self) -> &LogicalType {
           &self.logical
       }
       fn physical(&self) -> &DataType {
           &self.physical
       }
       // ...
   }
   ```
   
   </details>


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