ByteBaker commented on issue #6553:
URL: https://github.com/apache/arrow-rs/issues/6553#issuecomment-2423257712
I'm a bit confused about the definition of this macro (and subsequent import
implications).
1. If I wanna use it inside `arrow-array::record_batch` (for tests), I need
to use `crate::<some type>` in the macro definition.
2. Doing (1) would mean I cannot use it in code outside `arrow-array`
because for that, I must have `arrow_array::<some type>` in the macro
definition.
3. **1** & **2** are mutually exclusive.
For example:
```rust
/// Works where `arrow_array` is a dependency
#[macro_export]
macro_rules! create_array {
(@array_of Boolean) => { arrow_array::BooleanArray };
// Other types here
($ty: tt, [$($values: expr),*]) => {
std::sync::Arc::new(<crate::create_array!(@array_of
$ty)>::from(vec![$($values),*]))
};
}
```
This works inside `arrow_array`
```rust
#[macro_export]
macro_rules! create_array {
(@array_of Boolean) => { crate::BooleanArray };
// Other types here
($ty: tt, [$($values: expr),*]) => {
std::sync::Arc::new(<crate::create_array!(@array_of
$ty)>::from(vec![$($values),*]))
};
}
```
@alamb @timsaucer some help please.
--
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]