Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
devinjdangelo committed Aug 18, 2023
1 parent 4466983 commit ba2bf0d
Show file tree
Hide file tree
Showing 23 changed files with 41 additions and 39 deletions.
2 changes: 1 addition & 1 deletion benchmarks/src/tpch/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use super::get_query_sql;
use crate::{BenchmarkRun, CommonOpt};
use arrow::record_batch::RecordBatch;
use arrow::util::pretty::{self, pretty_format_batches};
use datafusion_common::{DEFAULT_PARQUET_EXTENSION, DEFAULT_CSV_EXTENSION};
use datafusion::datasource::file_format::csv::CsvFormat;
use datafusion::datasource::file_format::parquet::ParquetFormat;
use datafusion::datasource::file_format::FileFormat;
Expand All @@ -29,6 +28,7 @@ use datafusion::datasource::listing::{
use datafusion::datasource::{MemTable, TableProvider};
use datafusion::physical_plan::display::DisplayableExecutionPlan;
use datafusion::physical_plan::{collect, displayable};
use datafusion_common::{DEFAULT_CSV_EXTENSION, DEFAULT_PARQUET_EXTENSION};
use log::info;

use std::path::PathBuf;
Expand Down
2 changes: 1 addition & 1 deletion datafusion-examples/examples/csv_opener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

use std::{sync::Arc, vec};

use datafusion_common::FileCompressionType;
use datafusion::{
assert_batches_eq,
datasource::{
Expand All @@ -29,6 +28,7 @@ use datafusion::{
physical_plan::metrics::ExecutionPlanMetricsSet,
test_util::aggr_test_schema,
};
use datafusion_common::FileCompressionType;
use futures::StreamExt;
use object_store::local::LocalFileSystem;

Expand Down
2 changes: 1 addition & 1 deletion datafusion-examples/examples/csv_sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
// specific language governing permissions and limitations
// under the License.

use datafusion_common::FileCompressionType;
use datafusion::error::Result;
use datafusion::prelude::*;
use datafusion_common::FileCompressionType;

/// This example demonstrates executing a simple query against an Arrow data source (CSV) and
/// fetching results
Expand Down
2 changes: 1 addition & 1 deletion datafusion-examples/examples/dataframe-to-s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
// specific language governing permissions and limitations
// under the License.

use datafusion_common::{FileType, GetExt};
use datafusion::datasource::file_format::parquet::ParquetFormat;
use datafusion::datasource::listing::ListingOptions;
use datafusion::error::Result;
use datafusion::prelude::*;
use datafusion_common::{FileType, GetExt};

use object_store::aws::AmazonS3Builder;
use std::env;
Expand Down
2 changes: 1 addition & 1 deletion datafusion-examples/examples/json_opener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use std::{sync::Arc, vec};

use arrow_schema::{DataType, Field, Schema};
use datafusion_common::FileCompressionType;
use datafusion::{
assert_batches_eq,
datasource::{
Expand All @@ -29,6 +28,7 @@ use datafusion::{
error::Result,
physical_plan::metrics::ExecutionPlanMetricsSet,
};
use datafusion_common::FileCompressionType;
use futures::StreamExt;
use object_store::ObjectStore;

Expand Down
2 changes: 1 addition & 1 deletion datafusion-examples/examples/parquet_sql_multiple_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
// specific language governing permissions and limitations
// under the License.

use datafusion_common::{FileType, GetExt};
use datafusion::datasource::file_format::parquet::ParquetFormat;
use datafusion::datasource::listing::ListingOptions;
use datafusion::error::Result;
use datafusion::prelude::*;
use datafusion_common::{FileType, GetExt};
use std::sync::Arc;

/// This example demonstrates executing a simple query against an Arrow data source (a directory
Expand Down
9 changes: 4 additions & 5 deletions datafusion/common/src/file_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ use async_compression::tokio::bufread::{
ZstdDecoder as AsyncZstdDecoer, ZstdEncoder as AsyncZstdEncoder,
};

use crate::parsers::CompressionTypeVariant;
#[cfg(feature = "compression")]
use async_compression::tokio::write::{BzEncoder, GzipEncoder, XzEncoder, ZstdEncoder};
use bytes::Bytes;
#[cfg(feature = "compression")]
use bzip2::read::MultiBzDecoder;
use crate::parsers::CompressionTypeVariant;
#[cfg(feature = "compression")]
use flate2::read::MultiGzDecoder;

use core::fmt;
use futures::stream::BoxStream;
use futures::StreamExt;
#[cfg(feature = "compression")]
use futures::TryStreamExt;
use core::fmt;
use std::fmt::Display;
use std::str::FromStr;
use tokio::io::AsyncWrite;
Expand Down Expand Up @@ -284,7 +284,6 @@ impl Display for FileType {
}
}


impl FromStr for FileType {
type Err = DataFusionError;

Expand Down Expand Up @@ -313,7 +312,7 @@ impl FileType {
FileType::PARQUET | FileType::AVRO | FileType::ARROW => match c.variant {
UNCOMPRESSED => Ok(ext),
_ => Err(DataFusionError::Internal(
"FileCompressionType can be specified for CSV/JSON FileType.".into()
"FileCompressionType can be specified for CSV/JSON FileType.".into(),
)),
},
}
Expand All @@ -322,8 +321,8 @@ impl FileType {

#[cfg(test)]
mod tests {
use crate::file_type::{FileCompressionType, FileType};
use crate::error::DataFusionError;
use crate::file_type::{FileCompressionType, FileType};
use std::str::FromStr;

#[test]
Expand Down
8 changes: 5 additions & 3 deletions datafusion/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ pub mod utils;

pub use column::Column;
pub use dfschema::{DFField, DFSchema, DFSchemaRef, ExprSchema, SchemaExt, ToDFSchema};
pub use file_type::{FileType, FileCompressionType, GetExt, DEFAULT_ARROW_EXTENSION,
DEFAULT_CSV_EXTENSION, DEFAULT_JSON_EXTENSION, DEFAULT_PARQUET_EXTENSION,
DEFAULT_AVRO_EXTENSION};
pub use error::{
field_not_found, unqualified_field_not_found, DataFusionError, Result, SchemaError,
SharedResult,
};
pub use file_type::{
FileCompressionType, FileType, GetExt, DEFAULT_ARROW_EXTENSION,
DEFAULT_AVRO_EXTENSION, DEFAULT_CSV_EXTENSION, DEFAULT_JSON_EXTENSION,
DEFAULT_PARQUET_EXTENSION,
};
pub use functional_dependencies::{
aggregate_functional_dependencies, get_target_functional_dependencies, Constraints,
Dependency, FunctionalDependence, FunctionalDependencies,
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/src/dataframe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use arrow::array::{Array, ArrayRef, Int64Array, StringArray};
use arrow::compute::{cast, concat};
use arrow::datatypes::{DataType, Field};
use async_trait::async_trait;
use datafusion_common::{DataFusionError, SchemaError, UnnestOptions, FileType};
use datafusion_common::{DataFusionError, FileType, SchemaError, UnnestOptions};
use parquet::file::properties::WriterProperties;

use datafusion_common::{Column, DFSchema, ScalarValue};
Expand Down
8 changes: 4 additions & 4 deletions datafusion/core/src/datasource/file_format/csv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ use futures::{pin_mut, Stream, StreamExt, TryStreamExt};
use object_store::{delimited::newline_delimited_stream, ObjectMeta, ObjectStore};

use super::{FileFormat, DEFAULT_SCHEMA_INFER_MAX_RECORD};
use datafusion_common::FileCompressionType;
use crate::datasource::file_format::write::{
create_writer, stateless_serialize_and_write_files, BatchSerializer, FileWriterMode,
};
Expand All @@ -50,6 +49,7 @@ use crate::execution::context::SessionState;
use crate::physical_plan::insert::{DataSink, FileSinkExec};
use crate::physical_plan::{DisplayAs, DisplayFormatType, Statistics};
use crate::physical_plan::{ExecutionPlan, SendableRecordBatchStream};
use datafusion_common::FileCompressionType;
use rand::distributions::{Alphanumeric, DistString};

/// Character Separated Value `FileFormat` implementation.
Expand Down Expand Up @@ -618,9 +618,6 @@ mod tests {
use super::*;
use crate::arrow::util::pretty;
use crate::assert_batches_eq;
use datafusion_common::FileCompressionType;
use datafusion_common::FileType;
use datafusion_common::GetExt;
use crate::datasource::file_format::test_util::VariableStream;
use crate::datasource::listing::ListingOptions;
use crate::physical_plan::collect;
Expand All @@ -631,6 +628,9 @@ mod tests {
use chrono::DateTime;
use datafusion_common::cast::as_string_array;
use datafusion_common::internal_err;
use datafusion_common::FileCompressionType;
use datafusion_common::FileType;
use datafusion_common::GetExt;
use datafusion_expr::{col, lit};
use futures::StreamExt;
use object_store::local::LocalFileSystem;
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/src/datasource/file_format/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ use crate::physical_plan::{DisplayAs, DisplayFormatType, Statistics};

use super::FileFormat;
use super::FileScanConfig;
use datafusion_common::FileCompressionType;
use crate::datasource::file_format::write::{
create_writer, stateless_serialize_and_write_files, BatchSerializer, FileWriterMode,
};
Expand All @@ -59,6 +58,7 @@ use crate::datasource::physical_plan::NdJsonExec;
use crate::error::Result;
use crate::execution::context::SessionState;
use crate::physical_plan::ExecutionPlan;
use datafusion_common::FileCompressionType;

/// New line delimited JSON `FileFormat` implementation.
#[derive(Debug)]
Expand Down
7 changes: 4 additions & 3 deletions datafusion/core/src/datasource/file_format/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ use async_trait::async_trait;
use datafusion_common::{plan_err, DataFusionError};

use crate::datasource::file_format::arrow::ArrowFormat;
use datafusion_common::{FileCompressionType, DEFAULT_ARROW_EXTENSION,
DEFAULT_CSV_EXTENSION, DEFAULT_JSON_EXTENSION, DEFAULT_PARQUET_EXTENSION,
DEFAULT_AVRO_EXTENSION};
use crate::datasource::file_format::DEFAULT_SCHEMA_INFER_MAX_RECORD;
use crate::datasource::listing::{ListingTableInsertMode, ListingTableUrl};
use crate::datasource::{
Expand All @@ -38,6 +35,10 @@ use crate::datasource::{
use crate::error::Result;
use crate::execution::context::{SessionConfig, SessionState};
use crate::logical_expr::Expr;
use datafusion_common::{
FileCompressionType, DEFAULT_ARROW_EXTENSION, DEFAULT_AVRO_EXTENSION,
DEFAULT_CSV_EXTENSION, DEFAULT_JSON_EXTENSION, DEFAULT_PARQUET_EXTENSION,
};

/// Options that control the reading of CSV files.
///
Expand Down
4 changes: 2 additions & 2 deletions datafusion/core/src/datasource/listing/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ use futures::{future, stream, StreamExt, TryStreamExt};
use object_store::path::Path;
use object_store::ObjectMeta;

use datafusion_common::{FileCompressionType, FileType};
use crate::datasource::physical_plan::{FileScanConfig, FileSinkConfig};
use crate::datasource::{
file_format::{
Expand All @@ -52,6 +51,7 @@ use crate::{
logical_expr::Expr,
physical_plan::{empty::EmptyExec, ExecutionPlan, Statistics},
};
use datafusion_common::{FileCompressionType, FileType};

use super::PartitionedFile;

Expand Down Expand Up @@ -963,7 +963,6 @@ impl ListingTable {
#[cfg(test)]
mod tests {
use super::*;
use datafusion_common::GetExt;
use crate::datasource::{provider_as_source, MemTable};
use crate::execution::options::ArrowReadOptions;
use crate::physical_plan::collect;
Expand All @@ -979,6 +978,7 @@ mod tests {
use arrow::record_batch::RecordBatch;
use chrono::DateTime;
use datafusion_common::assert_contains;
use datafusion_common::GetExt;
use datafusion_expr::LogicalPlanBuilder;
use rstest::*;
use std::collections::HashMap;
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/src/datasource/listing_table_factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use datafusion_expr::CreateExternalTable;
use crate::datasource::file_format::arrow::ArrowFormat;
use crate::datasource::file_format::avro::AvroFormat;
use crate::datasource::file_format::csv::CsvFormat;
use datafusion_common::{FileCompressionType, FileType};
use crate::datasource::file_format::json::JsonFormat;
use crate::datasource::file_format::parquet::ParquetFormat;
use crate::datasource::file_format::FileFormat;
Expand All @@ -39,6 +38,7 @@ use crate::datasource::listing::{
use crate::datasource::provider::TableProviderFactory;
use crate::datasource::TableProvider;
use crate::execution::context::SessionState;
use datafusion_common::{FileCompressionType, FileType};

use super::listing::ListingTableInsertMode;

Expand Down
4 changes: 2 additions & 2 deletions datafusion/core/src/datasource/physical_plan/csv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

//! Execution plan for reading CSV files

use datafusion_common::FileCompressionType;
use crate::datasource::listing::{FileRange, ListingTableUrl};
use crate::datasource::physical_plan::file_stream::{
FileOpenFuture, FileOpener, FileStream,
Expand All @@ -32,6 +31,7 @@ use crate::physical_plan::{
};
use arrow::csv;
use arrow::datatypes::SchemaRef;
use datafusion_common::FileCompressionType;
use datafusion_execution::TaskContext;
use datafusion_physical_expr::{
ordering_equivalence_properties_helper, LexOrdering, OrderingEquivalenceProperties,
Expand Down Expand Up @@ -650,13 +650,13 @@ pub async fn plan_to_csv(
#[cfg(test)]
mod tests {
use super::*;
use datafusion_common::FileType;
use crate::datasource::physical_plan::chunked_store::ChunkedStore;
use crate::prelude::*;
use crate::test::{partitioned_csv_config, partitioned_file_groups};
use crate::test_util::{aggr_test_schema_with_missing_col, arrow_test_data};
use crate::{scalar::ScalarValue, test_util::aggr_test_schema};
use arrow::datatypes::*;
use datafusion_common::FileType;
use futures::StreamExt;
use object_store::local::LocalFileSystem;
use rstest::*;
Expand Down
4 changes: 2 additions & 2 deletions datafusion/core/src/datasource/physical_plan/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
// under the License.

//! Execution plan for reading line-delimited JSON files
use datafusion_common::FileCompressionType;
use crate::datasource::listing::ListingTableUrl;
use crate::datasource::physical_plan::file_stream::{
FileOpenFuture, FileOpener, FileStream,
Expand All @@ -29,6 +28,7 @@ use crate::physical_plan::{
DisplayAs, DisplayFormatType, ExecutionPlan, Partitioning, SendableRecordBatchStream,
Statistics,
};
use datafusion_common::FileCompressionType;
use datafusion_execution::TaskContext;

use arrow::json::ReaderBuilder;
Expand Down Expand Up @@ -320,7 +320,6 @@ mod tests {
use object_store::local::LocalFileSystem;

use crate::assert_batches_eq;
use datafusion_common::FileType;
use crate::datasource::file_format::{json::JsonFormat, FileFormat};
use crate::datasource::listing::PartitionedFile;
use crate::datasource::object_store::ObjectStoreUrl;
Expand All @@ -330,6 +329,7 @@ mod tests {
use crate::prelude::*;
use crate::test::partitioned_file_groups;
use datafusion_common::cast::{as_int32_array, as_int64_array, as_string_array};
use datafusion_common::FileType;
use rstest::*;
use std::fs;
use std::path::Path;
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/src/physical_optimizer/repartition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,6 @@ mod tests {
use arrow::datatypes::{DataType, Field, Schema, SchemaRef};

use super::*;
use datafusion_common::FileCompressionType;
use crate::datasource::listing::PartitionedFile;
use crate::datasource::object_store::ObjectStoreUrl;
use crate::datasource::physical_plan::{FileScanConfig, ParquetExec};
Expand All @@ -350,6 +349,7 @@ mod tests {
use crate::physical_plan::sorts::sort_preserving_merge::SortPreservingMergeExec;
use crate::physical_plan::union::UnionExec;
use crate::physical_plan::{displayable, DisplayAs, DisplayFormatType, Statistics};
use datafusion_common::FileCompressionType;
use datafusion_physical_expr::PhysicalSortRequirement;

fn schema() -> SchemaRef {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,11 @@ mod tests {

use crate::prelude::SessionConfig;

use datafusion_common::FileCompressionType;
use crate::datasource::listing::PartitionedFile;
use crate::datasource::physical_plan::{CsvExec, FileScanConfig};
use crate::physical_plan::coalesce_batches::CoalesceBatchesExec;
use crate::physical_plan::coalesce_partitions::CoalescePartitionsExec;
use datafusion_common::FileCompressionType;

use crate::physical_plan::filter::FilterExec;
use crate::physical_plan::joins::{HashJoinExec, PartitionMode};
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/src/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
//! Common unit test utility methods

use crate::arrow::array::UInt32Array;
use datafusion_common::{FileCompressionType, FileType};
use crate::datasource::listing::PartitionedFile;
use crate::datasource::object_store::ObjectStoreUrl;
use crate::datasource::physical_plan::{CsvExec, FileScanConfig};
Expand All @@ -38,6 +37,7 @@ use bzip2::write::BzEncoder;
#[cfg(feature = "compression")]
use bzip2::Compression as BzCompression;
use datafusion_common::{DataFusionError, Statistics};
use datafusion_common::{FileCompressionType, FileType};
use datafusion_physical_expr::PhysicalSortExpr;
#[cfg(feature = "compression")]
use flate2::write::GzEncoder;
Expand Down
Loading

0 comments on commit ba2bf0d

Please sign in to comment.