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

[Improvement][C++] Use inherit to implement EdgesCollection #238

Merged
merged 18 commits into from
Oct 11, 2023

Conversation

acezen
Copy link
Contributor

@acezen acezen commented Sep 26, 2023

Proposed changes

  • replace the variant of EdgesCollection with inheritance to implement polymorphism of different adj list type edges collection.
  • Add cpp build process to JAVA CMakeList to make JAVA SDK base on a specific version of cpp SDK, not compile with the latest commit. That would help the breaking change in C++ SDK not to infect JAVA SDK imediately.

Types of changes

What types of changes does your code introduce to GraphAr?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

@Thespica
Copy link
Contributor

Thespica commented Oct 7, 2023

I think the best way to adapt this change is getting EdgesCollection from factory function directly.

For details, you need:

  • Remove 4 supper classes of EdgesCollection;
  • Remove create function in EdgesCollection;
  • Write a new factory function in util/GrapharStaticFunctions.java to create EdgesCollection, which maps ConstructEdgesCollection in C++;
  • Add annotations for EdgesCollection:
    • For class: @FFIGen @FFITypeAlias @CXXHead
    • For return objects: @CXXReference or @CXXValue
  • Modify related usage in test.

If there are new problems, please reach out to me.

@acezen acezen marked this pull request as ready for review October 8, 2023 07:18
@@ -36,8 +36,8 @@ int main(int argc, char* argv[]) {
auto maybe_vertices =
GAR_NAMESPACE::ConstructVerticesCollection(graph_info, label);
ASSERT(maybe_vertices.status().ok());
auto& vertices = maybe_vertices.value();
int num_vertices = vertices.size();
auto vertices = maybe_vertices.value();
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe use auto& consistently is better?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@acezen
Copy link
Contributor Author

acezen commented Oct 11, 2023

@lixueclaire any comments?

Copy link
Contributor

@lixueclaire lixueclaire left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -19,10 +20,12 @@ include_directories("src/main/native")
include_directories("src/test/native")

find_package(Arrow REQUIRED)
find_package(gar REQUIRED)
include(graphar-cpp)
build_graphar_cpp()
Copy link
Contributor

Choose a reason for hiding this comment

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

Developers usually need recompile JNI code through CMake, but not need rebuild GraphAr C++ library.

Maybe check C++ library is installed before build it? Or make it optional?

Copy link
Contributor

Choose a reason for hiding this comment

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

BTW, we also need to check installed C++ library's version if we choose the first solution.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The C++ library is actually just build for the first time, so i think it's ok for that.

@acezen acezen merged commit 6b8cd62 into apache:main Oct 11, 2023
5 checks passed
@acezen acezen deleted the 237-edgescollection branch October 11, 2023 06:37
@acezen acezen added this to the Release v0.10.0[WIP] milestone Oct 19, 2023
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

Successfully merging this pull request may close these issues.

3 participants