Skip to content

Commit

Permalink
fix compile in rust 1.79.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rachelint committed Oct 30, 2024
1 parent 15aaab1 commit a0aa7b7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions datafusion/common/src/utils/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ pub fn estimate_memory_size<T>(num_elements: usize, fixed_size: usize) -> Result

#[cfg(test)]
mod tests {
use std::{collections::HashSet, mem};
use std::{collections::HashSet, mem::size_of};

use super::estimate_memory_size;

#[test]
fn test_estimate_memory() {
// size (bytes): 48
let fixed_size = mem::size_of::<HashSet<u32>>();
let fixed_size = size_of::<HashSet<u32>>();

// estimated buckets: 16 = (8 * 8 / 7).next_power_of_two()
let num_elements = 8;
Expand All @@ -127,7 +127,7 @@ mod tests {
#[test]
fn test_estimate_memory_overflow() {
let num_elements = usize::MAX;
let fixed_size = mem::size_of::<HashSet<u32>>();
let fixed_size = size_of::<HashSet<u32>>();
let estimated = estimate_memory_size::<u32>(num_elements, fixed_size);

assert!(estimated.is_err());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
//! user defined aggregate functions
use std::hash::{DefaultHasher, Hash, Hasher};
use std::mem::{size_of, size_of_val};
use std::sync::{
atomic::{AtomicBool, Ordering},
Arc,
Expand Down
1 change: 1 addition & 0 deletions datafusion/proto/tests/cases/roundtrip_logical_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use prost::Message;
use std::any::Any;
use std::collections::HashMap;
use std::fmt::{self, Debug, Formatter};
use std::mem::size_of_val;
use std::sync::Arc;
use std::vec;

Expand Down
1 change: 1 addition & 0 deletions datafusion/substrait/tests/cases/roundtrip_logical_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use datafusion_substrait::logical_plan::{
consumer::from_substrait_plan, producer::to_substrait_plan,
};
use std::cmp::Ordering;
use std::mem::size_of_val;

use datafusion::arrow::datatypes::{DataType, Field, IntervalUnit, Schema, TimeUnit};
use datafusion::common::{not_impl_err, plan_err, DFSchema, DFSchemaRef};
Expand Down

0 comments on commit a0aa7b7

Please sign in to comment.