Repository navigation
Fix IterableDataset.add_column error for short columns - #9305
mertkayacs wants to merge 2 commits into
Conversation
atishay-kasliwal
left a comment
There was a problem hiding this comment.
A short column now raises the new ValueError for from_dict and for a 3-shard from_generator dataset; master raised IndexError: list index out of range. An exact-length column gives the same rows as before across shards, and a longer one is still silently truncated, as the description says. Side note, same on master: add_column("b", [10, 20]).take(2) on a 3-row dataset also raises, so the third row is mapped before take stops.
|
Thanks for running these. The |
|
Thanks for checking this. I changed |
I found this while comparing
IterableDataset.add_columnwithDataset.add_column. The map-style API raisesValueErrorfor a row-count mismatch. With an iterable dataset, I reproduced anIndexErrorduring iteration when the new column was shorter than the dataset.I fixed the short-column case by checking the index before reading the value and raising a
ValueErrorwith the column name and length. Detecting extra values in a long column requires a dataset-wide exhaustion signal because a worker can exhaust its own shard while other shards still have rows.I verified the list and NumPy regression tests before and after the fix, ran the CPU unit tests in
tests/test_iterable_dataset.py, and ranmake quality.This touches the same lines in
add_column_fnas #8981. Whichever lands first, I will rebase the other side if needed.