Skip to content

Commit c2a1fca

Browse files
committed
majic format
1 parent d2df3d9 commit c2a1fca

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

parquet/src/arrow/schema/complex.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
use std::collections::HashMap;
1919
use std::sync::Arc;
2020

21+
use crate::arrow::schema::extension::add_extension_type;
2122
use crate::arrow::schema::primitive::convert_primitive;
2223
use crate::arrow::{ProjectionMask, PARQUET_FIELD_ID_META_KEY};
2324
use crate::basic::{ConvertedType, Repetition};
2425
use crate::errors::ParquetError;
2526
use crate::errors::Result;
2627
use crate::schema::types::{SchemaDescriptor, Type, TypePtr};
2728
use arrow_schema::{DataType, Field, Fields, SchemaBuilder};
28-
use crate::arrow::schema::extension::{add_extension_type};
2929

3030
fn get_repetition(t: &Type) -> Repetition {
3131
let info = t.get_basic_info();
@@ -545,7 +545,11 @@ impl Visitor {
545545
///
546546
/// The resulting Arrow [`Field`] will have the type dictated by the Parquet `field`, a name
547547
/// dictated by the `parquet_type`, and any metadata from `arrow_hint`
548-
fn convert_field(parquet_type: &Type, field: &mut ParquetField, arrow_hint: Option<&Field>) -> Field {
548+
fn convert_field(
549+
parquet_type: &Type,
550+
field: &mut ParquetField,
551+
arrow_hint: Option<&Field>,
552+
) -> Field {
549553
let name = parquet_type.name();
550554
let data_type = field.arrow_type.clone();
551555
let nullable = field.nullable;

parquet/src/arrow/schema/extension.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
//! Extension types are represented using the metadata from Arrow [`Field`]s
2424
//! with the key "ARROW:extension:name".
2525
26-
use arrow_schema::{Field};
27-
use arrow_schema::extension::ExtensionType;
2826
use crate::basic::LogicalType;
2927
use crate::schema::types::Type;
28+
use arrow_schema::extension::ExtensionType;
29+
use arrow_schema::Field;
3030

3131
/// Adds extension type metadata, if necessary, based on the Parquet field's
3232
/// [`LogicalType`]
@@ -38,11 +38,10 @@ pub(crate) fn add_extension_type(arrow_field: Field, parquet_type: &Type) -> Fie
3838
let result = match parquet_type.get_basic_info().logical_type() {
3939
#[cfg(feature = "variant_experimental")]
4040
Some(LogicalType::Variant) => {
41-
arrow_field
42-
.with_extension_type(parquet_variant_compute::VariantType)
41+
arrow_field.with_extension_type(parquet_variant_compute::VariantType)
4342
}
4443
// TODO add other LogicalTypes here
45-
_ => arrow_field
44+
_ => arrow_field,
4645
};
4746
result
4847
}
@@ -52,12 +51,12 @@ pub(crate) fn add_extension_type(arrow_field: Field, parquet_type: &Type) -> Fie
5251
pub(crate) fn logical_type_for_struct(field: &Field) -> Option<LogicalType> {
5352
use parquet_variant_compute::VariantType;
5453
if field.extension_type_name()? == VariantType::NAME {
55-
return Some(LogicalType::Variant)
54+
return Some(LogicalType::Variant);
5655
};
5756
None
5857
}
5958

6059
#[cfg(not(feature = "variant_experimental"))]
6160
pub(crate) fn logical_type_for_struct(field: &Field) -> Option<LogicalType> {
6261
None
63-
}
62+
}

parquet/src/arrow/schema/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ use crate::file::{metadata::KeyValue, properties::WriterProperties};
3535
use crate::schema::types::{ColumnDescriptor, SchemaDescriptor, Type};
3636

3737
mod complex;
38-
mod primitive;
3938
mod extension;
39+
mod primitive;
4040

41+
use super::PARQUET_FIELD_ID_META_KEY;
42+
use crate::arrow::schema::extension::logical_type_for_struct;
4143
use crate::arrow::ProjectionMask;
4244
pub(crate) use complex::{ParquetField, ParquetFieldType};
43-
use crate::arrow::schema::extension::logical_type_for_struct;
44-
use super::PARQUET_FIELD_ID_META_KEY;
4545

4646
/// Convert Parquet schema to Arrow schema including optional metadata
4747
///

0 commit comments

Comments
 (0)