saikrishna1-bidgely commented on PR #4908:
URL:
https://github.com/apache/arrow-datafusion/pull/4908#issuecomment-1396064487
> This looks like a nice improvement @saikrishna1-bidgely
>
> I think we should add a test for this new functionality so that we don't
accidentally break the new APIs going forward.
>
> Also I was wondering about the signature
>
> Rather than a slice, what would you think about taking something that
could be turned into an iter:
>
> So instead of
>
> ```rust
> pub async fn read_parquet_with_multi_paths(
> &self,
> table_paths: &[impl AsRef<str>],
> options: ParquetReadOptions<'_>,
> ) -> Result<DataFrame> {
> ```
>
> Something more like
>
> ```rust
> pub async fn read_parquet_with_multi_paths(
> &self,
> table_paths: impl IntoIterator<Item = &str>],
> options: ParquetReadOptions<'_>,
> ) -> Result<DataFrame> {
> ```
>
> I also think it would be ideal to figure out some way to have the same API
take both a single path and an iterator -- do you think the above would work?
I agree, something like `IntoIterator` works better than a simple slice.
Regarding if we can take both str and iter of str in the same method, I
don't think it is simple since rust doesn't have function overloading or
variadic arguments. We can look into following:
1. Enums for arguments and then do pattern matching. I'm trying to implement
this.
2. Union type for arguments. This might not be possible, see
[link](https://stackoverflow.com/questions/64690981/can-trait-objects-of-type-intoiterator-be-boxed-and-held-inside-of-a-structure).
3. Create a custom trait and then implement it for str and for a slice/vec.
See
[Link](https://users.rust-lang.org/t/make-a-function-accept-either-str-or-str-as-an-argument/79139/9).
What do you think about having a single method which only takes a list of
paths? For a single path, the callee can create a Vec.
--
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]