Skip to content

Commit e3c300e

Browse files
authored
Use std::mem for size_of and size_of_val (#262)
Looks like it depends on the Rust version so it fails in DQE
1 parent c5bd7bc commit e3c300e

File tree

5 files changed

+9
-4
lines changed

5 files changed

+9
-4
lines changed

datafusion-examples/examples/advanced_udaf.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use arrow_schema::{Field, Schema};
1919
use datafusion::{arrow::datatypes::DataType, logical_expr::Volatility};
2020
use datafusion_physical_expr::NullState;
21+
use std::mem::{size_of, size_of_val};
2122
use std::{any::Any, sync::Arc};
2223

2324
use arrow::{
@@ -92,7 +93,7 @@ impl AggregateUDFImpl for GeoMeanUdaf {
9293
}
9394

9495
/// This is the description of the state. accumulator's state() must match the types here.
95-
fn state_fields(&self, args: StateFieldsArgs) -> Result<Vec<arrow_schema::Field>> {
96+
fn state_fields(&self, args: StateFieldsArgs) -> Result<Vec<Field>> {
9697
Ok(vec![
9798
Field::new("prod", args.return_type.clone(), true),
9899
Field::new("n", DataType::UInt32, true),
@@ -193,7 +194,7 @@ impl Accumulator for GeometricMean {
193194
}
194195

195196
fn size(&self) -> usize {
196-
std::mem::size_of_val(self)
197+
size_of_val(self)
197198
}
198199
}
199200

datafusion/physical-expr-common/src/aggregate/groups_accumulator/prim_op.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
use std::mem::size_of;
1819
use std::sync::Arc;
1920

2021
use arrow::array::{ArrayRef, AsArray, BooleanArray, PrimitiveArray};

datafusion/physical-expr/src/aggregate/array_agg.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ use datafusion_common::Result;
4444
use datafusion_common::{internal_err, ScalarValue};
4545
use datafusion_expr::{Accumulator, EmitTo, GroupsAccumulator};
4646
use std::any::Any;
47+
use std::mem::{size_of, size_of_val};
4748
use std::sync::Arc;
4849

4950
/// ARRAY_AGG aggregate expression

datafusion/physical-expr/src/aggregate/array_agg_distinct.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use std::any::Any;
2121
use std::collections::HashSet;
2222
use std::fmt::Debug;
23+
use std::mem::size_of_val;
2324
use std::sync::Arc;
2425

2526
use arrow::array::ArrayRef;

datafusion/physical-expr/src/aggregate/average.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use log::debug;
2222

2323
use std::any::Any;
2424
use std::fmt::Debug;
25+
use std::mem::{size_of, size_of_val};
2526
use std::sync::Arc;
2627

2728
use crate::aggregate::groups_accumulator::accumulate::NullState;
@@ -284,7 +285,7 @@ impl Accumulator for AvgAccumulator {
284285
}
285286

286287
fn size(&self) -> usize {
287-
std::mem::size_of_val(self)
288+
size_of_val(self)
288289
}
289290
}
290291

@@ -377,7 +378,7 @@ impl<T: DecimalType + ArrowNumericType> Accumulator for DecimalAvgAccumulator<T>
377378
}
378379

379380
fn size(&self) -> usize {
380-
std::mem::size_of_val(self)
381+
size_of_val(self)
381382
}
382383
}
383384

0 commit comments

Comments
 (0)