You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/04/26 12:49:29 UTC

[GitHub] [arrow-rs] alamb opened a new issue #199: Implement Debug printing "kernel"

alamb opened a new issue #199:
URL: https://github.com/apache/arrow-rs/issues/199


   *Note*: migrated from original JIRA: https://issues.apache.org/jira/browse/ARROW-11882
   
   [~jorgecarleitao] offered a great way to improve the Debug/Display implementations for various Array implementations on https://github.com/apache/arrow/pull/9624#issuecomment-790976766 
   
   The only reason we are implementing to_isize/to_usize on NativeType is because we have a function to represent an array (for Display) that accepts a generic physical type T, and then tries to convert it to a isize depending on a logical type (DataType::Date). However, there is already a Many to one relationship between logical and physical types.
   
   Thus, a solution for this is to have the `Debug` function branch off depending on the (logical) datatype, implementing the custom string representation depending on it, instead of having a loop of native type T and then branching off according to the DataType inside the loop.
   
   I.e. instead of
   
   {code}
   for i in ... {
      match data_type {
            DataType::Date32 => represent array[i] as date
            DataType::Int32 => represent array[i] as int
      }
   }
   {code}
   
   imo we should have
   
   {code}
   match data_type {
        DataType::Date32 => for i in ... {represent array[i] as date}
        DataType::Int32 => for i in ... {represent array[i] as int}
   }
   {code}
   
   i.e. treat the Display as any other "kernel", where behavior is logical, not physical, type-dependent.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org