Skip to content

Conversation

@max-muoto
Copy link
Contributor

@max-muotomax-muoto commented Jun 23, 2024

Fix issues detailed in #12141.

@max-muotomax-muoto changed the title feat: Improve/fix sqlite aggregration protocolsFix SQLite Aggregation ProtocolsJun 23, 2024
@github-actions

This comment has been minimized.

@max-muotomax-muoto marked this pull request as ready for review June 23, 2024 19:34
@github-actions

This comment has been minimized.

@max-muotomax-muoto marked this pull request as draft June 23, 2024 20:04
deffinalize(self) ->_SQLType: ...

class_WindowAggregateClass(Protocol):
step: Callable[..., object]
Copy link
ContributorAuthor

@max-muotomax-muotoJun 23, 2024

Choose a reason for hiding this comment

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

From testing things out, it doesn't seem this protocol really works as intended in either MyPy or Pyright. Unless you actually were annotating a lambda perhaps. Due to this, I went ahead and removed it.

Some examples of how it might not work as you would expect:

Pyright Playground

MyPy Playground

Copy link
Collaborator

Choose a reason for hiding this comment

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

This has been part of the initial commit in #7625, while the other protocols already used a function. Maybe @JelleZijlstra remembers why we used an attribute instead of a function here?

Copy link
Member

Choose a reason for hiding this comment

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

I don't really remember what I was thinking when I wrote that code, but the annotations proposed in this PR mean that protocol implementations must take *args. I am not familiar with how these things are used, but I'd expect concrete implementations to only accept a fixed number of parameters. Maybe that's why I chose to use Callable[....

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I tried messing around with TypeVarTuples to do that, but had some issues there as well, there might not be a great way, but I'll see if I can figure something out.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@alex
Copy link
Member

alex commented Aug 17, 2025

Is there a reason this was closed?

Sign up for freeto 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

@max-muoto@alex@srittau@JelleZijlstra