-
Notifications
You must be signed in to change notification settings - Fork 786
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 record_batch!
macro for easy record batch creation
#6553
Comments
Hi, I like this idea. How about renaming this macro to |
I incorporated your recommendation in the last push of the PR in datafusion. |
record_batch!
macro for easy record batch creation
I think it looks really nice -- thank you @timsaucer and @Xuanwo |
I think this is a good first issue for someone who wants to try their hand out at contributing |
take |
@alamb this is the basic idea I have. Lemme know if I should change this. let schema: Arc<Schema> = ...;
let options: RecordBatchOptions = ...;
let array: Arc<Int32Array> = ...; // Can have more arrays
record_batch!(schema); // Creates empty RecordBatch
record_batch!(schema, [array]); // Returns a result
record_batch!(schema, [array], options); // Creates w/ options, returns a result Or do we want something that allows us to write a template-like, visually intuitive structure for creating an RB? For instance: record_batch!{
// Always required
[
"id", Int32, false // More fields can go in next lines
],
// Following bit be optional.
// Not giving data would create an empty RecordBatch
[
Int32Array[1, 2, 3, 4, 5] // More arrays can go in next lines
],
// `RecordBatchOptions` with `match_field_names` = false & `row_count` = Some(10)
// This bit is optional, and the absence will just use the default options
{true, 10}
} Also, how do we reconcile the return types in this case?
|
Thanks @ByteBaker -- maybe you can check out the implementation that @timsaucer put into DataFusion in apache/datafusion#12846 |
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
In apache/datafusion#12846 we added a macro to easily create a record batch for use in building up unit tests. It would be nice to move this upstream to this repo.
Describe the solution you'd like
Port code and optionally add remaining data types.
Describe alternatives you've considered
None
Additional context
apache/datafusion#12846
The text was updated successfully, but these errors were encountered: