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 2022/03/27 12:13:46 UTC
[GitHub] [arrow-rs] yjshen commented on a change in pull request #1487: Support sort for decimal data type
yjshen commented on a change in pull request #1487:
URL: https://github.com/apache/arrow-rs/pull/1487#discussion_r835898239
##########
File path: arrow/src/array/ord.rs
##########
@@ -225,6 +225,11 @@ pub fn build_compare(left: &dyn Array, right: &dyn Array) -> Result<DynComparato
}
}
}
+ (Decimal(_, _), Decimal(_, _)) => {
+ let left: DecimalArray = DecimalArray::from(left.data().clone());
+ let right: DecimalArray = DecimalArray::from(right.data().clone());
+ Box::new(move |i, j| left.value(i).cmp(&right.value(j)))
Review comment:
I think it's validated in the beginning of this function
```rust
pub fn build_compare(left: &dyn Array, right: &dyn Array) -> Result<DynComparator> {
use DataType::*;
use IntervalUnit::*;
use TimeUnit::*;
Ok(match (left.data_type(), right.data_type()) {
(a, b) if a != b => {
return Err(ArrowError::InvalidArgumentError(
"Can't compare arrays of different types".to_string(),
));
}
```
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org