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
6 changes: 6 additions & 0 deletions datafusion/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,12 @@ doc_comment::doctest!(
library_user_guide_working_with_exprs
);

#[cfg(doctest)]
doc_comment::doctest!(

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.

this runs the examples as real doc tests

"../../../docs/source/library-user-guide/upgrading/index.md",
library_user_guide_upgrading
);

#[cfg(doctest)]
doc_comment::doctest!(
"../../../docs/source/contributor-guide/api-health.md",
Expand Down
45 changes: 42 additions & 3 deletions docs/source/library-user-guide/upgrading/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,18 @@ has fields. Before, this could panic or return another column's values.
Start from `Statistics::new_unknown`, or project a child's statistics with
`Statistics::project` if the plan changes its columns:

```rust,ignore
```rust
# use datafusion::arrow::datatypes::SchemaRef;
# use datafusion::common::{Statistics, stats::Precision};
# struct MyExec { schema: SchemaRef }
# impl MyExec {
# fn schema(&self) -> SchemaRef { self.schema.clone() }
# fn statistics(&self, num_rows: usize) -> Statistics {
let statistics = Statistics::new_unknown(&self.schema())
.with_num_rows(Precision::Exact(num_rows));
# statistics
# }
# }
```

### Materialized CTE scans have a projection
Expand Down Expand Up @@ -265,7 +274,22 @@ The existing seven-argument `SortMergeJoinExec::try_new` continues
to create a non-null-aware join. Enable null-aware semantics with
`.with_null_aware(true)?`:

```rust,ignore
```rust
# use std::sync::Arc;

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.

add various stuff needed to make it compile and run

# use datafusion::arrow::compute::SortOptions;
# use datafusion::arrow::datatypes::{DataType, Field, Schema};
# use datafusion::common::{JoinType, NullEquality};
# use datafusion::error::Result;
# use datafusion::physical_expr::expressions::Column;
# use datafusion::physical_plan::ExecutionPlan;
# use datafusion::physical_plan::empty::EmptyExec;
# use datafusion::physical_plan::joins::SortMergeJoinExec;
# use datafusion::physical_plan::joins::utils::JoinOn;
# fn main() -> Result<()> {
# let schema = Arc::new(Schema::new(vec![Field::new("a", DataType::Int32, true)]));
# let left: Arc<dyn ExecutionPlan> = Arc::new(EmptyExec::new(Arc::clone(&schema)));
# let right: Arc<dyn ExecutionPlan> = Arc::new(EmptyExec::new(schema));
# let on: JoinOn = vec![(Arc::new(Column::new("a", 0)), Arc::new(Column::new("a", 0)))];
let exec = SortMergeJoinExec::try_new(
left,
right,
Expand All @@ -276,6 +300,8 @@ let exec = SortMergeJoinExec::try_new(
NullEquality::NullEqualsNothing,
)?
.with_null_aware(true)?;
# Ok(())
# }
```

Both inputs must have a single partition when executed.
Expand All @@ -284,6 +310,8 @@ The generated protobuf `SortMergeJoinExecNode` type has a new
`null_aware` field. Exhaustive struct literals must initialize it;
`false` preserves the previous behavior:

<!-- Not run as a doctest: `datafusion-proto` is not a dependency of the `datafusion` crate, which runs the examples on this page -->

```rust,ignore
let node = SortMergeJoinExecNode {
left,
Expand Down Expand Up @@ -316,8 +344,16 @@ computed expression as not determined.

**Migration guide:**

```rust,ignore
```rust
# use datafusion::common::{
# DFSchema, aggregate_functional_dependencies,
# aggregate_functional_dependencies_with_computed_inputs,
# };
# let (input_schema, aggr_schema) = (&DFSchema::empty(), &DFSchema::empty());
# let group_by_input_indices: Vec<Option<usize>> = vec![];
# let computed_input_indices: Vec<Option<Vec<usize>>> = vec![];
// Before
# #[expect(deprecated)]
let deps = aggregate_functional_dependencies(input_schema, &group_by_input_indices, aggr_schema);

// After
Expand All @@ -343,6 +379,8 @@ the name `""`.

**Migration guide:**

<!-- Not run as a doctest: the "Before" code uses fields that were removed and so does not compile -->

```rust,ignore
// Before
let arg_types: Vec<DataType> = args.iter().map(|a| a.data_type.clone()).collect();
Expand Down Expand Up @@ -370,6 +408,7 @@ Code that constructs these structs with an exhaustive struct literal must add
the field or use `..Default::default()`. Builder methods are unaffected:

```rust
# use datafusion::prelude::CsvReadOptions;
// 56.0.0
let options = CsvReadOptions {
has_header: true,
Expand Down