digoal
2022-09-05
PostgreSQL , DuckDB , deltalake , 分区表 , parquet
转自:
https://zhuanlan.zhihu.com/p/87744720
Delta Lake (数据湖)到底是什么?
- https://delta.io/
- Parquet文件 + Meta 文件 + 一组操作的API = Delta Lake
所以Delta没啥神秘的,和parquet没有任何区别。但是他通过meta文件以及相应的API, 提供众多特性功能的支持。在Spark中使用它和使用parquet的唯一区别就是把format parquet换成detla。
delta lake 主要解决什么问题?
- 大量的数据汇总后, 数据文件众多, 元数据管理的瓶颈问题
- 跨平台、通用的数据格式和API
delta lake 其他特性:
- ACID Transactions
- Protect your data with serializability, the strongest level of isolation
- Scalable Metadata
- Handle petabyte-scale tables with billions of partitions and files with ease
- Time Travel
- Access/revert to earlier versions of data for audits, rollbacks, or reproduce
- Open Source
- Community driven, open standards, open protocol, open discussions
- Unified Batch/Streaming
- Exactly once semantics ingestion to backfill to interactive queries
- Schema Evolution / Enforcement
- Prevent bad data from causing data corruption
- Audit History
- Delta Lake log all change details providing a fill audit trail
- DML Operations
- SQL, Scala/Java and Python APIs to merge, update and delete datasets
DuckDB 作为 Delta Lake 的计算层, 如何与delta lake 结合 :
- duckdb 自身, 支持并行、向量化等技术. 解决olap快速计算问题.
- duckdb S3/aliyun OSS存储. duckdb httpfs 插件支持. 解决数据文件存储和共享问题.
- duckdb parquet 数据文件. 解决高效数据组织问题.
- duckdb parquet meta cache. 解决parquet数据文件的元数据高速扫描问题.
- duckdb 分区支持, 高速过滤分区文件; 高速下推 filter、projection; 解决查询效率问题.
《DuckDB parquet 分区表 / Delta Lake(数据湖) 应用》
https://github.com/duckdb/duckdb/blob/master/test/sql/copy/parquet/parquet_metadata.test
https://docs.delta.io/latest/delta-streaming.html#delta-table-as-a-source
https://github.com/delta-io/delta-rs/blob/main/python/tests/test_table_read.py