You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/02/02 11:32:06 UTC
[GitHub] [arrow] alamb commented on pull request #9338: ARROW-11401: [Rust][DataFusion] Pass slices instead of Vec in DataFrame API
alamb commented on pull request #9338:
URL: https://github.com/apache/arrow/pull/9338#issuecomment-771572317
@Dandandan I think that idea looks good. What do you think about the following slightly more general (but possibly less efficient) version that takes an `impl IntoIterator` instead:
```
pub fn sort(&self, expr: impl IntoIterator<Item=Expr>) -> Result<Self> {
Ok(Self::from(&LogicalPlan::Sort {
expr: expr.into_iter().collect(),
input: Arc::new(self.plan.clone()),
}))
}
```
I am not sure how much extra work, if any, that would require for `Vec<Expr>` but it would allow creating plans with things like values in a map:
```
let my_map: BTreeMap<&str, Expr> = ....;
builder = builder.sort(my_map.values())
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org