fix: Move ChunkColumnSummary to read_buffer, the only place it's used

pull/24376/head
Carol (Nichols || Goulding) 2022-05-06 14:40:58 -04:00
parent 44209faa8e
commit bf1d08333d
No known key found for this signature in database
GPG Key ID: E907EE5A736F87D4
4 changed files with 14 additions and 6 deletions

1
Cargo.lock generated
View File

@ -4522,7 +4522,6 @@ dependencies = [
"arrow_util",
"criterion",
"croaring",
"data_types",
"data_types2",
"datafusion 0.1.0",
"either",

View File

@ -14,7 +14,6 @@ edition = "2021"
arrow = { version = "13", features = ["prettyprint"] }
arrow_util = { path = "../arrow_util" }
croaring = "0.6"
data_types = { path = "../data_types" }
data_types2 = { path = "../data_types2" }
datafusion = { path = "../datafusion" }
either = "1.6.1"

View File

@ -5,7 +5,6 @@ use crate::{
table::{self, Table},
};
use arrow::{error::ArrowError, record_batch::RecordBatch};
use data_types::chunk_metadata::ChunkColumnSummary;
use data_types2::TableSummary;
use observability_deps::tracing::debug;
use schema::{builder::Error as SchemaError, selection::Selection, Schema};
@ -13,6 +12,7 @@ use snafu::{ResultExt, Snafu};
use std::{
collections::{BTreeMap, BTreeSet},
convert::TryFrom,
sync::Arc,
};
// The desired minimum row group size, used as the default for the `ChunkBuilder`.
@ -96,7 +96,7 @@ impl Chunk {
/// Return the estimated size for each column in the table.
/// Note there may be multiple entries for each column.
pub fn column_sizes(&self) -> Vec<ChunkColumnSummary> {
pub(crate) fn column_sizes(&self) -> Vec<ChunkColumnSummary> {
self.table.column_sizes()
}
@ -508,6 +508,16 @@ impl ChunkBuilder {
}
}
/// Represents metadata about the physical storage of a column in a chunk
#[derive(Debug, PartialEq, Eq, Clone)]
pub(crate) struct ChunkColumnSummary {
/// Column name
pub(crate) name: Arc<str>,
/// Estimated size, in bytes, consumed by this column.
pub(crate) memory_bytes: usize,
}
#[cfg(test)]
mod test {
use super::*;

View File

@ -1,4 +1,5 @@
use crate::{
chunk::ChunkColumnSummary,
column,
row_group::{self, ColumnName, Literal, Predicate, RowGroup},
schema::{AggregateType, ColumnType, LogicalDataType, ResultSchema},
@ -6,7 +7,6 @@ use crate::{
BinaryExpr,
};
use arrow::record_batch::RecordBatch;
use data_types::chunk_metadata::ChunkColumnSummary;
use data_types2::TableSummary;
use parking_lot::RwLock;
use schema::selection::Selection;
@ -147,7 +147,7 @@ impl Table {
}
/// The estimated size for each column in this table.
pub fn column_sizes(&self) -> Vec<ChunkColumnSummary> {
pub(crate) fn column_sizes(&self) -> Vec<ChunkColumnSummary> {
self.table_data
.read()
.data