|
| 1 | +// Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +// or more contributor license agreements. See the NOTICE file |
| 3 | +// distributed with this work for additional information |
| 4 | +// regarding copyright ownership. The ASF licenses this file |
| 5 | +// to you under the Apache License, Version 2.0 (the |
| 6 | +// "License"); you may not use this file except in compliance |
| 7 | +// with the License. You may obtain a copy of the License at |
| 8 | +// |
| 9 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +// |
| 11 | +// Unless required by applicable law or agreed to in writing, |
| 12 | +// software distributed under the License is distributed on an |
| 13 | +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +// KIND, either express or implied. See the License for the |
| 15 | +// specific language governing permissions and limitations |
| 16 | +// under the License. |
| 17 | + |
| 18 | +use crate::aggregates::group_values::GroupValues; |
| 19 | +use ahash::RandomState; |
| 20 | +use arrow::array::types::{IntervalDayTime, IntervalMonthDayNano}; |
| 21 | +use arrow::array::{ |
| 22 | + cast::AsArray, ArrayRef, ArrowNativeTypeOp, ArrowPrimitiveType, NullBufferBuilder, |
| 23 | + PrimitiveArray, |
| 24 | +}; |
| 25 | +use arrow::datatypes::{i256, DataType}; |
| 26 | +use arrow::record_batch::RecordBatch; |
| 27 | +use datafusion_common::Result; |
| 28 | +use datafusion_execution::memory_pool::proxy::VecAllocExt; |
| 29 | +use datafusion_expr::EmitTo; |
| 30 | +use half::f16; |
| 31 | +use hashbrown::hash_table::HashTable; |
| 32 | +use std::mem::size_of; |
| 33 | +use std::sync::Arc; |
| 34 | + |
| 35 | +pub use large_primitive::GroupValuesLargePrimitive; |
1 | 36 | mod large_primitive; |
2 | 37 |
|
3 | 38 | /// A trait to allow hashing of floating point numbers |
@@ -41,43 +76,6 @@ macro_rules! hash_float { |
41 | 76 | } |
42 | 77 |
|
43 | 78 | hash_float!(f16, f32, f64); |
44 | | - |
45 | | -// Licensed to the Apache Software Foundation (ASF) under one |
46 | | -// or more contributor license agreements. See the NOTICE file |
47 | | -// distributed with this work for additional information |
48 | | -// regarding copyright ownership. The ASF licenses this file |
49 | | -// to you under the Apache License, Version 2.0 (the |
50 | | -// "License"); you may not use this file except in compliance |
51 | | -// with the License. You may obtain a copy of the License at |
52 | | -// |
53 | | -// http://www.apache.org/licenses/LICENSE-2.0 |
54 | | -// |
55 | | -// Unless required by applicable law or agreed to in writing, |
56 | | -// software distributed under the License is distributed on an |
57 | | -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
58 | | -// KIND, either express or implied. See the License for the |
59 | | -// specific language governing permissions and limitations |
60 | | -// under the License. |
61 | | - |
62 | | -use crate::aggregates::group_values::GroupValues; |
63 | | -use ahash::RandomState; |
64 | | -use arrow::array::types::{IntervalDayTime, IntervalMonthDayNano}; |
65 | | -use arrow::array::{ |
66 | | - cast::AsArray, ArrayRef, ArrowNativeTypeOp, ArrowPrimitiveType, NullBufferBuilder, |
67 | | - PrimitiveArray, |
68 | | -}; |
69 | | -use arrow::datatypes::{i256, DataType}; |
70 | | -use arrow::record_batch::RecordBatch; |
71 | | -use datafusion_common::Result; |
72 | | -use datafusion_execution::memory_pool::proxy::VecAllocExt; |
73 | | -use datafusion_expr::EmitTo; |
74 | | -use half::f16; |
75 | | -use hashbrown::hash_table::HashTable; |
76 | | -use std::mem::size_of; |
77 | | -use std::sync::Arc; |
78 | | - |
79 | | -pub use large_primitive::GroupValuesLargePrimitive; |
80 | | - |
81 | 79 | /// A [`GroupValues`] storing a single column of normal primitive values (bits <= 64) |
82 | 80 | /// |
83 | 81 | /// This specialization is significantly faster than using the more general |
@@ -155,7 +153,8 @@ where |
155 | 153 | } |
156 | 154 |
|
157 | 155 | fn size(&self) -> usize { |
158 | | - self.map.capacity() * size_of::<(usize, u64)>() + self.values.allocated_size() |
| 156 | + self.map.capacity() * size_of::<(usize, T::Native)>() |
| 157 | + + self.values.allocated_size() |
159 | 158 | } |
160 | 159 |
|
161 | 160 | fn is_empty(&self) -> bool { |
|
0 commit comments