This is an automated email from the ASF dual-hosted git repository.
agrove pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-comet.git
The following commit(s) were added to refs/heads/main by this push:
new 42752518 Upgrade to Rust 1.78 (#546)
42752518 is described below
commit 42752518d79c51280a6583eaf9c11e2ca863ce8a
Author: Andy Grove <[email protected]>
AuthorDate: Fri Jun 14 14:29:46 2024 -0600
Upgrade to Rust 1.78 (#546)
---
core/src/execution/datafusion/spark_hash.rs | 13 +++++++++----
core/src/execution/sort.rs | 16 ++++++++++------
rust-toolchain | 2 +-
3 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/core/src/execution/datafusion/spark_hash.rs
b/core/src/execution/datafusion/spark_hash.rs
index a31752d4..92790bb4 100644
--- a/core/src/execution/datafusion/spark_hash.rs
+++ b/core/src/execution/datafusion/spark_hash.rs
@@ -85,11 +85,16 @@ pub(crate) fn spark_compatible_murmur3_hash<T:
AsRef<[u8]>>(data: T, seed: u32)
// safety:
// avoid boundary checking in performance critical codes.
// all operations are guaranteed to be safe
+ // data is &[u8] so we do not need to check for proper alignment
unsafe {
- let mut h1 = hash_bytes_by_int(
- std::slice::from_raw_parts(data.get_unchecked(0), len_aligned),
- seed,
- );
+ let mut h1 = if len_aligned > 0 {
+ hash_bytes_by_int(
+ std::slice::from_raw_parts(data.get_unchecked(0), len_aligned),
+ seed,
+ )
+ } else {
+ seed as i32
+ };
for i in len_aligned..len {
let half_word = *data.get_unchecked(i) as i8 as i32;
diff --git a/core/src/execution/sort.rs b/core/src/execution/sort.rs
index 57c9932f..eeeb11d5 100644
--- a/core/src/execution/sort.rs
+++ b/core/src/execution/sort.rs
@@ -159,12 +159,16 @@ where
pos += 1;
}
} else {
- unsafe {
- ptr::copy_nonoverlapping(
- bucket.as_ptr(),
- self.get_unchecked_mut(pos),
- bucket.len(),
- );
+ if !bucket.is_empty() {
+ unsafe {
+ // SAFETY the buckets are created with correct
alignment
+ // because they are defined as Vec<Vec<T>>
+ ptr::copy_nonoverlapping(
+ bucket.as_ptr(),
+ self.get_unchecked_mut(pos),
+ bucket.len(),
+ );
+ }
}
pos += bucket.len();
}
diff --git a/rust-toolchain b/rust-toolchain
index 369f9966..8e95c75d 100644
--- a/rust-toolchain
+++ b/rust-toolchain
@@ -1 +1 @@
-1.77.2
+1.78
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]