Skip to content

chore: simplify parsing expressions in group-by#3106

Merged
MarcoGorelli merged 11 commits intonarwhals-dev:mainfrom
MarcoGorelli:better-extract-compliant
Sep 8, 2025
Merged

chore: simplify parsing expressions in group-by#3106
MarcoGorelli merged 11 commits intonarwhals-dev:mainfrom
MarcoGorelli:better-extract-compliant

Conversation

@MarcoGorelli
Copy link
Member

@MarcoGorelli MarcoGorelli commented Sep 7, 2025

This had been annoying me for a while

We're using CompliantNamespace.parse_into_expr, which accepts Python scalars, in {DataFrame,LazyFrame}.{select,with_columns}, even though there we don't accept Python scalars

I think this simplifies things a little, and means we can do .alias within flatten_and_extract before going to the compliant level (which I think is not a bad thing, given that there we're still at the Narwhals level. this will also help in some follow-up / skunkworks)

@MarcoGorelli MarcoGorelli marked this pull request as ready for review September 7, 2025 19:45
@dangotbanned
Copy link
Member

dangotbanned commented Sep 7, 2025

Gotta say this has me pretty confused

This had been annoying me for a while

We're using CompliantNamespace.parse_into_expr,

I only added this 1 week ago and you approved it?

But this doesn't just revert that PR, it also goes in the opposite direction of what you said you wanted in

The purpose of CompliantNamespace.parse_into_expr was to stop calling so many private methods from the narwhals-level

Now, those methods both don't exist at the compliant-level and they're being called as if they did
So this seems like the worst of both worlds to me 🤔

@MarcoGorelli
Copy link
Member Author

Gotta say this has me pretty confused

This had been annoying me for a while

sorry the "for a while" was referring to the group-by logic not being able to re-use flatten_and_extract and repeating the same logic from select / with_columns

will iterate on this

@MarcoGorelli
Copy link
Member Author

Have corrected - it should now not be using anything non-compliant, right?

@MarcoGorelli MarcoGorelli merged commit 538973e into narwhals-dev:main Sep 8, 2025
32 of 33 checks passed
@dangotbanned
Copy link
Member

dangotbanned commented Sep 8, 2025

Have corrected - it should now not be using anything non-compliant, right?

I really would've liked a chance to review this.

CompliantExpr._from_series?

I've been waiting for reviews on PRs that have approval, but just not yours yet.

Rushing this through after I've objected (#3106 (comment)) to parts of it - and not letting me respond - makes me feel like my time isn't valued.
That stings especially hard, because the original PR only exists due to you asking for me to start that work (#2713 (comment))

@MarcoGorelli
Copy link
Member Author

CompliantExpr._from_series?

I'd say that it's EagerExpr._from_series which is being used, and only within EagerSeries? My understanding is that we're OK with those, as they represent a way to share code between the eager implementations

It's the purely Compliant classes we want to keep lean and stable

  • CompliantSeries
  • CompliantExpr
  • CompliantDataFrame
  • CompliantLazyFrame
  • CompliantNamespace

I'm really sorry to have hurt you here, and thank you for having told me, will make sure to wait in the future

MarcoGorelli added a commit that referenced this pull request Sep 8, 2025
MarcoGorelli added a commit that referenced this pull request Sep 8, 2025
Revert "chore: simplify parsing expressions in group-by (#3106)"

This reverts commit 538973e.
@MarcoGorelli
Copy link
Member Author

reverted and re-opened in #3110

@dangotbanned
Copy link
Member

I'm really sorry to have hurt you here, and thank you for having told me, will make sure to wait in the future

Thanks @MarcoGorelli, that really means a lot ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants