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

[C++][Improvement] Redesign and unify the implementation of validation in C++ Writer/Builder #186

Merged
merged 17 commits into from
Jun 13, 2023

Conversation

lixueclaire
Copy link
Contributor

Proposed changes

We need to develop a more comprehensive and consistent approach to validation across all of GraphAr's tools and libraries. As the first step, this change redesigned and unified the implementation of validation for Writer and Builder in the C++ library.

  • clarify and define different validation levels in the utils
  • hide the Validate interface to users and use validate_level as a parameter of the writing operations
  • simplify and unify the implementation for validation in Writer and Builder
  • add a Clear() method to high-level Builder, enabling to add data and then dump for multiple rounds
  • add test to prove the interface changes
  • update C++ API Reference to include the ValidateLevel type

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

Solve #183

@github-actions
Copy link

github-actions bot commented Jun 9, 2023

🎊 PR Preview 6ac637a has been successfully built and deployed to https://alibaba-graphar-build-pr-186.surge.sh

🤖 By surge-preview

@lixueclaire lixueclaire requested a review from acezen June 12, 2023 00:43
Copy link
Contributor

@acezen acezen left a comment

Choose a reason for hiding this comment

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

Thanks for the job, it's overall look good to me. there are some places I think we can revise:

  • In your design, the default_validate is invalid to writer/builder's validate level, so we need to note this in comment to users and add a check if validate_level is default_validate or not in constructors.
  • It seems that weak/strong's check is different for different operations. Beside the brief doc for ValidateLevel, how about add some docs to the operations that what will weak and strong check for the operation? I think that would help develop and user to understand the operation's behavior.
  • There are some codes not follow the google c++ code style, please fix them.

cpp/src/arrow_chunk_writer.cc Outdated Show resolved Hide resolved
cpp/src/arrow_chunk_writer.cc Show resolved Hide resolved
cpp/src/arrow_chunk_writer.cc Show resolved Hide resolved
cpp/src/arrow_chunk_writer.cc Show resolved Hide resolved
cpp/src/arrow_chunk_writer.cc Show resolved Hide resolved
cpp/src/arrow_chunk_writer.cc Show resolved Hide resolved
@lixueclaire
Copy link
Contributor Author

Thanks for the job, it's overall look good to me. there are some places I think we can revise:

  • In your design, the default_validate is invalid to writer/builder's validate level, so we need to note this in comment to users and add a check if validate_level is default_validate or not in constructors.
  • It seems that weak/strong's check is different for different operations. Beside the brief doc for ValidateLevel, how about add some docs to the operations that what will weak and strong check for the operation? I think that would help develop and user to understand the operation's behavior.
  • There are some codes not follow the google c++ code style, please fix them.

Thanks for your suggestions. For the second comment, weak/strong check is consistent for different operations now, strong_validate will also check the schema, while weak_validate only validates index, count, adj_list type, property group and size.

@acezen
Copy link
Contributor

acezen commented Jun 12, 2023

The code seems to meet the clang-format config, no need to refine.

@lixueclaire
Copy link
Contributor Author

I have checked the validate_level passed to constructors; added comments in src to explain the implementations for validations added docstrings for different validate levels for each Writer/Builder; and fixed the code style. @acezen, could you please have a look again?

Copy link
Contributor

@acezen acezen left a comment

Choose a reason for hiding this comment

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

LGTM

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.

2 participants