Skip to content

FFI API Audit #3028

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

Open
15 tasks
gatesn opened this issue Apr 16, 2025 · 0 comments
Open
15 tasks

FFI API Audit #3028

gatesn opened this issue Apr 16, 2025 · 0 comments
Assignees

Comments

@gatesn
Copy link
Contributor

gatesn commented Apr 16, 2025

  • #[deny(missing_docs)] in vortex-ffi/lib.rs
  • Define vx_ptype_t enum for variant
  • Define vx_dtype_t enum for variant.
  • Typedef vx_nullable_t to true/false enum.
  • vx_dtype_new should actually be vx_dtype_new_primitive(vx_ptype_t, nullable_t).
  • vx_dtype_get shoule be vx_dtype_t vx_dtype_variant(const vx_dtype *dtype)
  • Add vx_string type, without null-termination. Use this for all strings. Add a macro to construct vx_string from compile-time constant C str
  • Timestamp types, blergh. See Epic: Extension DTypes, Scalars, and Arrays #2989
  • Replace ArrayStream with ArrayIterator since the API is blocking. Use ScanBuilder::into_array_iter
  • Maybe hide file open / scan APIs inside DuckDB feature flag. As in, they're not public API yet since they're not stabilised in Rust even.
  • Use usize_t instead of uint64_t where usize is used in Rust. Else WASM API gets weird. We also use uint32 in a bunch of places that should also be usize_t, e.g. vx_array_null_count
  • Improve docs with consistent way of describing ownership.
  • Seems like we use struct <type_name> everywhere instead of the typedefs?
  • Perhaps rename vx_array_free and similar functions to _drop, since we often Arc internally it's not true that this call will always trigger a free. Don't mind either way. For Arc we should probably also add vx_T_clone too though.
  • Options structs should be opaque, with setter function that takes an option enum? Or individual setters? Not sure.

I still don't think we have error handling quite right. When propagating errors, I want to be able to write something like:

vx_result my_function(..., vx_err *err_out) {
  ...
  if !vx_something_blah(..., err_out) {
    return VXErr;
  }
}
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

No branches or pull requests

2 participants