Commit 5154585
filterblock: Don't break when filtering on unexpected data
The previous code in this block did filtering assuming that all
samples had a value that was correct for the type. For example, when
filtering on an integer value, it assumed every row had a valid
integer, where it may instead have garbage.
This change introduces a new helper, _convert_dtype(), which properly
handles this condition. When the conversion fails on a `ValueError`
exception, it treats it as `None` instead of allowing the exception to
be raised up to the caller.
The fix was authored by Shiv in PR instructlab#72. I only pulled it out into a
standalone commit.
Signed-off-by: Russell Bryant <[email protected]>
Co-authored-by: shiv <[email protected]>1 parent 5bff598 commit 5154585
1 file changed
+11
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
23 | 33 | | |
24 | 34 | | |
25 | 35 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 36 | + | |
30 | 37 | | |
31 | 38 | | |
32 | 39 | | |
| |||
0 commit comments