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

feat: add arithmetic function "power" with decimal type #660

Merged
merged 1 commit into from
Aug 6, 2024

Conversation

anshuldata
Copy link
Contributor

Thank you for submitting a PR!

Before you continue, please ensure that your PR title and description (this message!) follow conventional commit syntax. Substrait uses an automated release process that, among other things, uses PR titles & descriptions to build a changelog, so the syntax and format matter!

The title of the PR should be a valid commit header.

Some examples of proper commit message headers and PR titles:

  • feat: add feature X
  • fix: X in case of Y
  • docs: improve documentation for X

Note the case and grammar conventions.

Furthermore, the description of any PR that includes a breaking change should contain a paragraph that starts with BREAKING CHANGE: ..., where ... explains what changed. The automated release process uses this to determine how it should bump the version number. Anything that changes the behavior of a plan that was previously legal is considered a breaking change; note that this includes behavior specifications that only exist in Substrait in the form of behavior descriptions on the website or in comments.

@CLAassistant
Copy link

CLAassistant commented Jul 9, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

github-actions bot commented Jul 9, 2024

ACTION NEEDED

Substrait follows the Conventional Commits
specification
for
release automation.

The PR title and description are used as the merge commit message. Please update your PR title and description to match the specification.

@anshuldata anshuldata changed the title feat: Add arithmetic function with decimal type feat: add arithmetic function with decimal type Jul 9, 2024
extensions/functions_arithmetic_decimal.yaml Outdated Show resolved Hide resolved
extensions/functions_arithmetic_decimal.yaml Outdated Show resolved Hide resolved
options:
overflow:
values: [ SILENT, SATURATE, ERROR ]
return: "DECIMAL<P,S>"
Copy link
Member

Choose a reason for hiding this comment

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

Will the precision and scale stay the same as a result of this operation or do we need to extend it? I suppose overflow is quickly likely so it's not a big deal if we don't rescale.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

max it will be Decimal(37, S), which supports factorial of max 33 (verified in duckdb and Snowflake). In both these engines type of return datatype was max size and didn't depend on input size. So I made it Decimal(38, S)

extensions/functions_arithmetic_decimal.yaml Outdated Show resolved Hide resolved
EpsilonPrime
EpsilonPrime previously approved these changes Jul 16, 2024
@anshuldata anshuldata force-pushed the anshul/AddDecimalArthFuncs branch from 16611b3 to 4eae92a Compare July 16, 2024 07:43
@anshuldata
Copy link
Contributor Author

@EpsilonPrime I don't have write access to branch. Can you kindly merge ?
Thanks

@EpsilonPrime
Copy link
Member

As this PR is somewhere between a new feature and a change to an existing one I'd like to get another approval for this PR before we merge it. I'll check with the other folks at the Substrait community meeting on Wednesday and will likely merge it then.

Copy link
Contributor

@jacques-n jacques-n left a comment

Choose a reason for hiding this comment

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

I don't think the precision/scale handling is correct here.

extensions/functions_arithmetic_decimal.yaml Outdated Show resolved Hide resolved
extensions/functions_arithmetic_decimal.yaml Outdated Show resolved Hide resolved
jacques-n
jacques-n previously approved these changes Jul 31, 2024
Copy link
Contributor

@jacques-n jacques-n left a comment

Choose a reason for hiding this comment

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

This lgtm. @EpsilonPrime ?

@jacques-n
Copy link
Contributor

@anshuldata can you rebase?

@anshuldata
Copy link
Contributor Author

@anshuldata can you rebase?

rebased it

@anshuldata anshuldata force-pushed the anshul/AddDecimalArthFuncs branch from 9af8451 to 951647c Compare August 2, 2024 05:15
@anshuldata anshuldata changed the title feat: add arithmetic function with decimal type feat: add arithmetic function "power" with decimal type Aug 2, 2024
@jacques-n jacques-n merged commit 9af2d66 into substrait-io:main Aug 6, 2024
15 checks passed
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