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

feat: record_batch! macro #6588

Merged
merged 1 commit into from
Nov 16, 2024
Merged

feat: record_batch! macro #6588

merged 1 commit into from
Nov 16, 2024

Conversation

ByteBaker
Copy link
Contributor

closes: #6553

@github-actions github-actions bot added the arrow Changes to the arrow crate label Oct 18, 2024
@ByteBaker
Copy link
Contributor Author

For your review @alamb

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you @ByteBaker -- this looks great to me.

I think it might also be nice to put a link to this macro on other docs

https://docs.rs/arrow/latest/arrow/record_batch/struct.RecordBatch.html#method.try_from_iter

And also to add an example to the the RecordBatch docs themselves https://docs.rs/arrow/latest/arrow/record_batch/struct.RecordBatch.html

cc @timsaucer

arrow-array/src/record_batch.rs Show resolved Hide resolved
@timsaucer
Copy link

Thank you for doing this!

@ByteBaker
Copy link
Contributor Author

@alamb you're right. I was just lazy and did the bare-minimum. Lemme see how I can further extend this to cover more types and add necessary docs wherever applicable. I'll be back soon.

@alamb alamb marked this pull request as draft November 15, 2024 20:53
@alamb
Copy link
Contributor

alamb commented Nov 15, 2024

Marking as draft as the CI is not passing and there seems to be planned work. CI might pass if we merge up from main

@ByteBaker
Copy link
Contributor Author

@alamb sorry but I've been somewhat occupied the past several weeks. There's some work I've done but I don't think it's quite ready yet.

@ByteBaker ByteBaker closed this Nov 16, 2024
@ByteBaker ByteBaker reopened this Nov 16, 2024
@ByteBaker ByteBaker marked this pull request as ready for review November 16, 2024 12:24
@ByteBaker ByteBaker force-pushed the master branch 2 times, most recently from e05d26d to e4310ab Compare November 16, 2024 12:36
@ByteBaker
Copy link
Contributor Author

ByteBaker commented Nov 16, 2024

@alamb @timsaucer I've synced the repo and pushed the work for now. Please take a look.

I believe this covers most, if not all the non-nested types. I've also added the necessary docs, clearly mentioning the limitations of this macro.

@timsaucer
Copy link

Oh nice. FWIW, I don’t think we need to cover nested types. This is really just a convenience macro and primarily used for unit tests and examples, so it’s perfectly reasonable in my opinion that the scope is limited. For anything more the user can do what they’ve been doing until now.

I will try to review tomorrow or Monday unless someone gets to it first.

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Love it

@@ -411,6 +547,19 @@ impl RecordBatch {
/// ("b", b),
/// ]);
/// ```
/// Another way to quickly create a [`RecordBatch`] is to use the [`record_batch!`] macro,
Copy link
Contributor

Choose a reason for hiding this comment

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

💯

@alamb alamb merged commit 1f19412 into apache:master Nov 16, 2024
26 checks passed
@alamb
Copy link
Contributor

alamb commented Nov 16, 2024

Thanks @ByteBaker and @timsaucer

@alamb alamb added the enhancement Any new improvement worthy of a entry in the changelog label Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add record_batch! macro for easy record batch creation
3 participants