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

Add arithmetic ^ operator, ex: 2^3 = 8 #15630

Closed
surister opened this issue Feb 28, 2024 · 6 comments · Fixed by #15688
Closed

Add arithmetic ^ operator, ex: 2^3 = 8 #15630

surister opened this issue Feb 28, 2024 · 6 comments · Fixed by #15688
Assignees
Labels
contributions welcome enhancement Enhancement that doesn't fit into a more specific feature label. Try avoid using this good first issue tool: Tableau

Comments

@surister
Copy link
Contributor

surister commented Feb 28, 2024

Problem Statement

I don't know if this is already tracked/mentioned somewhere, I couldn't find any reference.

Currently we support the scalar function power(base, exponent) but we do not have the inline operator ^ so
select 2^3; fails. docs

It exists in PostgreSQL, so we can do stuff like:

select 0^2; -> 0
select 2^2^2^2; -> 65535

This breaks some required functionalities in Tableau.

Possible Solutions

No response

Considered Alternatives

No response

@surister surister changed the title Add arithmetic ^ operator, ex: 2^3 = 8 Add arithmetic ^ operator, ex: 2^3 = 8 Feb 28, 2024
@matriv matriv added enhancement Enhancement that doesn't fit into a more specific feature label. Try avoid using this good first issue contributions welcome labels Feb 29, 2024
@DHRUV6029
Copy link
Contributor

DHRUV6029 commented Mar 5, 2024

Hi, Can i work on this enhancement?

@BaurzhanSakhariev
Copy link
Contributor

Hi, Can i work on this enhancement?

Hi, sure, assigned it to you

@DHRUV6029
Copy link
Contributor

Hello ,
Just to Clarify , select 0^2; -> 1. should be 0 not 1, I checked in PostgreSQL it gives 0?

@DHRUV6029 DHRUV6029 mentioned this issue Mar 13, 2024
5 tasks
@BaurzhanSakhariev
Copy link
Contributor

yes, select 0^2 = 0

in general, 0^x = 0, x^0 = 1.

@surister
Copy link
Contributor Author

Hello , Just to Clarify , select 0^2; -> 1. should be 0 not 1, I checked in PostgreSQL it gives 0?

Yes, it's a typo my bad.

@BaurzhanSakhariev
Copy link
Contributor

one exception - 0^0 is 1.
It can be undefined in some software but at least it's like that in Postgres https://www.db-fiddle.com/f/drvR9EzyXrBcwgCi7XWbMv/0

@mergify mergify bot closed this as completed in #15688 Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributions welcome enhancement Enhancement that doesn't fit into a more specific feature label. Try avoid using this good first issue tool: Tableau
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants