Snowflake interview question

Design a metadata service that tracks micro-partitions for a columnar storage engine handling petabyte-scale tables. Walk through how you'd shard the metadata across nodes, handle concurrent table updates without locking entire partitions, and prune partitions during query planning using min/max statistics. Then implement the in-memory pruning index in code, including how to merge per-column statistics after a background compaction job rewrites partitions.