Skip to content

Commit

Permalink
fix quantiles
Browse files Browse the repository at this point in the history
  • Loading branch information
samster25 committed Oct 18, 2023
1 parent 9566ae6 commit 4bcded3
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/daft-micropartition/src/ops/take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@ impl MicroPartition {
let tables = self.concat_or_get()?;
if let [single] = tables.as_slice() {
let taken = single.sample(num)?;
let taken_len = taken.len();
Ok(Self::new(
self.schema.clone(),
TableState::Loaded(Arc::new(vec![taken])),
TableMetadata {
length: num.min(self.len()),
},
TableMetadata { length: taken_len },
self.statistics.clone(),
))
} else {
Expand All @@ -45,12 +44,11 @@ impl MicroPartition {
let tables = self.concat_or_get()?;
if let [single] = tables.as_slice() {
let taken = single.quantiles(num)?;
let taken_len = taken.len();
Ok(Self::new(
self.schema.clone(),
TableState::Loaded(Arc::new(vec![taken])),
TableMetadata {
length: (num - 1).max(0),
},
TableMetadata { length: taken_len },
self.statistics.clone(),
))
} else {
Expand Down

0 comments on commit 4bcded3

Please sign in to comment.