Skip to content

Commit 00df64a

Browse files
authored
Make scalar.rs compile (#2)
* wip * more * Make scalar.rs compile
1 parent b9f12d0 commit 00df64a

File tree

7 files changed

+94
-124
lines changed

7 files changed

+94
-124
lines changed

datafusion/src/datasource/parquet.rs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
//! Parquet data source
1919
20-
use std::any::{Any, type_name};
20+
use std::any::{type_name, Any};
2121
use std::fs::File;
2222
use std::sync::Arc;
2323

@@ -221,7 +221,8 @@ impl ParquetTableDescriptor {
221221
if let DataType::$DT = fields[i].data_type() {
222222
let stats = stats
223223
.as_any()
224-
.downcast_ref::<ParquetPrimitiveStatistics<$PRIMITIVE_TYPE>>().ok_or_else(|| {
224+
.downcast_ref::<ParquetPrimitiveStatistics<$PRIMITIVE_TYPE>>()
225+
.ok_or_else(|| {
225226
DataFusionError::Internal(format!(
226227
"Failed to cast stats to {} stats",
227228
type_name::<$PRIMITIVE_TYPE>()
@@ -254,9 +255,13 @@ impl ParquetTableDescriptor {
254255
match stats.physical_type() {
255256
PhysicalType::Boolean => {
256257
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+
)
260265
})?;
261266
if let Some(max_value) = &mut max_values[i] {
262267
if let Some(v) = stats.max_value {
@@ -296,9 +301,13 @@ impl ParquetTableDescriptor {
296301
}
297302
PhysicalType::ByteArray => {
298303
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+
)
302311
})?;
303312
if let Some(max_value) = &mut max_values[i] {
304313
if let Some(v) = stats.max_value {
@@ -395,7 +404,10 @@ impl TableDescriptorBuilder for ParquetTableDescriptor {
395404
};
396405

397406
Ok(FileAndSchema {
398-
file: PartitionedFile { path: path.to_owned(), statistics },
407+
file: PartitionedFile {
408+
path: path.to_owned(),
409+
statistics,
410+
},
399411
schema,
400412
})
401413
}

datafusion/src/execution/dataframe_impl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
2020
use std::sync::{Arc, Mutex};
2121

22-
use arrow::io::print;
23-
use arrow::record_batch::RecordBatch;
2422
use crate::error::Result;
2523
use crate::execution::context::{ExecutionContext, ExecutionContextState};
2624
use crate::logical_plan::{
@@ -31,6 +29,8 @@ use crate::{
3129
dataframe::*,
3230
physical_plan::{collect, collect_partitioned},
3331
};
32+
use arrow::io::print;
33+
use arrow::record_batch::RecordBatch;
3434

3535
use crate::physical_plan::{
3636
execute_stream, execute_stream_partitioned, ExecutionPlan, SendableRecordBatchStream,

datafusion/src/physical_plan/analyze.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ use arrow::{datatypes::SchemaRef, record_batch::RecordBatch};
2929
use futures::StreamExt;
3030

3131
use super::{stream::RecordBatchReceiverStream, Distribution, SendableRecordBatchStream};
32-
use async_trait::async_trait;
3332
use arrow::array::MutableUtf8Array;
33+
use async_trait::async_trait;
3434

3535
/// `EXPLAIN ANALYZE` execution plan operator. This operator runs its input,
3636
/// discards the results, and then prints out an annotated plan with metrics
@@ -182,10 +182,7 @@ impl ExecutionPlan for AnalyzeExec {
182182

183183
let maybe_batch = RecordBatch::try_new(
184184
captured_schema,
185-
vec![
186-
type_builder.into_arc(),
187-
plan_builder.into_arc(),
188-
],
185+
vec![type_builder.into_arc(), plan_builder.into_arc()],
189186
);
190187
// again ignore error
191188
tx.send(maybe_batch).await.ok();

datafusion/src/physical_plan/datetime_expressions.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ use crate::{
2626
use arrow::{
2727
array::*,
2828
compute::cast,
29-
datatypes::{
30-
DataType, TimeUnit,
31-
},
29+
datatypes::{DataType, TimeUnit},
3230
temporal_conversions::utf8_to_timestamp_ns_scalar,
3331
types::NativeType,
3432
};

datafusion/src/physical_plan/expressions/in_list.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,17 +175,15 @@ fn in_list_primitive<T: NativeType>(
175175
array: &PrimitiveArray<T>,
176176
values: &[T],
177177
) -> Result<BooleanArray> {
178-
compare_primitive_op_scalar!(array, values, |x, v| v
179-
.contains(&x))
178+
compare_primitive_op_scalar!(array, values, |x, v| v.contains(&x))
180179
}
181180

182181
// whether each value on the left (can be null) is contained in the non-null list
183182
fn not_in_list_primitive<T: NativeType>(
184183
array: &PrimitiveArray<T>,
185184
values: &[T],
186185
) -> Result<BooleanArray> {
187-
compare_primitive_op_scalar!(array, values, |x, v| !v
188-
.contains(&x))
186+
compare_primitive_op_scalar!(array, values, |x, v| !v.contains(&x))
189187
}
190188

191189
// whether each value on the left (can be null) is contained in the non-null list

datafusion/src/physical_plan/parquet.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub struct ParquetExec {
7070
pub schema: Arc<Schema>,
7171
/// Projection for which columns to load
7272
projection: Vec<usize>,
73-
/// Batch size
73+
/// Batch size
7474
batch_size: usize,
7575
/// Statistics for the data set (sum of statistics for all partitions)
7676
statistics: Statistics,

0 commit comments

Comments
 (0)