Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.lock

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

Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
//! - Handle memory pressure by spilling to disk
//! - Release memory when done

use arrow::array::record_batch;
use arrow::record_batch::RecordBatch;
use arrow_schema::SchemaRef;
use datafusion::common::record_batch;
use datafusion::common::{exec_datafusion_err, internal_err};
use datafusion::datasource::{DefaultTableSource, memory::MemTable};
use datafusion::error::Result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ publish = false

[dependencies]
arrow = { workspace = true }
arrow-schema = { workspace = true }
datafusion = { workspace = true }
datafusion-ffi = { workspace = true }
ffi_module_interface = { path = "../ffi_module_interface" }

[package.metadata.cargo-machete]
ignored = ["arrow-schema"]
Comment on lines +26 to +32

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems pretty unfortunate, that its kind of a hidden dependency of the macro 🙁

i suppose we cant do much about it unless we fix it upstream (and even then would require arrow-array to reexport arrow-schema i think?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I was kinda surprised this was required as well. If you think this is a blocker I can close and just leave record_batch! as it is I'm not sure what is best

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i think it's a bit awkward to need to import two dependencies in order to use this macro 🤔


[lints]
workspace = true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

use std::sync::Arc;

use arrow::array::RecordBatch;
use arrow::array::{RecordBatch, record_batch};
use arrow::datatypes::{DataType, Field, Schema};
use datafusion::{common::record_batch, datasource::MemTable};
use datafusion::datasource::MemTable;
use datafusion_ffi::proto::logical_extension_codec::FFI_LogicalExtensionCodec;
use datafusion_ffi::table_provider::FFI_TableProvider;
use ffi_module_interface::TableProviderModule;
Expand Down
11 changes: 10 additions & 1 deletion datafusion/common/src/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,15 +364,20 @@ macro_rules! create_array {
/// Creates a record batch from literal slice of values, suitable for rapid
/// testing and development.
///
/// **Deprecated**: prefer the upstream macro from `arrow`,
/// [`arrow::array::record_batch`], which now supports both the literal slice
/// form shown below and a variable/expression form.
///
/// Example:
/// ```
/// use datafusion_common::record_batch;
/// use arrow::array::record_batch;
/// let batch = record_batch!(
/// ("a", Int32, vec![1, 2, 3]),
/// ("b", Float64, vec![Some(4.0), None, Some(5.0)]),
/// ("c", Utf8, vec!["alpha", "beta", "gamma"])
/// );
/// ```
#[deprecated(since = "55.0.0", note = "Use `arrow::array::record_batch` instead")]
#[macro_export]
macro_rules! record_batch {
($(($name: expr, $type: ident, $values: expr)),*) => {
Expand Down Expand Up @@ -776,6 +781,10 @@ mod tests {
}

#[test]
#[expect(
deprecated,
reason = "testing the deprecated record_batch! macro itself"
)]
fn test_create_record_batch() -> Result<()> {
use arrow::array::Array;

Expand Down
4 changes: 4 additions & 0 deletions datafusion/core/tests/macro_hygiene/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ mod plan_datafusion_err {
}

mod record_batch {
#![expect(
deprecated,
reason = "exercising hygiene of the deprecated `datafusion_common::record_batch!` while it is still exported"
)]
// NO other imports!
use datafusion_common::record_batch;

Expand Down
4 changes: 2 additions & 2 deletions datafusion/datasource-parquet/src/opener/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1696,12 +1696,12 @@ mod test {
CachedParquetFileReaderFactory, DefaultParquetFileReaderFactory,
ParquetFileReaderFactory, ParquetRowSelection, RowGroupAccess,
};
use arrow::array::RecordBatch;
use arrow::array::{RecordBatch, record_batch};
use arrow::datatypes::{DataType, Field, Schema, SchemaRef};
use bytes::{BufMut, BytesMut};
use datafusion_common::{
ColumnStatistics, ScalarValue, Statistics, assert_contains, internal_err,
record_batch, stats::Precision,
stats::Precision,
};
use datafusion_datasource::morsel::{Morsel, Morselizer};
use datafusion_datasource::{PartitionedFile, TableSchema, TableSchemaBuilder};
Expand Down
4 changes: 4 additions & 0 deletions datafusion/datasource/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,15 @@ url = { workspace = true }
zstd = { workspace = true, optional = true }

[dev-dependencies]
arrow-schema = { workspace = true }
criterion = { workspace = true }
datafusion-functions = { workspace = true }
insta = { workspace = true }
tempfile = { workspace = true }

[package.metadata.cargo-machete]
ignored = ["arrow-schema"]

# Note: add additional linter rules in lib.rs.
# Rust does not support workspace + new linter rules in subcrates yet
# https://github.com/rust-lang/cargo/issues/13157
Expand Down
4 changes: 2 additions & 2 deletions datafusion/datasource/src/projection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,9 @@ impl SplitProjection {
mod test {
use std::sync::Arc;

use arrow::array::{AsArray, RecordBatch};
use arrow::array::{AsArray, RecordBatch, record_batch};
use arrow::datatypes::{DataType, Field, SchemaRef};
use datafusion_common::{DFSchema, ScalarValue, config::ConfigOptions, record_batch};
use datafusion_common::{DFSchema, ScalarValue, config::ConfigOptions};
use datafusion_expr::{Expr, ScalarUDF, col, execution_props::ExecutionProps};
use datafusion_functions::core::input_file_name::InputFileNameFunc;
use datafusion_physical_expr::{
Expand Down
2 changes: 1 addition & 1 deletion datafusion/ffi/src/record_batch_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ impl Drop for FFI_RecordBatchStream {
mod tests {
use std::sync::Arc;

use arrow::array::record_batch;
use arrow::datatypes::{DataType, Field, Schema};
use datafusion::common::record_batch;
use datafusion::error::Result;
use datafusion::execution::SendableRecordBatchStream;
use datafusion::test_util::bounded_stream;
Expand Down
2 changes: 1 addition & 1 deletion datafusion/ffi/src/tests/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ pub struct FixedSchemaProvider {
}

pub fn fruit_table() -> Arc<dyn TableProvider + 'static> {
use arrow::array::record_batch;
use arrow::datatypes::{DataType, Field};
use datafusion_common::record_batch;

let schema = Arc::new(Schema::new(vec![
Field::new("units", DataType::Int32, true),
Expand Down
3 changes: 1 addition & 2 deletions datafusion/ffi/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@

use std::sync::Arc;

use arrow::array::RecordBatch;
use arrow::array::{RecordBatch, record_batch};
use arrow_schema::{DataType, Field, Schema};
use async_provider::create_async_table_provider;
use async_trait::async_trait;
use catalog::create_catalog_provider;
use datafusion_catalog::MemTable;
use datafusion_catalog::{Session, TableProvider};
use datafusion_common::record_batch;
use datafusion_common::stats::Precision;
use datafusion_common::{ColumnStatistics, Statistics};
use datafusion_common::{Result, ScalarValue};
Expand Down
3 changes: 1 addition & 2 deletions datafusion/ffi/tests/ffi_udaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
mod tests {
use std::sync::Arc;

use arrow::array::Float64Array;
use datafusion::common::record_batch;
use arrow::array::{Float64Array, record_batch};
use datafusion::error::Result;
use datafusion::logical_expr::{AggregateUDF, AggregateUDFImpl};
use datafusion::prelude::{SessionContext, col};
Expand Down
3 changes: 1 addition & 2 deletions datafusion/ffi/tests/ffi_udf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
/// when the feature integration-tests is built
#[cfg(feature = "integration-tests")]
mod tests {
use arrow::array::{Array, AsArray};
use arrow::array::{Array, AsArray, record_batch};
use arrow::datatypes::DataType;
use datafusion::common::record_batch;
use datafusion::error::Result;
use datafusion::logical_expr::{ExpressionPlacement, ScalarUDF, ScalarUDFImpl};
use datafusion::prelude::{SessionContext, col};
Expand Down
4 changes: 4 additions & 0 deletions datafusion/physical-expr-adapter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ itertools = { workspace = true }
workspace = true

[dev-dependencies]
arrow-schema = { workspace = true }

[package.metadata.cargo-machete]
ignored = ["arrow-schema"]
4 changes: 2 additions & 2 deletions datafusion/physical-expr-adapter/src/schema_rewriter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,10 +627,10 @@ mod tests {
use super::*;
use arrow::array::{
Array, BooleanArray, GenericListArray, Int32Array, Int64Array, RecordBatch,
RecordBatchOptions, StringArray, StringViewArray, StructArray,
RecordBatchOptions, StringArray, StringViewArray, StructArray, record_batch,
};
use arrow::datatypes::{Field, Fields, Schema};
use datafusion_common::{assert_contains, record_batch};
use datafusion_common::assert_contains;
use datafusion_expr::Operator;
use datafusion_physical_expr::expressions::{Column, Literal, col};

Expand Down
Loading