Skip to content

Commit 4d3cbde

Browse files
committed
fmt
1 parent 882aa4d commit 4d3cbde

File tree

4 files changed

+363
-317
lines changed

4 files changed

+363
-317
lines changed

parquet-variant-compute/src/variant_array.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ impl VariantArray {
150150
// This would be a lot simpler if ShreddingState were just a pair of Option... we already
151151
// have everything we need.
152152
let inner = builder.build();
153-
let shredding_state = ShreddingState::try_new(metadata.clone(), value, typed_value).unwrap(); // valid by construction
153+
let shredding_state =
154+
ShreddingState::try_new(metadata.clone(), value, typed_value).unwrap(); // valid by construction
154155
Self {
155156
inner,
156157
metadata,
@@ -207,7 +208,9 @@ impl VariantArray {
207208
typed_value_to_variant(typed_value, index)
208209
}
209210
}
210-
ShreddingState::PartiallyShredded { value, typed_value, .. } => {
211+
ShreddingState::PartiallyShredded {
212+
value, typed_value, ..
213+
} => {
211214
// PartiallyShredded case (formerly ImperfectlyShredded)
212215
if typed_value.is_null(index) {
213216
Variant::new(self.metadata.value(index), value.value(index))
@@ -313,9 +316,11 @@ impl ShreddedVariantFieldArray {
313316
};
314317

315318
// Extract value and typed_value fields (metadata is not expected in ShreddedVariantFieldArray)
316-
let value = inner_struct.column_by_name("value").and_then(|col| col.as_binary_view_opt().cloned());
319+
let value = inner_struct
320+
.column_by_name("value")
321+
.and_then(|col| col.as_binary_view_opt().cloned());
317322
let typed_value = inner_struct.column_by_name("typed_value").cloned();
318-
323+
319324
// Use a dummy metadata for the constructor (ShreddedVariantFieldArray doesn't have metadata)
320325
let dummy_metadata = arrow::array::BinaryViewArray::new_null(inner_struct.len());
321326

@@ -387,8 +392,8 @@ impl Array for ShreddedVariantFieldArray {
387392
}
388393

389394
fn nulls(&self) -> Option<&NullBuffer> {
390-
// According to the shredding spec, ShreddedVariantFieldArray should be
391-
// physically non-nullable - SQL NULL is inferred by both value and
395+
// According to the shredding spec, ShreddedVariantFieldArray should be
396+
// physically non-nullable - SQL NULL is inferred by both value and
392397
// typed_value being physically NULL
393398
None
394399
}
@@ -423,13 +428,13 @@ impl Array for ShreddedVariantFieldArray {
423428
#[derive(Debug)]
424429
pub enum ShreddingState {
425430
/// This variant has no typed_value field
426-
Unshredded {
431+
Unshredded {
427432
metadata: BinaryViewArray,
428433
value: BinaryViewArray,
429434
},
430435
/// This variant has a typed_value field and no value field
431436
/// meaning it is the shredded type
432-
Typed {
437+
Typed {
433438
metadata: BinaryViewArray,
434439
typed_value: ArrayRef,
435440
},
@@ -454,9 +459,7 @@ pub enum ShreddingState {
454459
/// Note: By strict spec interpretation, this should only be valid for shredded object fields,
455460
/// not top-level variants. However, we allow it and treat as Variant::Null for pragmatic
456461
/// handling of missing data.
457-
AllNull {
458-
metadata: BinaryViewArray,
459-
},
462+
AllNull { metadata: BinaryViewArray },
460463
}
461464

462465
impl ShreddingState {

0 commit comments

Comments
 (0)