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

unary kernel doesn't respect offset #738

Closed
bjchambers opened this issue Sep 2, 2021 · 0 comments · Fixed by #739
Closed

unary kernel doesn't respect offset #738

bjchambers opened this issue Sep 2, 2021 · 0 comments · Fixed by #739
Labels

Comments

@bjchambers
Copy link
Contributor

Describe the bug

unary kernel doesn't respect the offset when determining the null buffer, which means that the results are incorrect when applied to a slice.

To Reproduce
Steps to reproduce the behavior:

 #[test]
    fn test_unary_f64_slice() {
        let input =
            Float64Array::from(vec![Some(5.1f64), None, Some(6.8), None, Some(7.2)]);
        let input_slice = input.slice(1, 4);
        let input_slice: &Float64Array = as_primitive_array(&input_slice);
        let result = unary(input_slice, |n| n.round());
        assert_eq!(
            result,
            Float64Array::from(vec![None, Some(7.0), None, Some(7.0)])
        )
    }

Expected behavior

The test should pass.

Actual behavior

The test fails:

thread 'compute::kernels::arity::tests::test_unary_f64_slice' panicked at 'assertion failed: `(left == right)`
  left: `PrimitiveArray<Float64>
[
  0.0,
  null,
  0.0,
  null,
]`,
 right: `PrimitiveArray<Float64>
[
  null,
  7.0,
  null,
  7.0,
]`', arrow/src/compute/kernels/arity.rs:88:9

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant