Skip to content
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

Prepare function guidelines #23291

Merged
merged 1 commit into from
Sep 5, 2024
Merged

Prepare function guidelines #23291

merged 1 commit into from
Sep 5, 2024

Conversation

elharo
Copy link
Contributor

@elharo elharo commented Jul 24, 2024

Description

Elucidate what functions do and don't belong in core

Motivation and Context

Mutliple PRs have been proposing individual functions for very specific purposes without taking a holistic view of what Presto's function library should look like.

Impact

none

Test Plan

CI

Contributor checklist

  • Please make sure your submission complies with our development, formatting, commit message, and attribution guidelines.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

== NO RELEASE NOTE ==

@tdcmeehan tdcmeehan self-assigned this Jul 24, 2024
@elharo elharo marked this pull request as ready for review August 13, 2024 18:17
@elharo elharo requested review from steveburnett and a team as code owners August 13, 2024 18:17
@elharo elharo requested a review from presto-oss August 13, 2024 18:17
Copy link
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

Thanks for this! A few minor nits.

Suggest considering where to link to this new document from - maybe add a link to FUNCTIONS.md to CONTRIBUTING.md, or to the Presto Development Guidelines.

Perhaps the contents of this document could be a new section in the Presto Development Guidelines.

Copy link
Contributor

@tdcmeehan tdcmeehan left a comment

Choose a reason for hiding this comment

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

This looks good to me, except I would mention that we shouldn't be adding "core" SQL-defined functions. Those should go in optional modules.

FUNCTIONS.md Outdated

Presto also includes extension functions that can optionally be enabled in particular deployments.

Finally, Presto allows users to write user defined functions (UDFs) in either Java or SQL that are not stored in this GitHub repository.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Finally, Presto allows users to write user defined functions (UDFs) in either Java or SQL that are not stored in this GitHub repository.
Finally, Presto allows users to write user defined functions (UDFs) in either Java or SQL that are not stored in this GitHub repository. [This is done through the Plugin SPI.](https://prestodb.io/docs/current/develop/functions.html)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

steveburnett
steveburnett previously approved these changes Aug 16, 2024
Copy link
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

LGTM! (docs)

FUNCTIONS.md Outdated

Presto includes a large library of built-in, core SQL functions such as AVG and CONCAT that are available in every deployment.

Presto also includes extension functions that are not enabled by default but can be optionally enabled in particular deployments.
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 great to have an example of these.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed. Anyone happen to know of any? I'll look in the code, but if anyone can point to one it would save me a bit of time

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this is implicit in the fact that functions are a part of the Plugin interface. The way to "enable" functions is to add the plugins. I don't think there's really any examples of functions that are enabled via a toggle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

rewritten

@elharo elharo force-pushed the fx branch 5 times, most recently from 3fd0b1a to a9f69af Compare August 22, 2024 12:19
tdcmeehan
tdcmeehan previously approved these changes Aug 22, 2024
Copy link
Contributor

@tdcmeehan tdcmeehan left a comment

Choose a reason for hiding this comment

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

Thanks for writing this up @elharo!

@tdcmeehan
Copy link
Contributor

One thing just occurred to me, we should probably link to this document from CONTRIBUTING.

@elharo
Copy link
Contributor Author

elharo commented Aug 22, 2024

One thing just occurred to me, we should probably link to this document from CONTRIBUTING.

sure, let me figure out links work in markdown

tdcmeehan
tdcmeehan previously approved these changes Aug 22, 2024
FUNCTIONS.md Outdated

Built-in functions that extend Presto into new domains should have a detailed plan and ideally an implementation for a library of functions that cover the domain. For instance, a function that only added US dollars would not be accepted. However, a general library for working with currency data along the lines of [Joda-Money](https://www.joda.org/joda-money/) could be considered. It can be helpful to prototype complex functionality like this in UDFs before writing an RFC and submitting it to the Presto project.

Built-in and extension functions bundled with Presto must be freely available without fee and compatible with the Presto license. Functions using algorithms that are in any way restricted by copyright, patent, trademark, field of use, or other reasons will not be included in this repository. For instance, a patented video CODEC cannot be used. Functions that include trademarked names should be UDFs outside this repository.
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no Presto license.

Suggested change
Built-in and extension functions bundled with Presto must be freely available without fee and compatible with the Presto license. Functions using algorithms that are in any way restricted by copyright, patent, trademark, field of use, or other reasons will not be included in this repository. For instance, a patented video CODEC cannot be used. Functions that include trademarked names should be UDFs outside this repository.
Built-in and extension functions bundled with Presto must be freely available without fee and compatible with an Apache license. Functions using algorithms that are in any way restricted by copyright, patent, trademark, field of use, or other reasons will not be included in this repository. For instance, a patented video CODEC cannot be used. Functions that include trademarked names should be UDFs outside this repository.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor Author

@elharo elharo left a comment

Choose a reason for hiding this comment

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

PTAL @tdcmeehan I think your comments are addressednow

@elharo elharo merged commit 6f28f37 into master Sep 5, 2024
56 checks passed
@elharo elharo deleted the fx branch September 5, 2024 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants