paleolimbot commented on issue #767:
URL: https://github.com/apache/arrow-adbc/issues/767#issuecomment-1622785377

   Summarizing what I found while investigating this in #871:
   
   - An additional complication with Decimal256/128 is that the precision and 
scale aren't necessarily constant, so if you allowed specifying that option it 
would also require specifying the precision + scale.
   - The binary format is implemented here: 
https://github.com/postgres/postgres/blob/4f4d73466d71976b58f29121bab9d9fef6f3436e/src/backend/utils/adt/numeric.c#L1068-L1146
 .
   - The "convert to string" logic seems sufficiently compact that we could 
implement it in the driver without too much work: 
https://github.com/postgres/postgres/blob/4f4d73466d71976b58f29121bab9d9fef6f3436e/src/backend/utils/adt/numeric.c#L7416-L7552
   - In Postgres, "numeric cast to double" is just `strtod()` on the string 
value. We might be able to improve on that by using fastfloat (+ avoid locale 
issues with strtod).
   
   I can probably take a stab at the first two options (perhaps selected as an 
option on the statement like `"adbc.postgres.decimal"` of `"string"`, or 
`"double"`, defaulting to string).


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

Reply via email to