Skip to content

Conversation

@Jefffrey
Copy link
Contributor

Which issue does this PR close?

Rationale for this change

Updating documentation on adding new functions; aggregate instructions were old, and adding in other types too (window, table)

What changes are included in this PR?

Updated instructions for adding new functions to DataFusion. Also did some other touchups on the docs.

Are these changes tested?

Doc changes only.

Are there any user-facing changes?

Doc changes only.

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Oct 16, 2025
@Jefffrey Jefffrey marked this pull request as ready for review October 16, 2025 02:21
Comment on lines -156 to -166
## How to add/edit documentation for UDFs

Documentations for the UDF documentations are generated from code (related [github issue]). To generate markdown run `./update_function_docs.sh`.

This is necessary after adding new UDF implementation or modifying existing implementation which requires to update documentation.

```bash
./dev/update_function_docs.sh
```

[github issue]: https://github.com/apache/datafusion/issues/12740
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Decided to consolidate with the Adding new functions section above as it has same steps

- Scalar functions are further grouped into modules for families of functions (e.g. string, math, datetime).
Functions should be added to the relevant module; if a new module needs to be created then a new [Rust feature]
should also be added to allow DataFusion users to conditionally compile the modules as needed
- Aggregate functions can optionally implement a [`GroupsAccumulator`] for better performance
Copy link
Contributor

Choose a reason for hiding this comment

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

would be nice to add what exactly needed to implement from GroupsAccumulator to achieve performance

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I prefer to keep this to high level steps; ideally such details would be present in the GroupsAccumulator doc itself in my opinion

markdown document [here][fn-doc-home] (see the documents for [scalar][fn-doc-scalar],
[aggregate][fn-doc-aggregate] and [window][fn-doc-window] functions)

- You _should not_ manually update the markdown document after running the script as those manual
Copy link
Contributor

Choose a reason for hiding this comment

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

In fact the CI will also complain :)

## How to update protobuf/gen dependencies

The prost/tonic code can be generated by running `./regen.sh`, which in turn invokes the Rust binary located in `./gen`
For the `proto` and `proto-common` crates, the prost/tonic code is generated by running their respective `./regen.sh` scripts,
Copy link
Contributor

Choose a reason for hiding this comment

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

would be nice to provide relative path

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the sh block below 👍

Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

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

Thanks @Jefffrey

Jefffrey and others added 5 commits October 17, 2025 10:05
Co-authored-by: Oleks V <comphead@users.noreply.github.com>
Co-authored-by: Oleks V <comphead@users.noreply.github.com>
@Jefffrey Jefffrey requested a review from comphead October 23, 2025 01:06
Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

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

Thanks @Jefffrey

@Jefffrey Jefffrey added this pull request to the merge queue Oct 24, 2025
Merged via the queue into apache:main with commit fef3b71 Oct 24, 2025
5 checks passed
@Jefffrey Jefffrey deleted the update_howto_doc 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.
-->

- Closes apache#12220

## 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.
-->

Updating documentation on adding new functions; aggregate instructions
were old, and adding in other types too (window, table)

## 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.
-->

Updated instructions for adding new functions to DataFusion. Also did
some other touchups on the docs.

## Are these changes tested?

Doc changes only.

<!--
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)?
-->

## Are there any user-facing changes?

Doc changes only.

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

<!--
If there are any breaking changes to public APIs, please add the `api
change` label.
-->

---------

Co-authored-by: Oleks V <comphead@users.noreply.github.com>
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.

Contributor guide doesn't reflect refactoring in UDF

2 participants