Skip to content

Commit 7ec0cb8

Browse files
committed
Remove dependency on nightly compiler in DataFusion
To unbreak CI builds.
1 parent 8091cc1 commit 7ec0cb8

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

rust/arrow/src/compute/kernels/sort.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ where
111111
// implements comparison using IEEE 754 total ordering for f32
112112
// Original implementation from https://doc.rust-lang.org/std/primitive.f64.html#method.total_cmp
113113
// TODO to change to use std when it becomes stable
114-
pub(crate) fn total_cmp_32(l: f32, r: f32) -> std::cmp::Ordering {
114+
pub fn total_cmp_32(l: f32, r: f32) -> std::cmp::Ordering {
115115
let mut left = l.to_bits() as i32;
116116
let mut right = r.to_bits() as i32;
117117

@@ -124,7 +124,7 @@ pub(crate) fn total_cmp_32(l: f32, r: f32) -> std::cmp::Ordering {
124124
// implements comparison using IEEE 754 total ordering for f64
125125
// Original implementation from https://doc.rust-lang.org/std/primitive.f64.html#method.total_cmp
126126
// TODO to change to use std when it becomes stable
127-
pub(crate) fn total_cmp_64(l: f64, r: f64) -> std::cmp::Ordering {
127+
pub fn total_cmp_64(l: f64, r: f64) -> std::cmp::Ordering {
128128
let mut left = l.to_bits() as i64;
129129
let mut right = r.to_bits() as i64;
130130

rust/datafusion/src/cube_ext/util.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
use crate::scalar::ScalarValue;
1919
use arrow::array::ArrayRef;
20+
use arrow::compute::{total_cmp_32, total_cmp_64};
2021
use std::cmp::Ordering;
2122

2223
/// Generic code to help implement generic operations on arrays.
@@ -195,8 +196,12 @@ pub fn cmp_same_types(
195196

196197
let o = match (l, r) {
197198
(ScalarValue::Boolean(Some(l)), ScalarValue::Boolean(Some(r))) => l.cmp(r),
198-
(ScalarValue::Float32(Some(l)), ScalarValue::Float32(Some(r))) => l.total_cmp(r),
199-
(ScalarValue::Float64(Some(l)), ScalarValue::Float64(Some(r))) => l.total_cmp(r),
199+
(ScalarValue::Float32(Some(l)), ScalarValue::Float32(Some(r))) => {
200+
total_cmp_32(*l, *r)
201+
}
202+
(ScalarValue::Float64(Some(l)), ScalarValue::Float64(Some(r))) => {
203+
total_cmp_64(*l, *r)
204+
}
200205
(ScalarValue::Int8(Some(l)), ScalarValue::Int8(Some(r))) => l.cmp(r),
201206
(ScalarValue::Int16(Some(l)), ScalarValue::Int16(Some(r))) => l.cmp(r),
202207
(ScalarValue::Int32(Some(l)), ScalarValue::Int32(Some(r))) => l.cmp(r),
@@ -283,12 +288,12 @@ pub fn cmp_array_row_same_types(
283288
($l: expr, Float32Array, $($rest: tt)*) => {{
284289
let l = $l.as_any().downcast_ref::<Float32Array>().unwrap();
285290
let r = r.as_any().downcast_ref::<Float32Array>().unwrap();
286-
return l.value(l_row).total_cmp(&r.value(r_row));
291+
return arrow::compute::total_cmp_32(l.value(l_row), r.value(r_row));
287292
}};
288293
($l: expr, Float64Array, $($rest: tt)*) => {{
289294
let l = $l.as_any().downcast_ref::<Float64Array>().unwrap();
290295
let r = r.as_any().downcast_ref::<Float64Array>().unwrap();
291-
return l.value(l_row).total_cmp(&r.value(r_row));
296+
return arrow::compute::total_cmp_64(l.value(l_row), r.value(r_row));
292297
}};
293298
($l: expr, $arr: ty, $($rest: tt)*) => {{
294299
let l = $l.as_any().downcast_ref::<$arr>().unwrap();

rust/datafusion/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(total_cmp)]
21
// Licensed to the Apache Software Foundation (ASF) under one
32
// or more contributor license agreements. See the NOTICE file
43
// distributed with this work for additional information

0 commit comments

Comments
 (0)