-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
fix(rust): Prevent recursive AlreadyEncountered error formatting #12097
Conversation
Thanks. Can you add a test on the python side? |
I am not sure how to test this on the python side. I only use the Rust interfaces personally, so there may be something I am missing. The same test case does not work for python because it collects more aggressively. Internally, it looks like all of the python interfaces prevent optimizations and recursive error formatting by import polars as pl
def cool_stuff(lf):
return (
lf.select([pl.col("foo"), pl.col("bar")])
.filter(pl.col("foo") > pl.col("bar"))
.sort("a")
)
df = pl.DataFrame({"a": [1, 2, 3], "b": [1, 2, 3]})
n = 10
for _ in range(n):
df = cool_stuff(df)
|
You must work on df = pl.LazyFrame({"a": [1, 2, 3], "b": [1, 2, 3]}) And then you can test the python error message as string format. |
I think this is ready for review again. Noticeably, i hit an issue running python locally tests that seems to be known: #11251 (comment) While this CI suite passes, it fails on local mac without disabling those panic tests. That seems to be related to handling panic handling in the python test runner. |
Fixes #8277
Successfully returns error messages with N=100 in debug.
Error message example with N=4 from the reproduction
thread 'main' panicked at 'called
Result::unwrap()
on anErr
value: ColumnNotFound(ErrString("foo\n\nError originated just after this operation:\nDF ["a"]; PROJECT */1 COLUMNS; SELECTION: "None"\n\nError originated just after this operation:\nFILTER [(col("foo")) > (col("bar"))] FROM\nErrorStateSync(AlreadyEncountered(not found: foo\n\nError originated just after this operation:\nDF ["a"]; PROJECT */1 COLUMNS; SELECTION: "None"))\nDF ["a"]; PROJECT */1 COLUMNS; SELECTION: "None"\n\nError originated just after this operation:\nErrorStateSync(Multiple AlreadyEncountered)\nFILTER [(col("foo")) > (col("bar"))] FROM\nErrorStateSync(AlreadyEncountered(not found: foo\n\nError originated just after this operation:\nDF ["a"]; PROJECT */1 COLUMNS; SELECTION: "None"))\nDF ["a"]; PROJECT */1 COLUMNS; SELECTION: "None"\n\nError originated just after this operation:\nFILTER [(col("foo")) > (col("bar"))] FROM\nErrorStateSync(Multiple AlreadyEncountered)\nErrorStateSync(Multiple AlreadyEncountered)\nFILTER [(col("foo")) > (col("bar"))] FROM\nErrorStateSync(AlreadyEncountered(not found: foo\n\nError originated just after this operation:\nDF ["a"]; PROJECT */1 COLUMNS; SELECTION: "None"))\nDF ["a"]; PROJECT */1 COLUMNS; SELECTION: "None"\n\nError originated just after this operation:\nErrorStateSync(Multiple AlreadyEncountered)\nFILTER [(col("foo")) > (col("bar"))] FROM\nErrorStateSync(Multiple AlreadyEncountered)\nErrorStateSync(Multiple AlreadyEncountered)\nFILTER [(col("foo")) > (col("bar"))] FROM\nErrorStateSync(AlreadyEncountered(not found: foo\n\nError originated just after this operation:\nDF ["a"]; PROJECT */1 COLUMNS; SELECTION: "None"))\nDF ["a"]; PROJECT */1 COLUMNS; SELECTION: "None"\n\nError originated just after this operation:\nFILTER [(col("foo")) > (col("bar"))] FROM\nErrorStateSync(Multiple AlreadyEncountered)\nErrorStateSync(Multiple AlreadyEncountered)\nFILTER [(col("foo")) > (col("bar"))] FROM\nErrorStateSync(Multiple AlreadyEncountered)\nErrorStateSync(Multiple AlreadyEncountered)\nFILTER [(col("foo")) > (col("bar"))] FROM\nErrorStateSync(AlreadyEncountered(not found: foo\n\nError originated just after this operation:\nDF ["a"]; PROJECT */1 COLUMNS; SELECTION: "None"))\nDF ["a"]; PROJECT */1 COLUMNS; SELECTION: "None"\n\nError originated just after this operation:\nErrorStateSync(Multiple AlreadyEncountered)\nFILTER [(col("foo")) > (col("bar"))] FROM\nErrorStateSync(Multiple AlreadyEncountered)\nErrorStateSync(Multiple AlreadyEncountered)\nFILTER [(col("foo")) > (col("bar"))] FROM\nErrorStateSync(Multiple AlreadyEncountered)\nErrorStateSync(Multiple AlreadyEncountered)\nFILTER [(col("foo")) > (col("bar"))] FROM\nErrorStateSync(AlreadyEncountered(not found: foo\n\nError originated just after this operation:\nDF ["a"]; PROJECT */1 COLUMNS; SELECTION: "None"))\nDF ["a"]; PROJECT */1 COLUMNS; SELECTION: "None"\n\nError originated just after this operation:\nFILTER [(col("foo")) > (col("bar"))] FROM\nErrorStateSync(Multiple AlreadyEncountered)\nErrorStateSync(Multiple AlreadyEncountered)\nFILTER [(col("foo")) > (col("bar"))] FROM\nErrorStateSync(Multiple AlreadyEncountered)\nErrorStateSync(Multiple AlreadyEncountered)\nFILTER [(col("foo")) > (col("bar"))] FROM\nErrorStateSync(Multiple AlreadyEncountered)\nErrorStateSync(Multiple AlreadyEncountered)\nFILTER [(col("foo")) > (col("bar"))] FROM\nErrorStateSync(AlreadyEncountered(not found: foo\n\nError originated just after this operation:\nDF ["a"]; PROJECT */1 COLUMNS; SELECTION: "None"))\nDF ["a"]; PROJECT */1 COLUMNS; SELECTION: "None""))', src/main.rs:17:26