Skip to content

Commit

Permalink
refactor: remove uses of arrow_schema and use reexport in arrow instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Lai authored and Ian Lai committed Feb 11, 2025
1 parent 3550758 commit be33471
Show file tree
Hide file tree
Showing 198 changed files with 327 additions and 357 deletions.
31 changes: 11 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion datafusion/catalog-listing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ version.workspace = true

[dependencies]
arrow = { workspace = true }
arrow-schema = { workspace = true }
async-compression = { version = "0.4.0", features = [
"bzip2",
"gzip",
Expand Down
3 changes: 1 addition & 2 deletions datafusion/catalog-listing/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ use datafusion_expr::{BinaryExpr, Operator};
use arrow::{
array::{Array, ArrayRef, AsArray, StringBuilder},
compute::{and, cast, prep_null_mask_filter},
datatypes::{DataType, Field, Schema},
datatypes::{DataType, Field, Fields, Schema},
record_batch::RecordBatch,
};
use arrow_schema::Fields;
use datafusion_expr::execution_props::ExecutionProps;
use futures::stream::FuturesUnordered;
use futures::{stream::BoxStream, StreamExt, TryStreamExt};
Expand Down
1 change: 0 additions & 1 deletion datafusion/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ apache-avro = { version = "0.17", default-features = false, features = [
], optional = true }
arrow = { workspace = true }
arrow-ipc = { workspace = true }
arrow-schema = { workspace = true }
base64 = "0.22.1"
half = { workspace = true }
hashbrown = { workspace = true }
Expand Down
5 changes: 2 additions & 3 deletions datafusion/common/src/column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use crate::error::_schema_err;
use crate::utils::{parse_identifiers_normalized, quote_identifier};
use crate::{DFSchema, Diagnostic, Result, SchemaError, Spans, TableReference};
use arrow_schema::{Field, FieldRef};
use arrow::datatypes::{Field, FieldRef};
use std::collections::HashSet;
use std::convert::Infallible;
use std::fmt;
Expand Down Expand Up @@ -380,8 +380,7 @@ impl fmt::Display for Column {
#[cfg(test)]
mod tests {
use super::*;
use arrow::datatypes::DataType;
use arrow_schema::SchemaBuilder;
use arrow::datatypes::{DataType, SchemaBuilder};
use std::sync::Arc;

fn create_qualified_schema(qualifier: &str, names: Vec<&str>) -> Result<DFSchema> {
Expand Down
12 changes: 6 additions & 6 deletions datafusion/common/src/dfschema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ use crate::{
};

use arrow::compute::can_cast_types;
use arrow::datatypes::{DataType, Field, FieldRef, Fields, Schema, SchemaRef};
use arrow_schema::SchemaBuilder;
use arrow::datatypes::{
DataType, Field, FieldRef, Fields, Schema, SchemaBuilder, SchemaRef,
};

/// A reference-counted reference to a [DFSchema].
pub type DFSchemaRef = Arc<DFSchema>;
Expand All @@ -56,7 +57,7 @@ pub type DFSchemaRef = Arc<DFSchema>;
///
/// ```rust
/// use datafusion_common::{DFSchema, Column};
/// use arrow_schema::{DataType, Field, Schema};
/// use arrow::datatypes::{DataType, Field, Schema};
///
/// let arrow_schema = Schema::new(vec![
/// Field::new("c1", DataType::Int32, false),
Expand All @@ -77,7 +78,7 @@ pub type DFSchemaRef = Arc<DFSchema>;
///
/// ```rust
/// use datafusion_common::{DFSchema, Column};
/// use arrow_schema::{DataType, Field, Schema};
/// use arrow::datatypes::{DataType, Field, Schema};
///
/// let arrow_schema = Schema::new(vec![
/// Field::new("c1", DataType::Int32, false),
Expand All @@ -94,8 +95,7 @@ pub type DFSchemaRef = Arc<DFSchema>;
///
/// ```rust
/// use datafusion_common::DFSchema;
/// use arrow_schema::Schema;
/// use arrow::datatypes::Field;
/// use arrow::datatypes::{Schema, Field};
/// use std::collections::HashMap;
///
/// let df_schema = DFSchema::from_unqualified_fields(vec![
Expand Down
2 changes: 1 addition & 1 deletion datafusion/common/src/file_options/parquet_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use crate::{
DataFusionError, Result, _internal_datafusion_err,
};

use arrow_schema::Schema;
use arrow::datatypes::Schema;
// TODO: handle once deprecated
#[allow(deprecated)]
use parquet::{
Expand Down
2 changes: 1 addition & 1 deletion datafusion/common/src/param_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

use crate::error::{_plan_datafusion_err, _plan_err};
use crate::{Result, ScalarValue};
use arrow_schema::DataType;
use arrow::datatypes::DataType;
use std::collections::HashMap;

/// The parameter value corresponding to the placeholder
Expand Down
5 changes: 2 additions & 3 deletions datafusion/common/src/scalar/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@ use arrow::datatypes::{
Int8Type, IntervalDayTimeType, IntervalMonthDayNanoType, IntervalUnit,
IntervalYearMonthType, TimeUnit, TimestampMicrosecondType, TimestampMillisecondType,
TimestampNanosecondType, TimestampSecondType, UInt16Type, UInt32Type, UInt64Type,
UInt8Type, DECIMAL128_MAX_PRECISION,
UInt8Type, UnionFields, UnionMode, DECIMAL128_MAX_PRECISION,
};
use arrow::util::display::{array_value_to_string, ArrayFormatter, FormatOptions};
use arrow_schema::{UnionFields, UnionMode};

use crate::format::DEFAULT_CAST_OPTIONS;
use half::f16;
Expand Down Expand Up @@ -3964,9 +3963,9 @@ mod tests {
use arrow::array::{types::Float64Type, NullBufferBuilder};
use arrow::buffer::{Buffer, OffsetBuffer};
use arrow::compute::{is_null, kernels};
use arrow::datatypes::Fields;
use arrow::error::ArrowError;
use arrow::util::pretty::pretty_format_columns;
use arrow_schema::Fields;
use chrono::NaiveDate;
use rand::Rng;

Expand Down
3 changes: 1 addition & 2 deletions datafusion/common/src/scalar/struct_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
use crate::error::_internal_err;
use crate::{Result, ScalarValue};
use arrow::array::{ArrayRef, StructArray};
use arrow::datatypes::{DataType, FieldRef, Fields};
use arrow_schema::Field;
use arrow::datatypes::{DataType, Field, FieldRef, Fields};
use std::sync::Arc;

/// Builder for [`ScalarValue::Struct`].
Expand Down
2 changes: 1 addition & 1 deletion datafusion/common/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use std::fmt::{self, Debug, Display};

use crate::{Result, ScalarValue};

use arrow_schema::{DataType, Schema, SchemaRef};
use arrow::datatypes::{DataType, Schema, SchemaRef};

/// Represents a value with a degree of certainty. `Precision` is used to
/// propagate information the precision of statistical values.
Expand Down
4 changes: 2 additions & 2 deletions datafusion/common/src/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,9 @@ macro_rules! create_array {
macro_rules! record_batch {
($(($name: expr, $type: ident, $values: expr)),*) => {
{
let schema = std::sync::Arc::new(arrow_schema::Schema::new(vec![
let schema = std::sync::Arc::new(arrow::datatypes::Schema::new(vec![
$(
arrow_schema::Field::new($name, arrow_schema::DataType::$type, true),
arrow::datatypes::Field::new($name, arrow::datatypes::DataType::$type, true),
)*
]));

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

use arrow_schema::{Field, Fields, UnionFields};
use arrow::datatypes::{Field, Fields, UnionFields};
use std::hash::{Hash, Hasher};
use std::{ops::Deref, sync::Arc};

Expand Down
2 changes: 1 addition & 1 deletion datafusion/common/src/types/logical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

use super::NativeType;
use crate::error::Result;
use arrow_schema::DataType;
use arrow::datatypes::DataType;
use core::fmt;
use std::{cmp::Ordering, hash::Hash, sync::Arc};

Expand Down
4 changes: 2 additions & 2 deletions datafusion/common/src/types/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use super::{
};
use crate::error::{Result, _internal_err};
use arrow::compute::can_cast_types;
use arrow_schema::{
use arrow::datatypes::{
DataType, Field, FieldRef, Fields, IntervalUnit, TimeUnit, UnionFields,
};
use std::{fmt::Display, sync::Arc};
Expand Down Expand Up @@ -126,7 +126,7 @@ pub enum NativeType {
/// nevertheless correct).
///
/// ```
/// # use arrow_schema::{DataType, TimeUnit};
/// # use arrow::datatypes::{DataType, TimeUnit};
/// DataType::Timestamp(TimeUnit::Second, None);
/// DataType::Timestamp(TimeUnit::Second, Some("literal".into()));
/// DataType::Timestamp(TimeUnit::Second, Some("string".to_string().into()));
Expand Down
3 changes: 1 addition & 2 deletions datafusion/common/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ use arrow::array::{
};
use arrow::buffer::OffsetBuffer;
use arrow::compute::{partition, SortColumn, SortOptions};
use arrow::datatypes::{Field, SchemaRef};
use arrow_schema::DataType;
use arrow::datatypes::{DataType, Field, SchemaRef};
use sqlparser::ast::Ident;
use sqlparser::dialect::GenericDialect;
use sqlparser::parser::Parser;
Expand Down
3 changes: 2 additions & 1 deletion datafusion/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ recursive_protection = [
"datafusion-physical-optimizer/recursive_protection",
"datafusion-sql/recursive_protection",
]
serde = ["arrow-schema/serde"]
serde = ["dep:serde"]
string_expressions = ["datafusion-functions/string_expressions"]
unicode_expressions = [
"datafusion-sql/unicode_expressions",
Expand Down Expand Up @@ -126,6 +126,7 @@ parking_lot = { workspace = true }
parquet = { workspace = true, optional = true, default-features = true }
rand = { workspace = true }
regex = { workspace = true }
serde = { version = "1.0", default-features = false, features = ["derive"], optional = true }
sqlparser = { workspace = true }
tempfile = { workspace = true }
tokio = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/benches/sql_query_with_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use std::{fmt::Write, sync::Arc, time::Duration};

use arrow::array::{Int64Builder, RecordBatch, UInt64Builder};
use arrow_schema::{DataType, Field, Schema, SchemaRef};
use arrow::datatypes::{DataType, Field, Schema, SchemaRef};
use bytes::Bytes;
use criterion::{criterion_group, criterion_main, Criterion, SamplingMode};
use datafusion::{
Expand Down
3 changes: 1 addition & 2 deletions datafusion/core/src/dataframe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ use std::sync::Arc;

use arrow::array::{Array, ArrayRef, Int64Array, StringArray};
use arrow::compute::{cast, concat};
use arrow::datatypes::{DataType, Field};
use arrow_schema::{Schema, SchemaRef};
use arrow::datatypes::{DataType, Field, Schema, SchemaRef};
use datafusion_common::config::{CsvOptions, JsonOptions};
use datafusion_common::{
exec_err, not_impl_err, plan_err, Column, DFSchema, DataFusionError, ParamValues,
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/src/datasource/data_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use std::sync::Arc;

use crate::datasource::physical_plan::{FileOpener, FileScanConfig};

use arrow_schema::SchemaRef;
use arrow::datatypes::SchemaRef;
use datafusion_common::Statistics;
use datafusion_physical_plan::metrics::ExecutionPlanMetricsSet;
use datafusion_physical_plan::DisplayFormatType;
Expand Down
Loading

0 comments on commit be33471

Please sign in to comment.