astronomy-commons / hipscat-import

HiPSCat import - generate HiPSCat-partitioned catalogs
https://hipscat-import.readthedocs.io
BSD 3-Clause "New" or "Revised" License
5 stars 3 forks source link

Check the total number of rows throughout the catalog import pipeline #345

Closed delucchi-cmu closed 1 month ago

delucchi-cmu commented 1 month ago

Change Description

Closes #344

Solution Description

Adds a new argument, expected_total_rows, that users can specify if the total number of rows to be imported is known ahead of time. After the mapping stage, we check this against the total number of rows encountered.

Using the result from the mapping stage, we also check the total for the scheduled reducing stage as well.

Code Quality

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 99.72%. Comparing base (6c4451f) to head (079f804).

Files Patch % Lines
src/hipscat_import/catalog/run_import.py 85.71% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #345 +/- ## ========================================== - Coverage 99.79% 99.72% -0.07% ========================================== Files 26 26 Lines 1442 1452 +10 ========================================== + Hits 1439 1448 +9 - Misses 3 4 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

delucchi-cmu commented 1 month ago

LGTM. I think it will also be important to check this value against the number of rows in the parquet files directly at some point. In cases where the import process goes a little funky the parquet files can diverge from what was written in log files, and those are cases where this test can be especially valuable.

The method that writes out the parquet metadata will look at all of the footers for the parquet data files. https://github.com/astronomy-commons/hipscat/pull/306 will have that method return the total count. This would also be helpful for a few other import pipelines, where we read the footers AGAIN to calculate the total number of rows written. Once that PR is in, I'll update the code here to add the check.