Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ jobs:
with:
rust-version: stable
- name: Run tests (excluding doctests)
run: cargo test --profile ci --exclude datafusion-examples --exclude ffi_example_table_provider --exclude datafusion-benchmarks --workspace --lib --tests --bins --features avro,json,backtrace,integration-tests
run: cargo test --profile ci --exclude datafusion-examples --exclude ffi_example_table_provider --exclude datafusion-benchmarks --workspace --lib --tests --bins --features serde,avro,json,backtrace,integration-tests
- name: Verify Working Directory Clean
run: git diff --exit-code

Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

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

7 changes: 6 additions & 1 deletion datafusion/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ recursive_protection = [
"datafusion-physical-optimizer/recursive_protection",
"datafusion-sql/recursive_protection",
]
serde = ["dep:serde"]
serde = [
"dep:serde",
# Enable `#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]`
# statements in `arrow-schema` crate
"arrow-schema/serde",
]
string_expressions = ["datafusion-functions/string_expressions"]
unicode_expressions = [
"datafusion-sql/unicode_expressions",
Expand Down
5 changes: 5 additions & 0 deletions datafusion/core/tests/core_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,13 @@ mod custom_sources_cases;
/// Run all tests that are found in the `optimizer` directory
mod optimizer;

/// Run all tests that are found in the `physical_optimizer` directory
mod physical_optimizer;

/// Run all tests that are found in the `serde` directory
mod serde;
Copy link
Contributor

Choose a reason for hiding this comment

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

moved the test here


/// Run all tests that are found in the `catalog` directory
mod catalog;

#[cfg(test)]
Expand Down
34 changes: 34 additions & 0 deletions datafusion/core/tests/serde/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

/// Ensure `serde` feature from `arrow-schema` crate is re-exported.
#[test]
#[cfg(feature = "serde")]
fn ensure_serde_support() {
use datafusion::arrow::datatypes::DataType;

#[derive(Debug, PartialEq, serde::Serialize, serde::Deserialize)]
struct WrappingStruct(DataType);

let boolean = WrappingStruct(DataType::Boolean);

let serialized = serde_json::to_string(&boolean).unwrap();
assert_eq!("\"Boolean\"", serialized);

let deserialized = serde_json::from_str(&serialized).unwrap();
assert_eq!(boolean, deserialized);
}