Skip to content
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

docs: describe how drivers/driver manager relate #1655

Merged
merged 2 commits into from
Mar 26, 2024

Conversation

lidavidm
Copy link
Member

Fixes #1651.

Comment on lines 22 to 24
.. note:: This document focuses on drivers/applications using the C API
definitions in adbc.h. That means C/C++/Python/Ruby, and possibly
C#/Go.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't all drivers be using the definitions in adbc.h?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in Rust, Go, etc.?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, maybe we should reword this then? drivers/applications that provide C shared objects?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not necessarily about shared objects either. It's about drivers that use those API definitions/that ABI.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If they are providing a loadable driver for ADBC, it should be using those API definitions/that ABI. Otherwise it wouldn't be compatible, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But you don't have to have a shared object. You could provide a static library for C/C++ users. You could (as R does) embed multiple driver definitions in one library and not provide the Adbc* functions in the first place.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not related to whether a shared object is involved in the first place

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. fair, just seems like there's a better way to describe it but I can't think of one at the moment

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to

.. note:: This document focuses on drivers/applications that implement or
          consume the C API definitions in adbc.h.  That includes C/C++,
          Python, and Ruby; and possibly C#, Go, and Rust (when implementing
          or consuming drivers via FFI).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, Java never uses the header

Comment on lines +101 to +109
Unfortunately, this doesn't work as well in other scenarios. For example, if
an application wishes to use multiple ADBC drivers, this no longer works: both
drivers define the same functions (the ones in adbc.h), and when the
application links both of them, the linker has no way of telling which
driver's function is meant when the application calls an ADBC function. On
top of that, this violates the `One Definition Rule`_.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If two drivers try to expose both the Adbc.... methods and their own aliases, won't we still get a duplicate symbol issue when dynamically loading both? Should we indicate that the symbols need to be weak symbols to prevent that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's an issue at this point (well, I suppose it's an issue if you still try and use the symbols), but we don't mark any of our symbols as weak.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might end up being an issue in the future that we should keep in mind then at least.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you file a separate issue then?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do

Comment on lines +128 to +136
ADBC anticipated this, and defined :cpp:struct:`AdbcDriver`. This is just a
table of function pointers with one entry per ADBC function. That way, an
application can dynamically load a driver and call an entrypoint function that
returns this table of function pointers. (It does have to hardcode or guess
the name of the entrypoint; the ADBC spec lists a set of names it can try,
based on the name of the driver library itself.)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably explain why we didn't just only do this, what benefit do we get from allowing simple case over just requiring this every time

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, because you can link to the driver and use it. Do we have to spell it out more than we already did?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this comment before I saw the additional stuff below it. I think you've covered it pretty well

In More Detail
==============

The adbc.h header ties everything together. It is the abstract API

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a link to the header file? https://github.com/apache/arrow/blob/main/format/adbc.h

@lidavidm lidavidm merged commit 7d5f1f0 into apache:main Mar 26, 2024
23 of 25 checks passed
@lidavidm lidavidm deleted the gh-1651 branch March 26, 2024 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

docs: add prose docs on authoring drivers
3 participants