gedih3.doctor.parquet_ops#
Streaming parquet operations specific to gh3_doctor.
Both functions process parquet files row-group by row-group to bound memory.
parquet_fill_columns()now lives ingedih3.utils(the build’s product backfill uses it too) and is re-exported here: the fill counterpart ofgedih3.utils.parquet_join_columns()— null/NaN base cells take the patch value, existing values are never overwritten.parquet_dedup_partition()rewrites a single parquet file dropping duplicateshot_numberrows, keeping the first occurrence.
Functions#
|
Rewrite a parquet file dropping duplicate |
Module Contents#
- gedih3.doctor.parquet_ops.parquet_dedup_partition(pq_file: str, key_col: str = 'shot_number', keep: str = 'first', tmp_suffix: str = '.dedup.tmp') int[source]#
Rewrite a parquet file dropping duplicate
key_colrows.Streams row-group by row-group: only one row group plus the cumulative set of seen keys is held in memory.
shot_numberis int64 so the seen-set cost is ~8 bytes/row.- Parameters:
- pq_filestr
Parquet file to rewrite in-place (via temp + atomic rename).
- key_colstr, default ‘shot_number’
Column to deduplicate on.
- keep{‘first’, ‘last’}, default ‘first’
Which duplicate to keep.
'last'requires a second pass.- tmp_suffixstr
Suffix for the temp file used during atomic rewrite.
- Returns:
- int
Number of rows dropped.