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

   I am not sure I'll get to this soon but I think some reasonable steps might 
be:
   
   Add a `virtual ArrowErrorCode Find(std::vector<uint32_t> oids, 
std::vector<PostgresType>* out, ArrowError* error)` overload to look up more 
than one OID at a time:
   
   
https://github.com/apache/arrow-adbc/blob/9ac8f6c78bbb28c80d81609e37b823b255a7f09d/c/driver/postgresql/postgres_type.h#L390
   
   ...and wire up existing uses of `Find()` to use the "bulk" approach where 
possible. Then, somewhere around here:
   
   
https://github.com/apache/arrow-adbc/blob/9ac8f6c78bbb28c80d81609e37b823b255a7f09d/c/driver/postgresql/database.cc#L125-L132
   
   ...make a concrete subclass of the PostgresTypeResolver that implements the 
"bulk" and non-bulk finds by connecting to the database and issuing a query (if 
needed). I think the query would be much like the existing one except filtering 
on OID and possibly issuing an additional query(queries?) if one of those types 
is a "record" type (because the record type won't insert unless its column 
types are also available in the cache). There's an example of issuing a query 
with a parameterized "any of these integer things is equal to" in the 
GetObjects helper:
   
   
https://github.com/apache/arrow-adbc/blob/9ac8f6c78bbb28c80d81609e37b823b255a7f09d/c/driver/postgresql/connection.cc#L67-L77
   
   Connecting to a database, issuing one or more queries, then disconnecting is 
obviously slow, so if we did this we might need to stay connected for some 
amount of time before disconnecting. Also, to avoid doing this at all when a 
user issues a query, we probably want to cache all the types in 
`PostgresTypeIdAll(/*nested*/false)`.
   
   
https://github.com/apache/arrow-adbc/blob/9ac8f6c78bbb28c80d81609e37b823b255a7f09d/c/driver/postgresql/postgres_type.h#L948-L1034


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