Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed Jan 11, 2024
1 parent c6b6457 commit 886666b
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions datafusion/physical-plan/src/aggregates/group_values/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@
// specific language governing permissions and limitations
// under the License.

use std::sync::Arc;
use crate::aggregates::group_values::GroupValues;
use ahash::RandomState;
use arrow_array::{Array, ArrayRef, RecordBatch, StringArray};
use arrow_buffer::{BooleanBufferBuilder, BufferBuilder, NullBuffer, OffsetBuffer, ScalarBuffer};
use arrow_buffer::{
BooleanBufferBuilder, BufferBuilder, NullBuffer, OffsetBuffer, ScalarBuffer,
};
use arrow_schema::DataType;
use datafusion_common::cast::as_string_array;
use datafusion_common::hash_utils::create_hashes;
use datafusion_execution::memory_pool::proxy::{RawTableAllocExt, VecAllocExt};
use datafusion_physical_expr::EmitTo;
use hashbrown::raw::RawTable;
use std::sync::Arc;

/// A [`GroupValues`] storing single column of Utf8/LargeUtf8/Binary/LargeBinary values
///
Expand Down Expand Up @@ -198,7 +200,7 @@ impl GroupValues for GroupValuesBinary {

fn emit(&mut self, emit_to: EmitTo) -> datafusion_common::Result<Vec<ArrayRef>> {
match emit_to {
EmitTo::All => {},
EmitTo::All => {}
EmitTo::First(n) => todo!(),
};

Expand All @@ -215,7 +217,7 @@ impl GroupValues for GroupValuesBinary {
self.map.drain().for_each(|group_entry| {
// since we created each group sequentially,
// we know the offsets will be sequential as well
offsets[group_entry.group_idx+1] = group_entry.len as i32
offsets[group_entry.group_idx + 1] = group_entry.len as i32
});
// transform lengths to offsets. For example lengths of `[1, 2, 3]` becomes
// offsets of `[0, 1, 3, 6]`
Expand All @@ -239,11 +241,7 @@ impl GroupValues for GroupValuesBinary {
// TODO update memory accounting memory

let offsets = ScalarBuffer::from(offsets);
let string_array = StringArray::new(
OffsetBuffer::new(offsets),
values,
nulls,
);
let string_array = StringArray::new(OffsetBuffer::new(offsets), values, nulls);

Ok(vec![Arc::new(string_array)])
}
Expand Down

0 comments on commit 886666b

Please sign in to comment.