Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions datafusion/src/physical_plan/distinct_expressions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
//! Implementations for DISTINCT expressions, e.g. `COUNT(DISTINCT c)`

use std::any::Any;
use std::convert::TryFrom;
use std::fmt::Debug;
use std::hash::Hash;
use std::sync::Arc;
Expand All @@ -29,12 +28,11 @@ use ahash::RandomState;
use std::collections::HashSet;

use crate::error::{DataFusionError, Result};
use crate::physical_plan::group_scalar::GroupByScalar;
use crate::physical_plan::{Accumulator, AggregateExpr, PhysicalExpr};
use crate::scalar::ScalarValue;

#[derive(Debug, PartialEq, Eq, Hash, Clone)]
struct DistinctScalarValues(Vec<GroupByScalar>);
struct DistinctScalarValues(Vec<ScalarValue>);

fn format_state_name(name: &str, state_name: &str) -> String {
format!("{}[{}]", name, state_name)
Expand Down Expand Up @@ -137,12 +135,7 @@ impl Accumulator for DistinctCountAccumulator {
fn update(&mut self, values: &[ScalarValue]) -> Result<()> {
// If a row has a NULL, it is not included in the final count.
if !values.iter().any(|v| v.is_null()) {
self.values.insert(DistinctScalarValues(
values
.iter()
.map(GroupByScalar::try_from)
.collect::<Result<Vec<_>>>()?,
));
self.values.insert(DistinctScalarValues(values.to_vec()));
}

Ok(())
Expand Down Expand Up @@ -195,7 +188,7 @@ impl Accumulator for DistinctCountAccumulator {
self.values.iter().for_each(|distinct_values| {
distinct_values.0.iter().enumerate().for_each(
|(col_index, distinct_value)| {
cols_vec[col_index].push(ScalarValue::from(distinct_value));
cols_vec[col_index].push(distinct_value.clone());
},
)
});
Expand Down
217 changes: 0 additions & 217 deletions datafusion/src/physical_plan/group_scalar.rs

This file was deleted.

Loading