Skip to content

Commit 0b75dfd

Browse files
committed
clippy
1 parent 14162e8 commit 0b75dfd

File tree

1 file changed

+14
-27
lines changed

1 file changed

+14
-27
lines changed

native/core/src/parquet/parquet_support.rs

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,20 @@ fn cast_array(
167167
to_type,
168168
parquet_options,
169169
)?),
170-
(List(_), List(_)) => {
171-
cast_list_to_list(array.as_list(), from_type, to_type, parquet_options)
170+
(List(_), List(to_inner_type)) => {
171+
let list_arr: &ListArray = array.as_list();
172+
let cast_field = cast_array(
173+
Arc::clone(list_arr.values()),
174+
to_inner_type.data_type(),
175+
parquet_options,
176+
)?;
177+
178+
Ok(Arc::new(ListArray::new(
179+
Arc::clone(to_inner_type),
180+
list_arr.offsets().clone(),
181+
cast_field,
182+
list_arr.nulls().cloned(),
183+
)))
172184
}
173185
(Timestamp(TimeUnit::Microsecond, None), Timestamp(TimeUnit::Microsecond, Some(tz))) => {
174186
Ok(Arc::new(
@@ -186,31 +198,6 @@ fn cast_array(
186198
}
187199
}
188200

189-
fn cast_list_to_list(
190-
array: &ListArray,
191-
from_type: &DataType,
192-
to_type: &DataType,
193-
parquet_options: &SparkParquetOptions,
194-
) -> DataFusionResult<ArrayRef> {
195-
match (from_type, to_type) {
196-
(DataType::List(_), DataType::List(to_inner_type)) => {
197-
let cast_field = cast_array(
198-
Arc::clone(array.values()),
199-
to_inner_type.data_type(),
200-
parquet_options,
201-
)?;
202-
203-
Ok(Arc::new(ListArray::new(
204-
Arc::clone(to_inner_type),
205-
array.offsets().clone(),
206-
cast_field,
207-
array.nulls().cloned(),
208-
)))
209-
}
210-
_ => unreachable!(),
211-
}
212-
}
213-
214201
/// Cast between struct types based on logic in
215202
/// `org.apache.spark.sql.catalyst.expressions.Cast#castStruct`.
216203
fn cast_struct_to_struct(

0 commit comments

Comments
 (0)