官方提供了具体的操作说明,可以很好的体验dremio 对于map 的使用,内容来自官方文档
数据生成
- 使用pyarrow
import pyarrow as pa
import pyarrow.parquet as pq
description = ["Dictionary", "Dress", "Wagon"]
properties = [
[("Cover", "Hardcover"), ("Publication Year", "2002"), ("Color", "Blue")],
[("Size", "Medium"), ("Color", "Red")],
[("Material", "Metal"), ("Color", "Red")],
]
assert len(description) == len(properties)
maparr = pa.array(properties, type=pa.map_(pa.string(), pa.string()))
table = pa.table([description, maparr], names=["description", "properties"])
pq.write_table(table, "products.parquet")
- 查询效果
支持的操作
包含了size,map_keys, map_values, typeof 等,还是比较有用的,同时也支持基于属性key 的数据过滤