-
Notifications
You must be signed in to change notification settings - Fork 3
Add example #31
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
Add example #31
Conversation
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #31 +/- ##
=======================================
Coverage ? 75.30%
=======================================
Files ? 31
Lines ? 1300
Branches ? 0
=======================================
Hits ? 979
Misses ? 321
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
examples/write_and_read_streams.cpp
Outdated
| int_values.reserve(num_rows); | ||
| for (size_t i = 0; i < num_rows; ++i) | ||
| { | ||
| int_values.push_back(int_dist(gen)); |
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 use std::generate here instead of the loop.
Same for other vectors.
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.
+1. And the distribution could be directly instantiated as the second parameter of the generate function.
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.
Fixed
| { | ||
| field_names.emplace_back(field->name()->str()); | ||
| } | ||
| else { |
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.
| else { | |
| else | |
| { |
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.
Fixed
| [[nodiscard]] ::flatbuffers::Offset< | ||
| ::flatbuffers::Vector<::flatbuffers::Offset<org::apache::arrow::flatbuf::Field>>> | ||
| create_children(flatbuffers::FlatBufferBuilder& builder, sparrow::record_batch::column_range columns); | ||
| create_children(flatbuffers::FlatBufferBuilder& builder, const sparrow::record_batch& record_batch); |
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.
Isn't this redundant with the previous function?
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.
Fixed
examples/write_and_read_streams.cpp
Outdated
| * Helper function to create a record batch with the same schema but random values | ||
| * All batches have: int32 column, float column, bool column, and string column | ||
| */ | ||
| sp::record_batch create_random_record_batch(size_t num_rows) |
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 move the helper functions to another file to improve readability?
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.
I think moving them into a "detail" or "util" namespace should be enough.
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.
Fixed
|
|
||
| int main() | ||
| { | ||
| std::cout << "=== Sparrow IPC Stream Write and Read Example ===\n"; |
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 I missed it but it seems we're missing reading from an already existing stream file? (from the integration tests for example?) and also maybe write into a stream file?
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.
Fixed
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.
I think the different "steps" of the main functions could be moved in dedicated functions so that it's easier for the reader to browse them and understand quickly each of them.
examples/write_and_read_streams.cpp
Outdated
| int_values.reserve(num_rows); | ||
| for (size_t i = 0; i < num_rows; ++i) | ||
| { | ||
| int_values.push_back(int_dist(gen)); |
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.
+1. And the distribution could be directly instantiated as the second parameter of the generate function.
examples/write_and_read_streams.cpp
Outdated
| * Helper function to create a record batch with the same schema but random values | ||
| * All batches have: int32 column, float column, bool column, and string column | ||
| */ | ||
| sp::record_batch create_random_record_batch(size_t num_rows) |
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.
I think moving them into a "detail" or "util" namespace should be enough.
No description provided.