-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Java wrapper for Native Comparators #3334
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
Java wrapper for Native Comparators #3334
Conversation
db87e2c to
a141862
Compare
|
@adamretter has updated the pull request. |
a141862 to
4b6e9e7
Compare
|
@adamretter has updated the pull request. |
benclay
left a comment
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.
Looks good to me FWIW.
java/rocksjni/options.cc
Outdated
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.
Nit: It'd be nice to have a native enum and reinterpret_cast jcomparator_type into it instead of using byte values directly each time, here and elsewhere.
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.
Nit: Could you add a short 1-line comment for each of these? I was jumping back to the corresponding *Comparator.java class javadocs initially, a brief description would help the reader.
4b6e9e7 to
e4f9c45
Compare
|
@adamretter has updated the pull request. |
e4f9c45 to
1648a09
Compare
|
@adamretter has updated the pull request. |
1648a09 to
a93eda8
Compare
|
@adamretter has updated the pull request. |
facebook-github-bot
left a comment
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.
@miasantreble has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
… C++ code from Java
a93eda8 to
62adec9
Compare
|
@adamretter has updated the pull request. |
facebook-github-bot
left a comment
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.
@miasantreble is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: This is an abstraction for working with custom Comparators implemented in native C++ code from Java. Native code must directly extend `rocksdb::Comparator`. When the native code comparator is compiled into the RocksDB codebase, you can then create a Java Class, and JNI stub to wrap it. Useful if the C++/JNI barrier overhead is too much for your applications comparator performance. An example is provided in `java/rocksjni/native_comparator_wrapper_test.cc` and `java/src/main/java/org/rocksdb/NativeComparatorWrapperTest.java`. Closes #3334 Differential Revision: D7172605 Pulled By: miasantreble fbshipit-source-id: e24b7eb267a3bcb6afa214e0379a1d5e8a2ceabe
Summary: This is an abstraction for working with custom Comparators implemented in native C++ code from Java. Native code must directly extend `rocksdb::Comparator`. When the native code comparator is compiled into the RocksDB codebase, you can then create a Java Class, and JNI stub to wrap it. Useful if the C++/JNI barrier overhead is too much for your applications comparator performance. An example is provided in `java/rocksjni/native_comparator_wrapper_test.cc` and `java/src/main/java/org/rocksdb/NativeComparatorWrapperTest.java`. Closes #3334 Differential Revision: D7172605 Pulled By: miasantreble fbshipit-source-id: e24b7eb267a3bcb6afa214e0379a1d5e8a2ceabe
|
Hello @adamretter do you know which release version will include this interface? |
This is an abstraction for working with custom Comparators implemented in native C++ code from Java. Native code must directly extend
rocksdb::Comparator. When the native code comparator is compiled into the RocksDB codebase, you can then create a Java Class, and JNI stub to wrap it.Useful if the C++/JNI barrier overhead is too much for your applications comparator performance.
An example is provided in
java/rocksjni/native_comparator_wrapper_test.ccandjava/src/main/java/org/rocksdb/NativeComparatorWrapperTest.java.