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: Windowing/aggregating over literals #9773

Open
1 task done
TrevorBergeron opened this issue Aug 5, 2024 · 2 comments
Open
1 task done

feat: Windowing/aggregating over literals #9773

TrevorBergeron opened this issue Aug 5, 2024 · 2 comments
Labels
feature Features or general enhancements

Comments

@TrevorBergeron
Copy link

Is your feature request related to a problem?

No response

What is the motivation behind your request?

I'm a developer of BigQuery Dataframes . I would like to programatically build SQL queries using ibis. It is challenging to build compact sql involving windows over constant expressions, as the ibis literal API does not allow building of windowed expressions over literals, despite this being legal in GoogleSql.

Right now, I'm forced to select the literal, and then apply the window afterwards, generating a new CTE, and therefore producing more verbose SQL.

Describe the solution you'd like

I'd like to apply aggregate functions to literal expressions in the context of select. For example table.select(ibis.literal(3).sum().over(some_window)).

What version of ibis are you running?

8.0.0

What backend(s) are you using, if any?

BigQuery

Code of Conduct

  • I agree to follow this project's Code of Conduct
@TrevorBergeron TrevorBergeron added the feature Features or general enhancements label Aug 5, 2024
@cpcloud
Copy link
Member

cpcloud commented Aug 5, 2024

Yep, the ability to do things that are only allowed on columns currently, but on scalars, comes up sometimes.

This seems like a reasonable request to me.

Implementation wise, it'll probably involve moving a handful of methods into the base Value class.

@cpcloud
Copy link
Member

cpcloud commented Aug 7, 2024

@TrevorBergeron Do you have an example that demonstrates the difference in output SQL? It'd be good to know just how much worse it is before we go down this path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Features or general enhancements
Projects
Status: backlog
Development

No branches or pull requests

2 participants