-
Notifications
You must be signed in to change notification settings - Fork 170
chore: Align nw.concat(..., how="vertical") behavior across backend for schema mismatch
#3191
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
Draft
FBruzzesi
wants to merge
9
commits into
main
Choose a base branch
from
chore/vertical-concat-overhaul
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
752b79e
chore: Align vertical concat behavior
FBruzzesi 177c9f6
more uniform
FBruzzesi acd5b8e
old polars
FBruzzesi b1e4bd4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] b40ec01
formatting
FBruzzesi a09d3f7
formatting
FBruzzesi 275c0d7
old polars error message
FBruzzesi 3e543af
merge main, solve conflicts
FBruzzesi e01ae66
Merge branch 'main' into chore/vertical-concat-overhaul
FBruzzesi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2120,3 +2120,22 @@ def extend_bool( | |
| Stolen from https://github.com/pola-rs/polars/blob/b8bfb07a4a37a8d449d6d1841e345817431142df/py-polars/polars/_utils/various.py#L580-L594 | ||
| """ | ||
| return (value,) * n_match if isinstance(value, bool) else tuple(value) | ||
|
|
||
|
|
||
| def validate_concat_vertical_schemas(schemas: Iterable[Mapping[str, DType]]) -> None: | ||
| schemas_iter = iter(schemas) | ||
| schema_0 = next(schemas_iter) | ||
| for idx, schema_current in enumerate(schemas_iter, start=1): | ||
| if schema_0 != schema_current: | ||
| msg = ( | ||
| "'union'/'concat' inputs should all have the same schema,got\n" | ||
| f"{_pretty_format_schema(schema_0, index=0)}\n" | ||
| " and\n" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The space here is not a typo, that's what polars has π |
||
| f"{_pretty_format_schema(schema_current, index=idx)}" | ||
| ) | ||
| raise InvalidOperationError(msg) | ||
|
|
||
|
|
||
| def _pretty_format_schema(schema: Mapping[str, DType], index: int) -> str: | ||
| body = "\n".join(f"name: {name}, field: {field}" for name, field in schema.items()) | ||
| return f"Schema at index: {index}:\n{body}" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By passing an iterable, we can avoid to immediately evaluate all the schemas