Skip to content

Updated extending operators documentation #15612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 12, 2025
Merged

Updated extending operators documentation #15612

merged 3 commits into from
May 12, 2025

Conversation

the0ninjas
Copy link
Contributor

Which issue does this PR close?

What changes are included in this PR?

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Apr 7, 2025
@the0ninjas
Copy link
Contributor Author

@alamb - Since I'm first-time contributor, could you help trigger the CI please?

@Max-Meldrum
Copy link
Contributor

Seems like it is actually trying to compile the doctest code. If this isn't required then perhaps a no_run is in order?

@alamb
Copy link
Contributor

alamb commented Apr 8, 2025

Seems like it is actually trying to compile the doctest code. If this isn't required then perhaps a no_run is in order?

Yes, we run all the examples in the doc tests -- instructions for doing so locally are here

// Instructions for Documentation Examples
//
// The following commands test the examples from the user guide as part of
// `cargo test --doc`
//
// # Adding new tests:
//
// Simply add code like this to your .md file and ensure your md file is
// included in the lists below.
//
// ```rust
// <code here will be tested>
// ```
//
// Note that sometimes it helps to author the doctest as a standalone program
// first, and then copy it into the user guide.
//
// # Debugging Test Failures
//
// Unfortunately, the line numbers reported by doctest do not correspond to the
// line numbers of in the .md files. Thus, if a doctest fails, use the name of
// the test to find the relevant file in the list below, and then find the
// example in that file to fix.
//
// For example, if `user_guide_expressions(line 123)` fails,
// go to `docs/source/user-guide/expressions.md` to find the relevant problem.

The idea is to ensure that the examples in the docs do not drift apart from reality

@alamb alamb marked this pull request as draft April 8, 2025 16:57
@alamb
Copy link
Contributor

alamb commented Apr 8, 2025

Thank you for this contribution @the0ninjas and the hints @Max-Meldrum

I am marking the PR as draft while we work on getting the CI passing. Then please mark it ready for review again!

@Max-Meldrum
Copy link
Contributor

Seems like it is actually trying to compile the doctest code. If this isn't required then perhaps a no_run is in order?

Yes, we run all the examples in the doc tests -- instructions for doing so locally are here

// Instructions for Documentation Examples
//
// The following commands test the examples from the user guide as part of
// `cargo test --doc`
//
// # Adding new tests:
//
// Simply add code like this to your .md file and ensure your md file is
// included in the lists below.
//
// ```rust
// <code here will be tested>
// ```
//
// Note that sometimes it helps to author the doctest as a standalone program
// first, and then copy it into the user guide.
//
// # Debugging Test Failures
//
// Unfortunately, the line numbers reported by doctest do not correspond to the
// line numbers of in the .md files. Thus, if a doctest fails, use the name of
// the test to find the relevant file in the list below, and then find the
// example in that file to fix.
//
// For example, if `user_guide_expressions(line 123)` fails,
// go to `docs/source/user-guide/expressions.md` to find the relevant problem.

The idea is to ensure that the examples in the docs do not drift apart from reality

Right, I see. The current example code is using stuff that is external to the Datafusion repo and is over at datafusion-uwheel.

For instance the try_rewrite function. What could be a good approach here?

@alamb
Copy link
Contributor

alamb commented Apr 17, 2025

For instance the try_rewrite function. What could be a good approach here?

One idea could be to bring some simplified version of this to the doc example, or maybe leave a link to the other repository

@alamb
Copy link
Contributor

alamb commented Apr 17, 2025

Another alternate to make the doc tests pass is to comment the code out, using

# /*
...
*/

For example, see

@Max-Meldrum
Copy link
Contributor

@the0ninjas

It should passes the test if ```rust,ignore is used instead. And we could link a reference to the external code https://github.com/uwheel/datafusion-uwheel

@the0ninjas the0ninjas marked this pull request as ready for review April 27, 2025 11:54
@Max-Meldrum
Copy link
Contributor

I believe this PR is now ready to be merged @alamb

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you @the0ninjas and @Max-Meldrum -- this is a very nice addition to the docs

@alamb alamb merged commit 547c4a7 into apache:main May 12, 2025
5 checks passed
@alamb
Copy link
Contributor

alamb commented May 12, 2025

Thanks again @Max-Meldrum @edmondop and @the0ninjas

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.

IDEA: Use one of the examples from Datafusion Blog 45 to complete custom logical plans/execution plans page
4 participants