tamnd / tamnd/firepanda

Six raises carry the wrong kind, so the except clause around them does not fire

Open
#410 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Mojo
Stars
1
Forks
0
Avg merge
1h 31m
Merged PRs (30d)
640

Description

Found by firepanda-compat once L4 started reaching the library. Companion to the message wording issue; these are worse, because a wrong message is a bad afternoon and a wrong class is a process that dies.

`errors/compare-unordered-categorical` raises `InvalidArgumentError`, which is a `ValueError`. pandas raises `TypeError`, and it is a `TypeError` for a reason: comparing two unordered categoricals with `<` is not a bad value, it is an operation that does not exist for that type. Same for `errors/fillna-unknown-category` on both the ordered and unordered frames, where filling with a value outside the categories is refused by pandas as a `TypeError`.

`errors/nonexistent-time` and `errors/ambiguous-time` raise `DTypeError`, which is our `TypeError`. pandas raises `ValueError` for both, and pandas is right: `2:30am` on a spring forward day is a well typed argument that does not name a real instant, which is a value problem and not a type problem. These two are our tagging going the wrong way across the same line the other four cross.

`errors/bad-interpolation` and `errors/quantile-on-boolean` raise `NotImplementedError`. That is the honest answer for a method nobody has written yet and the wrong answer for a method that is written and is refusing its argument. `interpolate(method="not a method")` is a `ValueError` and `quantile` on a boolean column is a `TypeError`, and in both cases the method exists and ran far enough to reject something.

The fix is the tag on each raise, so `VALUE` where the argument is well typed and wrong, and `DTYPE` where the type is the problem. The two `NotImplementedError` cases also need whatever is currently short circuiting to the unsupported path to stop doing that once the argument check runs first.

Acceptance is a compat run where those six L4 runs go from fail to pass with no other run changing, plus a Mojo test per raise pinning the kind, because a kind that is not asserted anywhere will drift back.

Contributor guide

Open the contributing guide

Research direction

Inspect the six named cases under errors/ and trace the current exception raises, including the unsupported paths for bad interpolation and boolean quantile. Run the affected L4 compat cases, then add a Mojo test per raise asserting its kind. Done means all six L4 runs pass with no other run changing and the new tests pin the exception kinds.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas
Domain
data-engineering, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.