Skip to content

Commit 3c3eb1f

Browse files
committed
Small text adjustments for clarity and formatting
1 parent e225ae1 commit 3c3eb1f

File tree

1 file changed

+10
-9
lines changed
  • docs/source/contributor-guide

1 file changed

+10
-9
lines changed

docs/source/contributor-guide/ffi.rst

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ as performant as possible and to utilize the features of DataFusion, you may dec
3434
your source in Rust and then expose it through `PyO3 <https://pyo3.rs>`_ as a Python library.
3535

3636
At first glance, it may appear the best way to do this is to add the ``datafusion-python``
37-
crate as a dependency and then provide a ``PyTable`` and then to register it with the
37+
crate as a dependency, provide a ``PyTable``, and then to register it with the
3838
``SessionContext``. Unfortunately, this will not work.
3939

4040
When you produce your code as a Python library and it needs to interact with the DataFusion
@@ -74,7 +74,7 @@ code that does **not** require the ``datafusion-python`` crate as a dependency,
7474
code in Python via PyO3, and have it interact with the DataFusion Python package.
7575

7676
Early adopters of this approach include `delta-rs <https://delta-io.github.io/delta-rs/>`_
77-
who has adapted their Table Provider for use in `datafusion-python` with only a few lines
77+
who has adapted their Table Provider for use in ```datafusion-python``` with only a few lines
7878
of code. Also, the DataFusion Python project uses the existing definitions from
7979
`Apache Arrow CStream Interface <https://arrow.apache.org/docs/format/CStreamInterface.html>`_
8080
to support importing **and** exporting tables. Any Python package that supports reading
@@ -90,7 +90,7 @@ Inspiration from Arrow
9090

9191
DataFusion is built upon `Apache Arrow <https://arrow.apache.org/>`_. The canonical Python
9292
Arrow implementation, `pyarrow <https://arrow.apache.org/docs/python/index.html>`_ provides
93-
and excellent way to share Arrow data between Python projects without performing any copy
93+
an excellent way to share Arrow data between Python projects without performing any copy
9494
operations on the data. They do this by using a well defined set of interfaces. You can
9595
find the details about their stream interface
9696
`here <https://arrow.apache.org/docs/format/CStreamInterface.html>`_. The
@@ -117,7 +117,7 @@ Implementation Details
117117

118118
The bulk of the code necessary to perform our FFI operations is in the upstream
119119
`DataFusion <https://datafusion.apache.org/>`_ core repository. You can review the code and
120-
documentation in the `datafusion-ffi <https://crates.io/crates/datafusion-ffi>`_ crate.
120+
documentation in the `datafusion-ffi`_ crate.
121121

122122
Our FFI implementation is narrowly focused at sharing data and functions with Rust backed
123123
libraries. This allows us to use the `abi_stable crate <https://crates.io/crates/abi_stable>`_.
@@ -127,7 +127,7 @@ you can simply convert it to a ``RVec<RString>`` in an intuitive manner. It also
127127
features like ``RResult`` and ``ROption`` that do not have an obvious translation to a
128128
C equivalent.
129129

130-
The `datafusion-ffi` crate has been designed to make it easy to convert from DataFusion
130+
The `datafusion-ffi`_ crate has been designed to make it easy to convert from DataFusion
131131
traits into their FFI counterparts. For example, if you have defined a custom
132132
`TableProvider <https://docs.rs/datafusion/45.0.0/datafusion/catalog/trait.TableProvider.html>`_
133133
and you want to create a sharable FFI counterpart, you could write:
@@ -145,7 +145,7 @@ you needed to turn it back into an ``TableProvider``, you can turn it into a
145145
146146
let foreign_provider: ForeignTableProvider = ffi_provider.into();
147147
148-
If you review the code in `datafusion-ffi` you will find that each of the traits we share
148+
If you review the code in `datafusion-ffi`_ you will find that each of the traits we share
149149
across the boundary has two portions, one with a ``FFI_`` prefix and one with a ``Foreign``
150150
prefix. This is used to distinguish which side of the FFI boundary that struct is
151151
designed to be used on. The structures with the ``FFI_`` prefix are to be used on the
@@ -156,7 +156,7 @@ it is the ``datafusion-python`` library.
156156

157157
In order to share these FFI structures, we need to wrap them in some kind of Python object
158158
that can be used to interface from one package to another. As described in the above
159-
section on our inspiration from Arrow, we use `PyCapsule`. We can create a PyCapsule
159+
section on our inspiration from Arrow, we use ``PyCapsule``. We can create a ``PyCapsule``
160160
for our provider thusly:
161161

162162
.. code-block:: rust
@@ -207,5 +207,6 @@ Status of Work
207207
--------------
208208

209209
At the time of this writing, the FFI features are under active development. To see
210-
the latest status, we recommend reviewing the code in the
211-
`DataFusion repository <https://github.com/apache/datafusion/tree/main/datafusion/ffi/>`_.
210+
the latest status, we recommend reviewing the code in the `datafusion-ffi`_ crate.
211+
212+
.. _datafusion-ffi: https://crates.io/crates/datafusion-ffi

0 commit comments

Comments
 (0)