Skip to content
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

Merged
merged 7 commits into from
Dec 16, 2019
Merged

Refactor JNI library #1402

merged 7 commits into from
Dec 16, 2019

Conversation

dangleptr
Copy link
Contributor

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. :(

@dangleptr dangleptr added the ready-for-testing PR: ready for the CI test label Dec 11, 2019
@nebula-community-bot
Copy link
Member

Unit testing passed.

mutable std::vector<int64_t> offsets_;

private:
static int32_t getSchemaVer(Slice row);
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point


<groupId>com.vesoft</groupId>
<artifactId>nebula-utils</artifactId>
<version>1.0.0-beta</version>
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point.

@critical27
Copy link
Contributor

critical27 commented Dec 12, 2019

There is another problems, when I add jni as dependency in java client, the so is not loaded. Never mind, we can merge this first, fix it later.

@nebula-community-bot
Copy link
Member

Unit testing passed.

critical27
critical27 previously approved these changes Dec 12, 2019
public:
template<typename T>
typename std::enable_if<std::is_integral<T>::value, ResultType>::type
getInt(T& v) const noexcept;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please alignment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

// 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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please alignment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

// 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;
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sizeof(float) is 4 ?

Copy link
Contributor Author

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");
Copy link
Contributor

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);
        }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point

@nebula-community-bot
Copy link
Member

Unit testing passed.

@nebula-community-bot
Copy link
Member

Unit testing passed.

@dangleptr dangleptr merged commit 98a288e into vesoft-inc:master Dec 16, 2019
@dangleptr dangleptr deleted the jni branch December 16, 2019 09:30
tong-hao pushed a commit to tong-hao/nebula that referenced this pull request Jun 1, 2021
* Refactor jni

* Add UTs

* Rename class

* Update interfaces

* Address critical27 and darion's comments

* Address darion's comments
yixinglu pushed a commit to yixinglu/nebula that referenced this pull request Jan 31, 2023
add test case

dispatch to null value

fix ut

fix scan edge

fix

fix tck

Co-authored-by: Sophie <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-testing PR: ready for the CI test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants