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

fix division by zero error #30

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions python/ray/data/datasource/parquet_base_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,15 @@ def _open_input_source(
# Parquet requires `open_input_file` due to random access reads
return filesystem.open_input_file(path, **open_args)

def calculate_nulls(self, table):
total = 0
null = 0
for column in table.columns:
null += column.null_count
total += len(column)

percent = (total - null) / total
def calculate_nulls(self, table):
total = 0
null = 0
for column in table.columns:
null += column.null_count
total += len(column)

if total == 0:
return

percent = (total - null) / total
self.null_count_metric.observe(percent)