Skip to content

Apache DataFusion SQL Query Engine

docs(upgrading): document RecursiveQuery schema field in upgrade guide (#23991)

Alvaro Balbinbb45fb8275bf
diff --git a/docs/source/library-user-guide/upgrading/55.0.0.md b/docs/source/library-user-guide/upgrading/55.0.0.md
index 21def5a1fc..b0f2602d31 100644
--- a/docs/source/library-user-guide/upgrading/55.0.0.md
+++ b/docs/source/library-user-guide/upgrading/55.0.0.md
@@ -1109,6 +1109,41 @@ let plan = deserialize_bytes(&proto_bytes)?;
See [PR #23827](https://github.com/apache/datafusion/pull/23827) for details.
+### `RecursiveQuery` gained a `schema` field
+
+`datafusion_expr::logical_plan::RecursiveQuery` exposed the static (anchor) term's
+schema to parent plans, which ignored columns that only the recursive term makes
+nullable. The node now stores the schema reconciled from both terms explicitly, so
+it can no longer be built with an exhaustive struct literal.
+
+**Who is affected:**
+
+- Code constructing `RecursiveQuery` with a struct literal. This change also
+ shipped in `54.1.0`, so the same migration applies within the `54` series.
+
+**Migration guide:**
+
+Build the node with `RecursiveQuery::try_new`, which computes the schema and
+returns an error if the two terms do not have the same number of columns:
+
+```rust,ignore
+// Before
+let query = RecursiveQuery {
+ name,
+ static_term,
+ recursive_term,
+ is_distinct,
+};
+
+// After
+let query = RecursiveQuery::try_new(name, static_term, recursive_term, is_distinct)?;
+```
+
+`RecursiveQueryExec::try_new` takes the reconciled schema as its second argument
+for the same reason, rather than deriving it from its children.
+
+See [PR #22552](https://github.com/apache/datafusion/pull/22552) for details.
+
### `ExecutionPlan::apply_expressions` is now a required method
`apply_expressions` has been added as a **required** method on the `ExecutionPlan`, `FileSource`, and `DataSource` traits. Any custom implementation of