-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Refactor JNI library #1402
Refactor JNI library #1402
Conversation
Unit testing passed. |
mutable std::vector<int64_t> offsets_; | ||
|
||
private: | ||
static int32_t getSchemaVer(Slice row); |
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.
Do we need to unify the type of schema version? The SchemaVer
used in thrift is int64_t
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.
Good point
src/jni/java/pom.xml
Outdated
|
||
<groupId>com.vesoft</groupId> | ||
<artifactId>nebula-utils</artifactId> | ||
<version>1.0.0-beta</version> |
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.
maybe it's 1.0.0-RC2
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.
Good point.
There is another problems, when I add |
Unit testing passed. |
src/jni/src/datamanlite/RowReader.h
Outdated
public: | ||
template<typename T> | ||
typename std::enable_if<std::is_integral<T>::value, ResultType>::type | ||
getInt(T& v) const noexcept; |
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.
please alignment
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.
good catch
src/jni/src/datamanlite/RowReader.h
Outdated
// A negative number will be returned if an error occurs | ||
template<typename T> | ||
typename std::enable_if<std::is_integral<T>::value, int32_t>::type | ||
readInteger(int64_t offset, T& v) const noexcept; |
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.
please alignment
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.
good catch
src/jni/src/datamanlite/RowReader.h
Outdated
// When succeeded, offset will advance | ||
template<typename T> | ||
typename std::enable_if<std::is_integral<T>::value, ResultType>::type | ||
getInt(int64_t index, int64_t& offset, T& v) const noexcept; |
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.
alignment
break; | ||
} | ||
case ValueType::FLOAT: { | ||
// Eight bytes |
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.
sizeof(float) is 4 ?
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.
good catch.
private static final Logger LOGGER = LoggerFactory.getLogger(NebulaCodec.class.getName()); | ||
|
||
static { | ||
System.loadLibrary("nebula_codec"); |
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.
We'd better catch exception/error here, when java client import this as dependency, will throw exception and error.
try {
System.loadLibrary("nebula_codec");
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
} catch (Error e) {
LOGGER.error(e.getMessage(), e);
}
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.
Good point
Unit testing passed. |
Unit testing passed. |
* Refactor jni * Add UTs * Rename class * Update interfaces * Address critical27 and darion's comments * Address darion's comments
add test case dispatch to null value fix ut fix scan edge fix fix tck Co-authored-by: Sophie <[email protected]>
The old jni lib depends on fbthrift, it is unfriendly when our users want to compile it locally.
Now, the new JNI library only depends on STL and glog.
Our users could build it more easily by themself.
For datamanlite, it is a simpler codec library than dataman. Although there are some duplicate codes currently, it will be cleaned up after @sherman-the-tank refactor it.
Of course, we fix serval bugs during the development. :(