Skip to content

Conversation

@MarcoGorelli
Copy link
Member

closes #2340

What type of PR is this? (check all applicable)

  • πŸ’Ύ Refactor
  • ✨ Feature
  • πŸ› Bug Fix
  • πŸ”§ Optimization
  • πŸ“ Documentation
  • βœ… Test
  • 🐳 Other

Related issues

  • Related issue #<issue number>
  • Closes #<issue number>

Checklist

  • Code follows style guide (ruff)
  • Tests added
  • Documented the changes

If you have comments or can explain your changes, please do so below

@MarcoGorelli MarcoGorelli marked this pull request as ready for review April 4, 2025 15:32
@MarcoGorelli MarcoGorelli added the enhancement New feature or request label Apr 4, 2025
items: Iterable[LazyFrame[IntoFrameT]],
*,
how: Literal["horizontal", "vertical", "diagonal"] = "vertical",
how: Literal["vertical", "diagonal"] = "vertical",
Copy link
Member

Choose a reason for hiding this comment

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

Did you mean to change the signature only in v1?

Copy link
Member Author

Choose a reason for hiding this comment

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

nope, thanks πŸ˜„ will fix later

@MarcoGorelli MarcoGorelli marked this pull request as draft April 4, 2025 17:01
@MarcoGorelli MarcoGorelli marked this pull request as ready for review April 5, 2025 08:18
@dangotbanned
Copy link
Member

@MarcoGorelli do we want a signature like this?

#2339 (comment)

And maybe one or more typing tests to validate we get a new warning from mypy?

Copy link
Member

@FBruzzesi FBruzzesi left a comment

Choose a reason for hiding this comment

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

Thanks @MarcoGorelli, it looks good πŸ₯¦

It might be worth updating Perfect backwards compatibility policy#breaking changes section to mention that horizontal concatenation is no longer supported for lazy frame

@dangotbanned dangotbanned changed the title feat: disallow how=horizontal for lazy concat feat!: disallow concat(..., how="horizontal") for LazyFrame Apr 8, 2025
Comment on lines 16 to 19
pytest.skip(
reason="https://github.com/narwhals-dev/narwhals/issues/2348", allow_module_level=True
)

Copy link
Member

Choose a reason for hiding this comment

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

@MarcoGorelli if this cleans up CI (and you're not planning to merge this PR today) could you split the fix into a tiny PR please? πŸ™

Copy link
Member

Choose a reason for hiding this comment

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

I'm always worried I'll miss something when there's existing CI issues

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Ah maybe an xfail will save us from narwhals-dev/narwhals/actions/runs/14376119881/job/40308843895?pr=2341

It did 😁 (ee52813)

Comment on lines +16 to +17
xfail_hist = pytest.mark.xfail(
reason="https://github.com/narwhals-dev/narwhals/issues/2348", strict=False
Copy link
Member

Choose a reason for hiding this comment

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

  • I used this on every test to mimic what skip was doing
  • No idea which one(s) was causing the failures

Copy link
Member

@dangotbanned dangotbanned left a comment

Choose a reason for hiding this comment

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

Good call on this one @MarcoGorelli

Thanks for working on it

Comment on lines -178 to -195
if how == "horizontal":
all_column_names: list[str] = [
column for frame in dfs for column in frame.columns
]
if len(all_column_names) != len(set(all_column_names)): # pragma: no cover
duplicates = [
i for i in all_column_names if all_column_names.count(i) > 1
]
msg = (
f"Columns with name(s): {', '.join(duplicates)} "
"have more than one occurrence"
)
raise AssertionError(msg)
return DaskLazyFrame(
dd.concat(dfs, axis=1, join="outer"),
backend_version=self._backend_version,
version=self._version,
)
Copy link
Member

Choose a reason for hiding this comment

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

Beautiful 😍

@MarcoGorelli
Copy link
Member Author

thanks all for reviews! i'm a little short on time, will ship this as-is then and we can improve the overloads separately

@MarcoGorelli MarcoGorelli merged commit 7ae5a8c into narwhals-dev:main Apr 10, 2025
28 of 29 checks passed
@MarcoGorelli
Copy link
Member Author

It might be worth updating Perfect backwards compatibility policy#breaking changes section to mention that horizontal concatenation is no longer supported for lazy frame

sorry, forgot to reply - I didn't add it there because we're not preserving this behaviour in v1, as it was buggy to begin with (Dask and Polars didn't do the same thing)

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

Labels

breaking enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

disallow concat(how='horizontal') for lazyframes

3 participants