|
17 | 17 |
|
18 | 18 | //! Parquet data source |
19 | 19 |
|
20 | | -use std::any::{Any, type_name}; |
| 20 | +use std::any::{type_name, Any}; |
21 | 21 | use std::fs::File; |
22 | 22 | use std::sync::Arc; |
23 | 23 |
|
@@ -221,7 +221,8 @@ impl ParquetTableDescriptor { |
221 | 221 | if let DataType::$DT = fields[i].data_type() { |
222 | 222 | let stats = stats |
223 | 223 | .as_any() |
224 | | - .downcast_ref::<ParquetPrimitiveStatistics<$PRIMITIVE_TYPE>>().ok_or_else(|| { |
| 224 | + .downcast_ref::<ParquetPrimitiveStatistics<$PRIMITIVE_TYPE>>() |
| 225 | + .ok_or_else(|| { |
225 | 226 | DataFusionError::Internal(format!( |
226 | 227 | "Failed to cast stats to {} stats", |
227 | 228 | type_name::<$PRIMITIVE_TYPE>() |
@@ -254,9 +255,13 @@ impl ParquetTableDescriptor { |
254 | 255 | match stats.physical_type() { |
255 | 256 | PhysicalType::Boolean => { |
256 | 257 | if let DataType::Boolean = fields[i].data_type() { |
257 | | - let stats = |
258 | | - stats.as_any().downcast_ref::<ParquetBooleanStatistics>().ok_or_else(|| { |
259 | | - DataFusionError::Internal("Failed to cast stats to boolean stats".to_owned()) |
| 258 | + let stats = stats |
| 259 | + .as_any() |
| 260 | + .downcast_ref::<ParquetBooleanStatistics>() |
| 261 | + .ok_or_else(|| { |
| 262 | + DataFusionError::Internal( |
| 263 | + "Failed to cast stats to boolean stats".to_owned(), |
| 264 | + ) |
260 | 265 | })?; |
261 | 266 | if let Some(max_value) = &mut max_values[i] { |
262 | 267 | if let Some(v) = stats.max_value { |
@@ -296,9 +301,13 @@ impl ParquetTableDescriptor { |
296 | 301 | } |
297 | 302 | PhysicalType::ByteArray => { |
298 | 303 | if let DataType::Utf8 = fields[i].data_type() { |
299 | | - let stats = |
300 | | - stats.as_any().downcast_ref::<ParquetBinaryStatistics>().ok_or_else(|| { |
301 | | - DataFusionError::Internal("Failed to cast stats to binary stats".to_owned()) |
| 304 | + let stats = stats |
| 305 | + .as_any() |
| 306 | + .downcast_ref::<ParquetBinaryStatistics>() |
| 307 | + .ok_or_else(|| { |
| 308 | + DataFusionError::Internal( |
| 309 | + "Failed to cast stats to binary stats".to_owned(), |
| 310 | + ) |
302 | 311 | })?; |
303 | 312 | if let Some(max_value) = &mut max_values[i] { |
304 | 313 | if let Some(v) = stats.max_value { |
@@ -395,7 +404,10 @@ impl TableDescriptorBuilder for ParquetTableDescriptor { |
395 | 404 | }; |
396 | 405 |
|
397 | 406 | Ok(FileAndSchema { |
398 | | - file: PartitionedFile { path: path.to_owned(), statistics }, |
| 407 | + file: PartitionedFile { |
| 408 | + path: path.to_owned(), |
| 409 | + statistics, |
| 410 | + }, |
399 | 411 | schema, |
400 | 412 | }) |
401 | 413 | } |
|
0 commit comments