rguerreiromsft commented on PR #3736:
URL: https://github.com/apache/arrow-rs/pull/3736#issuecomment-1437358991

   > I do also wonder if we really need generics for this, or if a simple 
strict flag is all that is needed....
   
   I was thinking about this when implementing too. I tried to make it a 
Box<dyn TapeConverter> before but it didn't like that to_primitive is generic. 
So it couldn't be object safe.
   
   I was going to offer another PR with just the flag. Instead I'll rework this 
one and squash everything into one commit at the end. I agree with you that 
leaking implementation details makes it harder to evolve without breaking 
changes.
   
   I can create a few different flags that the user can opt-in:
   ```
   pub enum DecoderParserStrategy {
       PrimitiveToString, // Accepts 1 as "1" and true as "true"
       ObjectsToJsonString, // Accepts [123] as "[123]" and {"a": 123} as 
"{\"a\": 123}"
       NumberToBool, // Accepts 0 as false, otherwise it's true
       BoolToNumber, // true becomes 1 and false becomes 0
   }
   ```
   Then the user can provide these flags using an array, and by default none of 
them are enabled.
   
   I'll also make sure it can parse \n and \" from a string, maybe the best 
option is to use serde_json to do that.


-- 
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...@arrow.apache.org

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

Reply via email to