-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support bind named parameters via Adbc.Buffer
#68
Conversation
For complex data types it can be something like below [
Adbc.Buffer.i8([1,2,3]),
Adbc.Buffer.list(
Adbc.Buffer.i8([1,2,3])
),
Adbc.Buffer.list(
Adbc.Buffer.list(
Adbc.Buffer.i8([1,2,3])
)
),
Adbc.Buffer.struct([
Adbc.Buffer.i8([1,2,3], name: "col1"),
Adbc.Buffer.i8([4,5,6], name: "col2")
]),
Adbc.Buffer.struct([
Adbc.Buffer.struct([
Adbc.Buffer.i8([1,2,3], name: "field1_1"),
Adbc.Buffer.i8([4,5,6], name: "field1_2")
], name: "field1"),
Adbc.Buffer.struct([
Adbc.Buffer.i8([7,8,9], name: "field2_1"),
Adbc.Buffer.i8([10,11,12], name: "field2_2")
], name: "field2")
])
] But I'm not sure if it's good or okay-ish design. WDYT? |
All primitive data types are supported now. The left ones are
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great to me. My only question is if in some cases it is better to keep the buffer as a binary, instead of a list, but I think that's just impossible to certain data types, such as strings, so a list sounds good to me.
Also, a follow up question is, should we change Adbc.Connection.query to return a map of buffers (instead of a map of lists)? So this way we have more information available (such as the metadata of each buffer)? In any case, if we want to do this, let's do it in a separate pull request.
Actually I think we probably can keep the buffer as a binary for some types (i.e., all integer types and f32, f64), it should be more efficient when passing to other libraries.
Return a map of
Absolutely, let's do this in another PR. |
Oh wait, if there is a |
Yes, exactly. Given they are lists, I think we should probably have not named Adbc.Buffer. What do you think about:
Could you please send a PR? |
No problem! I'll send a PR for this ;) |
Updated the list for the types left to be implemented:
|
So now I've done most of these, the only things left to do is
As for map, it's a logical type, which is essentially a list of structs, and we can already encode/decode that. For I'll do encode/decode dictionary today, and if there's enough time I'll also add support for encoding sparse/dense unions. And after that, all official types will be available for encoding/decoding in this library. /cc @josevalim |
Hi @josevalim, this PR is currently a WIP and a draft for issue #66.
If I understand your suggestions in #66 correctly, we're expecting users to do things like
adbc_buffer_to_arrow_type_struct
(we can rename this later), we will iterate the parameter list,[Adbc.Buffer.<type>...]
,adbc_buffer_to_adbc_field
, and a correspondingArrowArray
andArrowSchema
will be built.adbc_buffer_to_arrow_type_struct
and the result will be passed toAdbcStatementBind
Although I haven't quite decided how we should represent more complex data types like nested structs and lists using
Adbc.Buffer
yet.