Iceberg conversion container for the ERA5 lake (infra/lake-iceberg) #24
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Jinemi/thermograph#24
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/lake-iceberg"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
infra/lake-iceberg/: a self-contained one-shot container that maintains an Apache Iceberg v2 tableera5_dailyats3://era5-thermograph/iceberg/era5_dailyover the lake's existing hive parquet (era5/daily/tile=<ti>_<tj>/year=<Y>/month=<M>/part.parquet).sync_iceberg.py— incremental sync: diffs the tiles inera5/manifest.parquetagainst thethermograph.synced-tilestable property and registers only the new ones. The property updates in the same Iceberg commit as the files, so runs are idempotent, resume at batch boundaries, and are safe while the extraction job keeps writing (the manifest only lists tiles whose objects are all uploaded — it is the completeness signal, not bucket listing). Transient S3 errors retry per batch with backoff. Every run reconciles added records against the manifest's per-tile row counts, refreshesmetadata/version-hint.text, and prints the current metadata JSON path.THERMOGRAPH_LAKE_S3_*names/defaults (backend/data/era5lake.py); the catalog is a local sqlite SqlCatalog (THERMOGRAPH_ICEBERG_CATALOG_DB, default/state/iceberg-catalog.db) that self-heals by re-registering the latest metadata JSON if the db is lost.iceberg/; nothing underera5/is written, moved, or deleted.Dockerfile(python:3.12-slim; pinned pyiceberg 0.11.1 / pyarrow 25.0.0 / s3fs 2026.6.0),README.md,test_sync.py(11 pytest cases on local-filesystem fixtures — tile diffing, add_files planning, pruning, catalog-loss recovery, retries; no network).add_files, not a rewrite
The table registers the existing part files in place (pyiceberg
add_files): no data movement, no storage doubling. The part files carry no tile/year/month columns (they are path components), so identity partitioning would have forced a rewrite; instead the spec uses order-preserving transforms of real columns —truncate[12](lat_idx),truncate[12](lon_idx)(valuesti*12/tj*12, i.e. the tile),year(date),month(date). Each part file holds exactly one tile-month, soadd_filesderives every partition value from footer min/max stats alone. Queries prune on plainlat_idx/lon_idx/datepredicates, andschema.name-mapping.defaultis set so engines resolve the id-less parquet columns by name.End-to-end proof (real bucket, extraction still running)
At proof time the manifest listed 55 tiles and the extraction job was still adding (~1 tile / 75s); 36 tiles were synced and verified — catching the remainder is exactly the container's designed usage: re-run it after extraction batches.
ok).SELECT count(*) FROM iceberg_scan('s3://era5-thermograph/iceberg/era5_daily')→ 163,306,368 (4.9s, bare table root via version-hint); identical via the explicit metadata path (0.9s).s3://era5-thermograph/iceberg/era5_daily/metadata/00008-5138938f-aa5f-4cb6-9b67-75183eb1d074.metadata.jsoniceberg_scanandread_parquetof the hive part file (4464 rows; avg tmax 15.9916; sun all-null).docker buildofinfra/lake-iceberg/verified locally; the image runs--helpand exits cleanly when unconfigured.Notes
s3.endpoint+s3.force-virtual-addressing=false; s3fsaddressing_style: path; DuckDB secretURL_STYLE 'path'. With those set, everything (includingREGION 'default') worked without further quirks on pyiceberg 0.11.1.find()per tile: fsspecgloboveryear=*/month=*walks every directory level (~1000 LISTs ≈ 3 min per tile on this endpoint).