-
Notifications
You must be signed in to change notification settings - Fork 85
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
Rust API #1685
Rust API #1685
Conversation
Makefile
Outdated
@@ -107,6 +107,16 @@ nodejstest: arrow | |||
cd $(ROOT_DIR)/tools/nodejs_api/ && \ | |||
npm test | |||
|
|||
rust-test: |
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.
I think our naming convension is not to add a '-' between the language name and test. (e.g. nodesjstest rather than nodejs-test)
So rename to rusttest
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.
Done
tools/rust_api/src/value.rs
Outdated
db_string: Value::String("Hello World".to_string()), "STRING", | ||
db_bool: Value::Bool(true), "BOOLEAN", | ||
// Causes buffer manager failure | ||
// db_null_string: Value::Null(LogicalType::String), "STRING", |
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.
As we discussed, we currently don't support giving null/list values to parameters of preparedStatement.
you can remove this.
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.
Done
@@ -34,6 +34,9 @@ jobs: | |||
- name: Node.js test | |||
run: CC=gcc CXX=g++ make nodejstest NUM_THREADS=32 | |||
|
|||
- name: Rust test |
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.
let's test rust on clang and windows as well.
a31c6e6
to
601de13
Compare
I added a rustfmt check. Is it fine to have it separate like the clang-formatting-check, or now that there's multiple (maybe more in future: #1464) should the formatting checks be grouped together as multiple steps in a single job? |
It is fine to have separate format checks. Since checking format is a very simple job, maybe we should consider running it on GitHub runner instead of self-hosted moving forward? |
949302c
to
9b23b64
Compare
The rust API needs to call them from a const context.
A few issues are outstanding, but I think it's close enough for review.
Implements a rust API using the cxx crate, which was chosen over bindgen since it makes it possible to translate C++ exceptions into rust errors, and provides a bunch of extra safety checks.
The rust build runs
make debug
/make release
to get the kuzu libraries, and then passes those libraries to cargo to link to the rust library. This process should be transparent to any rust applications using kuzu with the obvious exception that they will need kuzu's build dependencies.Rust is const by default, which led to me making several functions const which didn't need to not be const.
Outstanding issues:
build.rs
is fragile and platform-specific (since for static libraries it also needs to link the dependencies explicitly):KUZU_TESTING
environment variable since it doesn't appear to affect rust software building against the kuzu crate.kuzu/src/include/storage/buffer_manager/bm_file_handle.h:173: kuzu::storage::PageState* kuzu::storage::BMFileHandle::getPageState(kuzu::common::page_idx_t): Assertion `pageIdx < numPages && pageStates[pageIdx]' failed
). This might be related to WITH NULL segmentation fault #1643.display(&mut self)
method). I feel like it would make more sense for the QueryResult to have a const function which produces an iterator, but I'm not sure how easy of a change that would be.kuzu_rs.h
shim would need to importkuzu.h
instead ofmain/kuzu.h
, etc. (could probably be handled with some macros).RECURSIVE_REL
,SERIAL
,ARROW_COLUMN
,MAP
,UNION
).