lidavidm commented on code in PR #95:
URL: https://github.com/apache/arrow-adbc/pull/95#discussion_r959050111
##########
adbc.h:
##########
@@ -1061,7 +1048,7 @@ typedef AdbcStatusCode (*AdbcDriverInitFunc)(size_t
count, struct AdbcDriver* dr
struct AdbcError* error);
// For use with count
-#define ADBC_VERSION_0_0_1 27
+#define ADBC_VERSION_0_0_1 26
Review Comment:
Yes - the intent of the parameter is for the caller to express how many
entries there are in the AdbcDriver struct, so the driver can fill it
appropriately. And so this has to be updated when we add/remove items (well,
until we vote, after which we would have to add a new `#define` for future
entries).
It's sort of similar to what libraries like UCX do with `field_mask` here:
https://openucx.github.io/ucx/api/latest/html/group___u_c_p___w_o_r_k_e_r.html#structucp__worker__params
the caller/callee cooperate so that even if the struct size changes due to
updates, they can still remain compatible
That said I've been debating whether we want to actually use this, or
potentially do something like
```c
typedef AdbcStatusCode (*AdbcDriverInitFunc)(size_t version, void* driver,
size_t* initialized,
struct AdbcError* error)
#define ADBC_VERSION_1_0_0 0x100
// if version == ADBC_VERSION_1_0_0, void* driver should point to a struct
AdbcDriverV1
struct AdbcDriverV1 {
// ...
};
#deifne ADBC_VERSION_2_0_0 0x200
// if version == ADBC_VERSION_2_0_0, void* driver should point to a struct
AdbcDriverV2
struct AdbcDriverV2 {
struct AdbcDriverV1 base;
// new functions...
};
```
which might be easier to grok
--
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]