`get_dataframe_report()` raises TypeError when a step has `columns_subset` (rows_distinct, rows_complete)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
- #446 by @manan28025 — closed without merging
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Start in get_dataframe_report() and inspect the pl_schema definition for the column field, then trace how rows_distinct() and rows_complete() with columns_subset= populate validation_info[i].column. Reproduce with the supplied example and check the report’s column values for both subset steps after the change; the report should build without a TypeError and retain the selected column names.
Written by the indexing model from the issue text.
Description
Description
Validate.get_dataframe_report() fails with a Polars TypeError as soon as the plan contains a step whose column is a list, i.e. rows_distinct() or rows_complete() with columns_subset=. The whole report is lost, not just that step.
Reproducer
import polars as pl
import pointblank as pb
df = pl.DataFrame({"a": [1, 2, 2], "b": ["x", "y", None]})
pb.Validate(df).rows_distinct().interrogate().get_dataframe_report() # OK
pb.Validate(df).rows_distinct(columns_subset=["a"]).interrogate().get_dataframe_report()
Error:
TypeError: unexpected value while building Series of type String; found value of type List(String): ["a"]
Hint: Try setting `strict=False` to allow passing data with mixed types.
Same result with rows_distinct(columns_subset=["a", "b"]) and rows_complete(columns_subset=["a", "b"]). Steps where columns= is a list (e.g. col_vals_gt(columns=["a"])) are fine, since they are expanded into one step per column.
Reproduced on 0.24.0 (where the method was added in #341), 0.27.0 and 1.0.1.
Cause
In get_dataframe_report(), the Polars schema declares the column field as a string (line 21497 on main at 4510729):
pl_schema = pl.Schema(
{
...
"column": pl.String,
...
}
)
For rows_distinct() / rows_complete() with columns_subset=, validation_info[i].column is a list of names, so pl.DataFrame(data=final_report, schema=pl_schema) fails.
Possible fix
Normalize list values before building the frame, e.g. join them into a string ("a, b"), which keeps columns a String column for every step. Alternatively declare it as pl.List(pl.String) and wrap single names in a list, though that changes the column type for all users.
Environment
- pointblank 1.0.1
- polars 1.38.1
- Python 3.12.7
- Linux
Found while using pointblank in fauxdata.
- Dominant language
- Python
- Stars
- 493
- Forks
- 34
- Avg merge
- 14h 29m
- Merged PRs (30d)
- 15
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from posit-dev/pointblank
-
Type: ★ Enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
posit-dev/pointblank#379 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 69/100
posit-dev/pointblank#441 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
posit-dev/pointblank#395 ·
Maintainers usually reply within 1 day
-
Type: ★ Enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
posit-dev/pointblank#394 ·
Maintainers usually reply within 1 day
-
ibis.pyspark col_vals_in_set produces invalid SQLMay be free again @rich-iannone claimed this 294 days ago, and no pull request is open. OpenDifficulty: [2] Intermediate Effort: [3] High Priority: [3] High Type: ☹︎ Bug
posit-dev/pointblank#335 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
All issues in posit-dev/pointblank
Similar issues
-
SSM GetParameter throttling during concurrent workflow launchesPossibly taken @alexiswl claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
-
[Bug] Dev image build fails: `npm install` in the root Dockerfile runs out of memory (exit 134)Possibly taken @andest01 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Rename FunctionalRole BOT_DEV to DEV_STAFFPossibly taken A pull request linked to this issue is open or already merged. Openenhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
pesu-dev/discord_bot#97 ·
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
gradio-app/gradio#13964 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 93/100
BSData/horus-heresy-3rd-edition#3232 · 1 comment ·
Maintainers usually reply within 1 day