Skip to content

Conversation

@Jefffrey
Copy link
Contributor

@Jefffrey Jefffrey commented Oct 23, 2025

Which issue does this PR close?

Issue was raised as comment: #17913 (comment)

Rationale for this change

On current website can see:

image

Source document:

**Before:**
```rust,ignore
pub type ProjectionExpr = (Arc<dyn PhysicalExpr>, String);
```
**After:**
```rust,ignore
#[derive(Debug, Clone)]
pub struct ProjectionExpr {
pub expr: Arc<dyn PhysicalExpr>,
pub alias: String,
}
```

image

-https://datafusion.apache.org/library-user-guide/extending-operators.html#optimizing-logical-plan

Source document:

```rust,ignore
fn rewrite(
&self,
plan: LogicalPlan,
_config: &dyn OptimizerConfig,
) -> Result<Transformed<LogicalPlan>> {
// Attempts to rewrite a logical plan to a uwheel-based plan that either provides
// plan-time aggregates or skips execution based on min/max pruning.
if let Some(rewritten) = self.try_rewrite(&plan) {
Ok(Transformed::yes(rewritten))
} else {
Ok(Transformed::no(plan))
}
}
```
```rust,ignore
// Converts a uwheel aggregate result to a TableScan with a MemTable as source
fn agg_to_table_scan(result: f64, schema: SchemaRef) -> Result<LogicalPlan> {
let data = Float64Array::from(vec![result]);
let record_batch = RecordBatch::try_new(schema.clone(), vec![Arc::new(data)])?;
let df_schema = Arc::new(DFSchema::try_from(schema.clone())?);
let mem_table = MemTable::try_new(schema, vec![vec![record_batch]])?;
mem_table_as_table_scan(mem_table, df_schema)
}
```

,ignore should also be trimmed out.

What changes are included in this PR?

Fix regex used in trimming rust blocks to account for optional ignore.

Are these changes tested?

Tested locally:

image image

Existing blocks (with only rust and not rust,ignore) unaffected, e.g. in catalogs page:

image

Are there any user-facing changes?

No, doc changes.

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Oct 23, 2025
@Jefffrey Jefffrey marked this pull request as ready for review October 23, 2025 05:32
Copy link
Member

@Weijun-H Weijun-H left a comment

Choose a reason for hiding this comment

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

👍

@Jefffrey Jefffrey added this pull request to the merge queue Oct 24, 2025
Merged via the queue into apache:main with commit 1af3699 Oct 24, 2025
6 checks passed
@Jefffrey Jefffrey deleted the doc-trim-fix branch October 24, 2025 00:44
tobixdev pushed a commit to tobixdev/datafusion that referenced this pull request Nov 2, 2025
## Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closes apache#123` indicates that this PR will close issue apache#123.
-->

Issue was raised as comment:
apache#17913 (comment)

## Rationale for this change

<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->

On current website can see:

<img width="752" height="458" alt="image"
src="https://github.com/user-attachments/assets/7df06070-528f-432d-8a11-cf92f86f5f34"
/>

-
https://datafusion.apache.org/library-user-guide/upgrading.html#projectionexpr-changed-from-type-alias-to-struct

Source document:


https://github.com/apache/datafusion/blob/408e1e4e2c46d673a067e05f3e363a6f51e641c4/docs/source/library-user-guide/upgrading.md?plain=1#L204-L218

<img width="771" height="711" alt="image"
src="https://github.com/user-attachments/assets/9472b6b6-1a7e-42f3-a9ae-17d55adfb491"
/>


-https://datafusion.apache.org/library-user-guide/extending-operators.html#optimizing-logical-plan

Source document:


https://github.com/apache/datafusion/blob/408e1e4e2c46d673a067e05f3e363a6f51e641c4/docs/source/library-user-guide/extending-operators.md?plain=1#L32-L57

`,ignore` should also be trimmed out.

## What changes are included in this PR?

<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->

Fix regex used in trimming rust blocks to account for optional `ignore`.

## Are these changes tested?

<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->

Tested locally:

<img width="791" height="441" alt="image"
src="https://github.com/user-attachments/assets/ff679228-812a-47d5-876e-6fc8fb552bed"
/>

<img width="762" height="681" alt="image"
src="https://github.com/user-attachments/assets/7c551441-3579-4f65-bf41-325ac81fcc76"
/>

Existing blocks (with only `rust` and not `rust,ignore`) unaffected,
e.g. in catalogs page:

<img width="764" height="543" alt="image"
src="https://github.com/user-attachments/assets/c18376d5-974c-4510-89e4-4c777c860ca0"
/>


## Are there any user-facing changes?

<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.
-->

No, doc changes.

<!--
If there are any breaking changes to public APIs, please add the `api
change` label.
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants