Skip to content

Commit f6fd915

Browse files
committed
manual cleanups
1 parent 89b3c75 commit f6fd915

File tree

3 files changed

+20
-21
lines changed

3 files changed

+20
-21
lines changed

parquet-variant-compute/src/variant_array.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
2020
use arrow::array::{Array, ArrayData, ArrayRef, AsArray, BinaryViewArray, StructArray};
2121
use arrow::buffer::NullBuffer;
22-
use arrow::datatypes::{Int8Type, Int16Type, Int32Type, Int64Type, UInt8Type, UInt16Type, UInt32Type, UInt64Type, Float16Type, Float32Type, Float64Type};
22+
use arrow::datatypes::{
23+
Float16Type, Float32Type, Float64Type, Int16Type, Int32Type, Int64Type, Int8Type, UInt16Type,
24+
UInt32Type, UInt64Type, UInt8Type,
25+
};
2326
use arrow_schema::{ArrowError, DataType, Field, FieldRef, Fields};
2427
use parquet_variant::Variant;
2528
use std::any::Any;

parquet-variant-compute/src/variant_get/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ fn shredded_get_path(
136136
let shred_basic_variant =
137137
|target: VariantArray, path: VariantPath<'_>, as_field: Option<&Field>| {
138138
let as_type = as_field.map(|f| f.data_type());
139-
let mut builder = output::row_builder::make_shredding_row_builder(path, as_type, cast_options)?;
139+
let mut builder =
140+
output::row_builder::make_shredding_row_builder(path, as_type, cast_options)?;
140141
for i in 0..target.len() {
141142
if target.is_null(i) {
142143
builder.append_null()?;

parquet-variant-compute/src/variant_get/output/row_builder.rs

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ pub(crate) fn make_shredding_row_builder<'a>(
3434
) -> Result<Box<dyn VariantShreddingRowBuilder + 'a>> {
3535
use arrow::array::PrimitiveBuilder;
3636
use datatypes::{
37-
Int8Type, Int16Type, Int32Type, Int64Type,
38-
Float16Type, Float32Type, Float64Type,
37+
Float16Type, Float32Type, Float64Type, Int16Type, Int32Type, Int64Type, Int8Type,
3938
};
4039

4140
// support non-empty paths (field access) and some empty path cases
@@ -95,12 +94,10 @@ pub(crate) fn make_shredding_row_builder<'a>(
9594
let builder = VariantArrayShreddingRowBuilder::new(16);
9695
Ok(Box::new(builder))
9796
}
98-
_ => {
99-
Err(ArrowError::NotYetImplemented(format!(
100-
"variant_get with empty path and data_type={:?} not yet implemented",
101-
data_type
102-
)))
103-
}
97+
_ => Err(ArrowError::NotYetImplemented(format!(
98+
"variant_get with empty path and data_type={:?} not yet implemented",
99+
data_type
100+
))),
104101
};
105102
}
106103

@@ -170,12 +167,10 @@ pub(crate) fn make_shredding_row_builder<'a>(
170167
let inner_builder = VariantArrayShreddingRowBuilder::new(16);
171168
wrap_with_path!(inner_builder)
172169
}
173-
_ => {
174-
Err(ArrowError::NotYetImplemented(format!(
175-
"variant_get with path={:?} and data_type={:?} not yet implemented",
176-
path, data_type
177-
)))
178-
}
170+
_ => Err(ArrowError::NotYetImplemented(format!(
171+
"variant_get with path={:?} and data_type={:?} not yet implemented",
172+
path, data_type
173+
))),
179174
}
180175
}
181176

@@ -258,6 +253,11 @@ impl VariantAsPrimitive<datatypes::Int64Type> for Variant<'_, '_> {
258253
self.as_int64()
259254
}
260255
}
256+
impl VariantAsPrimitive<datatypes::Float16Type> for Variant<'_, '_> {
257+
fn as_primitive(&self) -> Option<half::f16> {
258+
self.as_f16()
259+
}
260+
}
261261
impl VariantAsPrimitive<datatypes::Float32Type> for Variant<'_, '_> {
262262
fn as_primitive(&self) -> Option<f32> {
263263
self.as_f32()
@@ -268,11 +268,6 @@ impl VariantAsPrimitive<datatypes::Float64Type> for Variant<'_, '_> {
268268
self.as_f64()
269269
}
270270
}
271-
impl VariantAsPrimitive<datatypes::Float16Type> for Variant<'_, '_> {
272-
fn as_primitive(&self) -> Option<half::f16> {
273-
self.as_f16()
274-
}
275-
}
276271

277272
/// Builder for shredding variant values to primitive values
278273
struct PrimitiveVariantShreddingRowBuilder<'a, T: ArrowPrimitiveType> {

0 commit comments

Comments
 (0)