Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support dyn_compare_scalar for Decimal256 #4083

Closed
izveigor opened this issue Apr 13, 2023 · 1 comment · Fixed by #4084
Closed

Support dyn_compare_scalar for Decimal256 #4083

izveigor opened this issue Apr 13, 2023 · 1 comment · Fixed by #4084
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog

Comments

@izveigor
Copy link
Contributor

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
Like Decimal128Array, I think Decimal256Array should be also compared with a scalar.

use arrow::array::{Decimal128Array, Decimal256Array};
use arrow::compute::kernels::comparison::eq_dyn_scalar;
use arrow::datatypes::i256;


fn main() {
    let decimal128_array = Decimal128Array::from(vec![1_i128, 2_i128, 3_i128]);
    let decimal256_array = Decimal256Array::from(vec![i256::from_i128(1), i256::from_i128(2), i256::from_i128(3)]);
    println!("{:#?}", eq_dyn_scalar(&decimal128_array, 2_i64)); // Ok
    println!("{:#?}", eq_dyn_scalar(&decimal256_array, 2_i64)); // Error
}

output:

Ok(
    BooleanArray
    [
      false,
      true,
      false,
    ],
)
Err(
    ComputeError(
        "Unsupported data type Decimal256(76, 10) for comparison eq_scalar with 2",
    ),
)

Should be:
output:

Ok(
    BooleanArray
    [
      false,
      true,
      false,
    ],
)
Ok(
    BooleanArray
    [
      false,
      true,
      false,
    ],
)

Describe the solution you'd like

Describe alternatives you've considered

Additional context

@izveigor izveigor added the enhancement Any new improvement worthy of a entry in the changelog label Apr 13, 2023
@tustvold
Copy link
Contributor

label_issue.py automatically added labels {'arrow'} from #4084

@tustvold tustvold added the arrow Changes to the arrow crate label Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants