Skip to content

Conversation

@Yeolar
Copy link
Contributor

@Yeolar Yeolar commented Jul 25, 2017

Related to #878, add DCHECK for ReadXXX.

@pcmoritz
Copy link
Contributor

@Yeolar Looks good to me! Can you also fix the remaining Travis failure please?


Status ReadCreateRequest(uint8_t* data, ObjectID* object_id, int64_t* data_size,
int64_t* metadata_size) {
Status ReadCreateRequest(uint8_t* data, size_t size, ObjectID* object_id,
Copy link
Member

Choose a reason for hiding this comment

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

You probably want int64_t here for the size

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, I'll check it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why use int64_t for size type? The ReadXXX was called with parameter from std::vector<>, then the size is size_t type correspondingly. I see mostly using int64_t for size in the project, the reason is?

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I thought these were arrow::Buffer objects. @pcmoritz have you considered moving all your heap allocations to an Arrow memory pool?

We prefer to use signed integer types unless we are dealing with system calls (like malloc) or the STL, basically following Google's guidance on this https://google.github.io/styleguide/cppguide.html#Integer_Types

I think it's fine to leave this as is and we can refactor later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, got it, thanks.

using arrow::Status;

template <class T>
bool verify_flatbuffer(T* object, uint8_t* data, size_t size) {
Copy link
Member

Choose a reason for hiding this comment

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

If you receive int64_t size here, then you only have to static cast to size_t in one place when you create the verifier

Copy link
Contributor Author

Choose a reason for hiding this comment

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

emm, it seems int64_t is used for size type in the project, I'll have a look.

@pcmoritz
Copy link
Contributor

There are some linting fixes left to be done, you can get a proposal for fixes by running 'make format' as described in https://github.com/apache/arrow/blob/1a72acdf4daa68fe6e7639acde08a0abf795a3fc/cpp/README.md

I'd propose we merge this with size_t and move the heap allocations to an Arrow memory pool as a followup PR, I created a JIRA here: https://issues.apache.org/jira/browse/ARROW-1266

Copy link
Member

@wesm wesm left a comment

Choose a reason for hiding this comment

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

+1. Thank you for the contribution!

@asfgit asfgit closed this in 676a4a9 Jul 26, 2017
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