jayzhan211 opened a new issue, #5459:
URL: https://github.com/apache/arrow-rs/issues/5459
**Is your feature request related to a problem or challenge? Please describe
what you are trying to do.**
<!--
A clear and concise description of what the problem is. Ex. I'm always
frustrated when [...]
(This section helps Arrow developers understand the context and *why* for
this feature, in addition to the *what*)
-->
**Describe the solution you'd like**
<!--
A clear and concise description of what you want to happen.
-->
I want to build Scalar with ArrayRef, but I got an err
```
error[E0277]: the trait bound
`std::sync::Arc<arrow_array::GenericListArray<i32>>: arrow_array::Array` is not
satisfied
--> datafusion/common/src/scalar/mod.rs:3352:29
|
3352 | let s = Scalar::new(arr);
| ----------- ^^^ the trait `arrow_array::Array` is not
implemented for `std::sync::Arc<arrow_array::GenericListArray<i32>>`
| |
| required by a bound introduced by this call
|
= help: the trait `arrow_array::Array` is implemented for
`std::sync::Arc<(dyn arrow_array::Array + 'static)>`
note: required by a bound in `arrow_array::Scalar::<T>::new`
-->
/Users/jayzhan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/arrow-array-50.0.0/src/scalar.rs:130:9
|
130 | impl<T: Array> Scalar<T> {
| ^^^^^ required by this bound in `Scalar::<T>::new`
...
136 | pub fn new(array: T) -> Self {
| --- required by a bound in this associated function
error[E0277]: the trait bound
`std::sync::Arc<arrow_array::GenericListArray<i32>>: arrow_array::Array` is not
satisfied
--> datafusion/common/src/scalar/mod.rs:3352:17
|
3352 | let s = Scalar::new(arr);
| ^^^^^^^^^^^^^^^^ the trait `arrow_array::Array` is
not implemented for `std::sync::Arc<arrow_array::GenericListArray<i32>>`
|
= help: the trait `arrow_array::Array` is implemented for
`std::sync::Arc<(dyn arrow_array::Array + 'static)>`
note: required by a bound in `arrow_array::Scalar`
-->
/Users/jayzhan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/arrow-array-50.0.0/src/scalar.rs:128:22
|
128 | pub struct Scalar<T: Array>(T);
| ^^^^^ required by this bound in `Scalar`
error[E0277]: the trait bound
`std::sync::Arc<arrow_array::GenericListArray<i32>>: arrow_array::Array` is not
satisfied
--> datafusion/common/src/scalar/mod.rs:3353:26
|
3353 | println!("{:?}", s);
| ---- ^ the trait `arrow_array::Array` is not
implemented for `std::sync::Arc<arrow_array::GenericListArray<i32>>`
| |
| required by a bound introduced by this call
|
= help: the trait `arrow_array::Array` is implemented for
`std::sync::Arc<(dyn arrow_array::Array + 'static)>`
= note: required for
`arrow_array::Scalar<std::sync::Arc<arrow_array::GenericListArray<i32>>>` to
implement `Debug`
note: required by a bound in `core::fmt::rt::Argument::<'a>::new_debug`
-->
/Users/jayzhan/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/fmt/rt.rs:100:29
|
100 | pub fn new_debug<'b, T: Debug>(x: &'b T) -> Argument<'_> {
| ^^^^^ required by this bound in
`Argument::<'a>::new_debug`
= note: this error originates in the macro `$crate::format_args_nl`
which comes from the expansion of the macro `println` (in Nightly builds, run
with -Z macro-backtrace for more info)
```
This is what the code is like which we can also find in Scalar Example, but
turns out not working
```
let arr = Arc::new(ListArray::from_iter_primitive::<Int32Type, _,
_>(vec![
Some(vec![Some(1), None, Some(2)]),
]));
let s = Scalar::new(arr);
```
I'm working on https://github.com/apache/arrow-datafusion/issues/8846, and
trying to find whether `Scalar<Arc<ListArray>>` or `Arc<Scalar<ListArray>>` is
better.
however, the previous one meets the error described above, the second one we
can only get `&dyn Array` from `fn get()`, which doesn't seem like a good way
either.
**Describe alternatives you've considered**
<!--
A clear and concise description of any alternative solutions or features
you've considered.
-->
Remove the example that is built with ArrayRef.
**Additional context**
<!--
Add any other context or screenshots about the feature request here.
-->
--
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]