Skip to content

Commit cb09c94

Browse files
committed
Fix cargo doc test
1 parent 7d158c9 commit cb09c94

File tree

11 files changed

+22
-19
lines changed

11 files changed

+22
-19
lines changed

datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ impl<T: ArrowPrimitiveType + Debug> Accumulator for FloatDistinctCountAccumulato
162162
Ok(ScalarValue::Int64(Some(self.values.values.len() as i64)))
163163
}
164164

165-
fn size(&self, pool: Option<&dyn MemoryPool>) -> usize {
166-
size_of_val(self) + self.values.size(pool)
165+
fn size(&self, _pool: Option<&dyn MemoryPool>) -> usize {
166+
size_of_val(self) + self.values.size()
167167
}
168168
}

datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/accumulate.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use arrow::array::{Array, BooleanArray, BooleanBufferBuilder, PrimitiveArray};
2323
use arrow::buffer::{BooleanBuffer, NullBuffer};
2424
use arrow::datatypes::ArrowPrimitiveType;
2525

26-
use arrow_buffer::MemoryPool;
2726
use datafusion_expr_common::groups_accumulator::EmitTo;
2827
/// Track the accumulator null state per row: if any values for that
2928
/// group were null and if any values have been seen at all for that group.
@@ -76,7 +75,7 @@ impl NullState {
7675
}
7776

7877
/// return the size of all buffers allocated by this null state, not including self
79-
pub fn size(&self, _pool: Option<&dyn MemoryPool>) -> usize {
78+
pub fn size(&self) -> usize {
8079
// capacity is in bits, so convert to bytes
8180
self.seen_values.capacity() / 8
8281
}

datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/bool_op.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ where
140140
self.update_batch(values, group_indices, opt_filter, total_num_groups)
141141
}
142142

143-
fn size(&self, pool: Option<&dyn MemoryPool>) -> usize {
143+
fn size(&self, _pool: Option<&dyn MemoryPool>) -> usize {
144144
// capacity is in bits, so convert to bytes
145-
self.values.capacity() / 8 + self.null_state.size(pool)
145+
self.values.capacity() / 8 + self.null_state.size()
146146
}
147147

148148
fn convert_to_state(

datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/prim_op.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ where
195195
true
196196
}
197197

198-
fn size(&self, pool: Option<&dyn MemoryPool>) -> usize {
199-
self.values.capacity() * size_of::<T::Native>() + self.null_state.size(pool)
198+
fn size(&self, _pool: Option<&dyn MemoryPool>) -> usize {
199+
self.values.capacity() * size_of::<T::Native>() + self.null_state.size()
200200
}
201201
}

datafusion/functions-aggregate-common/src/aggregate/sum_distinct/numeric.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl<T: ArrowPrimitiveType + Debug> Accumulator for DistinctSumAccumulator<T> {
7878
}
7979
}
8080

81-
fn size(&self, pool: Option<&dyn MemoryPool>) -> usize {
82-
size_of_val(self) + self.values.size(pool)
81+
fn size(&self, _pool: Option<&dyn MemoryPool>) -> usize {
82+
size_of_val(self) + self.values.size()
8383
}
8484
}

datafusion/functions-aggregate-common/src/utils.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use arrow::compute::SortOptions;
2323
use arrow::datatypes::{
2424
ArrowNativeType, DataType, DecimalType, Field, FieldRef, ToByteSlice,
2525
};
26-
use arrow_buffer::MemoryPool;
2726
use datafusion_common::cast::{as_list_array, as_primitive_array};
2827
use datafusion_common::utils::SingleRowListArrayBuilder;
2928
use datafusion_common::utils::memory::estimate_memory_size;
@@ -259,7 +258,7 @@ impl<T: ArrowPrimitiveType> GenericDistinctBuffer<T> {
259258
}
260259

261260
/// Mirrors [`Accumulator::size`].
262-
pub fn size(&self, _pool: Option<&dyn MemoryPool>) -> usize {
261+
pub fn size(&self) -> usize {
263262
let num_elements = self.values.len();
264263
let fixed_size = size_of_val(self) + size_of_val(&self.values);
265264
estimate_memory_size::<T::Native>(num_elements, fixed_size).unwrap()

datafusion/functions-aggregate/src/array_agg.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,7 @@ impl Accumulator for OrderSensitiveArrayAggAccumulator {
801801
}
802802
}
803803

804+
// Add size of the `self.ordering_values`
804805
total += size_of::<Vec<ScalarValue>>() * self.ordering_values.capacity();
805806
for row in &self.ordering_values {
806807
total += size_of_val(row) + (size_of::<ScalarValue>() * row.capacity());
@@ -819,12 +820,15 @@ impl Accumulator for OrderSensitiveArrayAggAccumulator {
819820
}
820821
}
821822

823+
// Add size of the `self.datatypes`
822824
total += size_of::<DataType>() * self.datatypes.capacity();
823825
for dtype in &self.datatypes {
824826
total += dtype.size() - size_of_val(dtype);
825827
}
826828

829+
// Add size of the `self.ordering_req`
827830
total += size_of::<PhysicalSortExpr>() * self.ordering_req.capacity();
831+
// TODO: Calculate size of each `PhysicalSortExpr` more accurately.
828832
total
829833
}
830834
}

datafusion/functions-aggregate/src/median.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,8 +575,8 @@ impl<T: ArrowNumericType + Debug> Accumulator for DistinctMedianAccumulator<T> {
575575
ScalarValue::new_primitive::<T>(median, &self.data_type)
576576
}
577577

578-
fn size(&self, pool: Option<&dyn MemoryPool>) -> usize {
579-
size_of_val(self) + self.distinct_values.size(pool)
578+
fn size(&self, _pool: Option<&dyn MemoryPool>) -> usize {
579+
size_of_val(self) + self.distinct_values.size()
580580
}
581581
}
582582

datafusion/functions-aggregate/src/percentile_cont.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -777,8 +777,8 @@ impl<T: ArrowNumericType + Debug> Accumulator for DistinctPercentileContAccumula
777777
ScalarValue::new_primitive::<T>(value, &self.data_type)
778778
}
779779

780-
fn size(&self, pool: Option<&dyn MemoryPool>) -> usize {
781-
size_of_val(self) + self.distinct_values.size(pool)
780+
fn size(&self, _pool: Option<&dyn MemoryPool>) -> usize {
781+
size_of_val(self) + self.distinct_values.size()
782782
}
783783
}
784784

datafusion/functions-aggregate/src/utils.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use datafusion_expr::ColumnarValue;
2424
use datafusion_physical_expr_common::physical_expr::PhysicalExpr;
2525

2626
/// Recursively claims all buffers in an ArrayData and its children with the memory pool.
27+
/// TODO: remove once https://github.com/apache/arrow-rs/pull/8918 lands.
2728
pub(crate) fn claim_buffers_recursive(
2829
data: &arrow::array::ArrayData,
2930
pool: &dyn arrow_buffer::MemoryPool,

0 commit comments

Comments
 (0)