Skip to content
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

Bugfix: indexed row major serialization fails with None cell values #1540

Merged
merged 3 commits into from
Jan 22, 2025

Conversation

yifanmai
Copy link
Collaborator

Previously, the indexed row major table serialization would fail if any cell values in the row were None with a stack trace like:

  File "/path/to/unitxt/struct_data_operators.py", line 95, in serialize
    return self.serialize_table(value)
  File "/path/to/unitxt/src/unitxt/struct_data_operators.py", line 133, in serialize_table
    serialized_tbl_str += self.process_row(row, row_index=i) + " "
  File "/path/to/unitxt/src/unitxt/struct_data_operators.py", line 149, in process_row
    serialized_row_str += " | ".join(row_cell_values)
TypeError: sequence item 2: expected str instance, NoneType found

This replaces the None values with the string "None", which is consistent with the other table serializers. An alternative would be to serialize them to the empty string "" instead, but this would be less consistent with the other table serializers.

@yifanmai yifanmai requested a review from ShirApp January 21, 2025 22:14
@elronbandel elronbandel merged commit 80a58bb into main Jan 22, 2025
15 of 16 checks passed
@elronbandel elronbandel deleted the yifanmai/fix-indexed-row-major-none branch January 22, 2025 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants