Skip to content

Commit

Permalink
Support SQL-compliant NaN behavior on eq_dyn, neq_dyn, lt_dyn, lt_eq_…
Browse files Browse the repository at this point in the history
…dyn, gt_dyn, gt_eq_dyn (#2570)

* Add sql-compliant feature for enabling sql-compliant kernel behavior

* Rename feature flag and add document
  • Loading branch information
viirya committed Aug 26, 2022
1 parent a685c5f commit 63afe25
Show file tree
Hide file tree
Showing 4 changed files with 495 additions and 76 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/arrow.yml
Expand Up @@ -54,6 +54,9 @@ jobs:
- name: Test --features=force_validate,prettyprint,ipc_compression,ffi
run: |
cargo test -p arrow --features=force_validate,prettyprint,ipc_compression,ffi
- name: Test --features=nan_ordering
run: |
cargo test -p arrow --features "nan_ordering"
- name: Run examples
run: |
# Test arrow examples
Expand Down
2 changes: 2 additions & 0 deletions arrow/Cargo.toml
Expand Up @@ -88,6 +88,8 @@ pyarrow = ["pyo3", "ffi"]
force_validate = []
# Enable ffi support
ffi = []
# Enable NaN-ordering behavior on comparison kernels
nan_ordering = []

[dev-dependencies]
rand = { version = "0.8", default-features = false, features = ["std", "std_rng"] }
Expand Down
2 changes: 1 addition & 1 deletion arrow/src/compute/kernels/aggregate.rs
Expand Up @@ -28,7 +28,7 @@ use crate::datatypes::{ArrowNativeType, ArrowNumericType, DataType};

/// Generic test for NaN, the optimizer should be able to remove this for integer types.
#[inline]
fn is_nan<T: ArrowNativeType + PartialOrd + Copy>(a: T) -> bool {
pub(crate) fn is_nan<T: ArrowNativeType + PartialOrd + Copy>(a: T) -> bool {
#[allow(clippy::eq_op)]
!(a == a)
}
Expand Down

0 comments on commit 63afe25

Please sign in to comment.