buraksenn commented on issue #13037:
URL: https://github.com/apache/datafusion/issues/13037#issuecomment-2543312794
I've took another look into this and tried to change it but the issue is
that macro in arrow only accepts array literals such as:
[1,2,3]. However, in the datafusion macro it accepts vectors. One reference
of this macro is in this function:
```
let batches = vec![
create_record_batch(1, 5),
create_record_batch(6, 1),
create_record_batch(7, 5),
];
fn create_record_batch(start_value: i32, num_values: usize) -> RecordBatch {
let end_value = start_value + num_values as i32;
let a_vals: Vec<i32> = (start_value..end_value).collect();
let b_vals: Vec<f64> = a_vals.iter().map(|v| *v as f64).collect();
record_batch!(("a", Int32, a_vals), ("b", Float64, b_vals)).unwrap()
}
```
As far as I've tried, achieving the same is not possible with macro in arrow
crate in the same way. That's why I think we can update the macro in arrow to
the same in datafusion and then deprecate it here. But since I'm not Rust
expert not sure on this.
Arrow:
https://github.com/apache/arrow-rs/blob/c4dbf0d8af6ca5a19b8b2ea777da3c276807fc5e/arrow-array/src/record_batch.rs#L153-L174
Datafusion:
https://github.com/apache/datafusion/blob/bfabd48de2e0deccbd8ce595936ad24f18baca65/datafusion/common/src/test_util.rs#L338-L357
cc @timsaucer @alamb
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]