Calculates `total_byte_size` based on the schema and `num_rows`. If any of the columns has non-primitive width, `total_byte_size` is set to inexact.
(&mut self, schema: &Schema)
| 419 | /// Calculates `total_byte_size` based on the schema and `num_rows`. |
| 420 | /// If any of the columns has non-primitive width, `total_byte_size` is set to inexact. |
| 421 | pub fn calculate_total_byte_size(&mut self, schema: &Schema) { |
| 422 | let mut row_size = Some(0); |
| 423 | for field in schema.fields() { |
| 424 | match field.data_type().primitive_width() { |
| 425 | Some(width) => { |
| 426 | row_size = row_size.map(|s| s + width); |
| 427 | } |
| 428 | None => { |
| 429 | row_size = None; |
| 430 | break; |
| 431 | } |
| 432 | } |
| 433 | } |
| 434 | match row_size { |
| 435 | None => { |
| 436 | self.total_byte_size = self.total_byte_size.to_inexact(); |
| 437 | } |
| 438 | Some(size) => { |
| 439 | self.total_byte_size = self.num_rows.multiply(&Precision::Exact(size)); |
| 440 | } |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | /// Returns an unbounded `ColumnStatistics` for each field in the schema. |
| 445 | pub fn unknown_column(schema: &Schema) -> Vec<ColumnStatistics> { |
no test coverage detected