Skip to content

Commit

Permalink
Adding @severo suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaFrancis committed Feb 2, 2023
1 parent 889be90 commit a89f65e
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,8 @@ def compute_first_rows_response(
If the post-processing of the split rows failed, e.g. while saving the images or audio files to the assets.
- [`~workers.first_rows.TooManyColumnsError`]
If the number of columns (features) exceeds the maximum supported number of columns.
- [`~workers.first_rows.TooBigContentError`]
If the first rows content exceeds the maximum supported size of bytes.
</Tip>
"""
logging.info(f"get first-rows for dataset={dataset} config={config} split={split}")
Expand Down Expand Up @@ -517,7 +519,8 @@ def compute_first_rows_response(
"rows": [],
}

if get_json_size(response_features_only) > rows_max_bytes:
surrounding_json_size = get_json_size(response_features_only)
if surrounding_json_size > rows_max_bytes:
raise TooBigContentError("The first rows content after truncation exceeds the maximum size.")

# get the rows
Expand Down Expand Up @@ -568,7 +571,6 @@ def compute_first_rows_response(
) from err

# truncate the rows to fit within the restrictions, and prepare them as RowItems
surrounding_json_size = get_json_size(response_features_only)
row_items = create_truncated_row_items(
rows=transformed_rows,
min_cell_bytes=min_cell_bytes,
Expand Down

0 comments on commit a89f65e

Please sign in to comment.