Skip to content

Allow non-integer RANGE in OVER #12695

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

galloviolet
Copy link

Description

Fixes #12596.

This PR attempts to implement the solution described here, though there are some small differences since the version I was looking at there is 1.4, and this PR is for 2.0. I tried to update the tests to account for the changes, and was seeing them pass locally.

Let me know if there's anything I missed, and as always thanks for all your hard work.

Checklist

This pull request is:

  • A documentation / typographical / small typing error fix
    • Good to go, no issue or tests are needed
  • A short code fix
    • please include the issue number, and create an issue if none exists, which
      must include a complete example of the issue. one line code fixes without an
      issue and demonstration will not be accepted.
    • Please include: Fixes: #<issue number> in the commit message
    • please include tests. one line code fixes without tests will not be accepted.
  • A new feature implementation
    • please include the issue number, and create an issue if none exists, which must
      include a complete example of how the feature would look.
    • Please include: Fixes: #<issue number> in the commit message
    • please include tests.

Have a nice day!

@CaselIT
Copy link
Member

CaselIT commented Jun 24, 2025

Hi,

Given a quick glance, it looks ok, thanks.
Could you add a test using a range that's not numeric? I'll suggest where it could be added later

@CaselIT
Copy link
Member

CaselIT commented Jun 24, 2025

places were we could use a test:

@galloviolet galloviolet force-pushed the fractional-window-frame-values branch from 00afd4f to a779c37 Compare June 24, 2025 19:59
@galloviolet
Copy link
Author

places were we could use a test:

Added in 00afd4f.

Some problems I noticed:

  • I'd really like to be completely type agnostic, allowing for example interval ranges, but I haven't found a correct way to handle _type on the literal in _FrameClause.__init__ in that case.
  • I'd prefer to have a separate parameter saying whether each end of the range is PRECEDING or FOLLOWING, but I didn't want to make that large of a change. This would allow types that don't have a concept of "greater than" or "less than" zero... although I'm not actually sure whether any dialect allows them in RANGE.
  • I couldn't think of any valid "BETWEEN 'a' PRECEDING and 'e' FOLLOWING"-type syntax, so I used Float rather than string.

@galloviolet
Copy link
Author

Any input on my comments above? Alternatively, what do you all think about merging the changes as-is to at least handle fractional numeric values?

@CaselIT
Copy link
Member

CaselIT commented Jul 2, 2025

sorry, haven't had time to re-look at this. I'll make it run the full ci at least

@CaselIT CaselIT requested a review from sqla-tester July 2, 2025 21:36
Copy link
Collaborator

@sqla-tester sqla-tester left a comment

Choose a reason for hiding this comment

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

OK, this is sqla-tester setting up my work on behalf of CaselIT to try to get revision a779c37 of this pull request into gerrit so we can run tests and reviews and stuff

@sqla-tester
Copy link
Collaborator

New Gerrit review created for change a779c37: https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/6022

@zzzeek zzzeek requested a review from sqla-tester July 9, 2025 22:09
Copy link
Collaborator

@sqla-tester sqla-tester left a comment

Choose a reason for hiding this comment

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

OK, this is sqla-tester setting up my work on behalf of zzzeek to try to get revision 897929e of this pull request into gerrit so we can run tests and reviews and stuff

@sqla-tester
Copy link
Collaborator

Patchset 897929e added to existing Gerrit review https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/6022

@zzzeek zzzeek requested a review from sqla-tester July 15, 2025 14:53
Copy link
Collaborator

@sqla-tester sqla-tester left a comment

Choose a reason for hiding this comment

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

OK, this is sqla-tester setting up my work on behalf of zzzeek to try to get revision c373341 of this pull request into gerrit so we can run tests and reviews and stuff

@sqla-tester
Copy link
Collaborator

Patchset c373341 added to existing Gerrit review https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/6022

Copy link
Member

@zzzeek zzzeek left a comment

Choose a reason for hiding this comment

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

this is very good but needs a change in the test suite, thanks!

@zzzeek zzzeek requested a review from sqla-tester July 17, 2025 04:13
Copy link
Collaborator

@sqla-tester sqla-tester left a comment

Choose a reason for hiding this comment

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

OK, this is sqla-tester setting up my work on behalf of zzzeek to try to get revision 794e265 of this pull request into gerrit so we can run tests and reviews and stuff

@sqla-tester
Copy link
Collaborator

Patchset 794e265 added to existing Gerrit review https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/6022

@zzzeek zzzeek requested a review from sqla-tester July 17, 2025 16:39
Copy link
Collaborator

@sqla-tester sqla-tester left a comment

Choose a reason for hiding this comment

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

OK, this is sqla-tester setting up my work on behalf of zzzeek to try to get revision baa70bf of this pull request into gerrit so we can run tests and reviews and stuff

@sqla-tester
Copy link
Collaborator

Patchset baa70bf added to existing Gerrit review https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/6022

@zzzeek zzzeek requested a review from sqla-tester July 17, 2025 17:48
Copy link
Collaborator

@sqla-tester sqla-tester left a comment

Choose a reason for hiding this comment

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

OK, this is sqla-tester setting up my work on behalf of zzzeek to try to get revision 1bc7261 of this pull request into gerrit so we can run tests and reviews and stuff

@sqla-tester
Copy link
Collaborator

Patchset 1bc7261 added to existing Gerrit review https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/6022

@CaselIT CaselIT requested a review from sqla-tester July 31, 2025 08:05
Copy link
Collaborator

@sqla-tester sqla-tester left a comment

Choose a reason for hiding this comment

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

OK, this is sqla-tester setting up my work on behalf of CaselIT to try to get revision 8063cec of this pull request into gerrit so we can run tests and reviews and stuff

@sqla-tester
Copy link
Collaborator

Patchset 8063cec added to existing Gerrit review https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/6022

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.

RANGE in OVER is not an integer, it's whatever the ORDER BY column is
4 participants