Open AlexeyDmitriev opened 1 month ago
We are in the process catching those bugs earlier and making our IR more strict and correct.
The context examples you gave should check that the eventual expressions are elementwise. We will raise on those invalid expressions. Though I don't think we can handle it in the static type system (or want to).
Thanks for your feedback
My observation was that this is a common abstraction i.e. can be used in several places (also in users code as well) I'd say I'd prefer static type solution if it was feasible
You are indeed more in position to say whether it's easier to check that in runtime or type-checking time. Feel free to close the issue if the final decision is to leave things as is
Description
So, polars notably allows more types of expressions in select that is available in SQL. (example in tutorial)
However, there are a lot of places (for example
with_column
,join
,filter
,group_by
) that expect expressions that give exactly 1 value for each row of some df (otherwise operation doesn't make much sense). https://github.com/pola-rs/polars/issues/9603 is an example where wrong type of expression is used causes unexpected behaviourShould this special kind of expression be a separate type in APIs? (Where every OneToOneExpression (better name needed) is an Expr but not vice versa)