跳转到主要内容
允许在指定集群中的多个节点上并行处理 Azure Blob Storage 中的文件。在发起节点上,它会与集群中的所有节点建立连接,解析 S3 文件路径中的星号,并动态分发各个文件。在工作节点上,它会向发起节点请求下一个待处理任务并执行处理。该过程会重复进行,直到所有任务全部完成。 此表函数与 s3Cluster 表函数 类似。

语法

azureBlobStorageCluster(cluster_name, connection_string|storage_account_url, container_name, blobpath, [account_name, account_key, format, compression, structure])

参数

参数说明
cluster_name用于构建远程和本地 server 的一组地址及 connection 参数的集群名称。
connection_stringstorage_account_url` — connection_string 包含账户名和 key (创建 connection string) ;你也可以在此处提供 storage account url,并将账户名和账户 key 作为单独参数传入 (参见参数 account_name 和 account_key)
container_nameContainer 名称
blobpath文件 path。在 readonly 模式下支持以下 wildcards:***?{abc,def}{N..M},其中 NM 表示数字,'abc''def' 表示字符串。
account_name如果使用 storage_account_url,则可在此处指定账户名
account_key如果使用 storage_account_url,则可在此处指定账户 key
format文件的 format
compression支持的值:nonegzip/gzbrotli/brxz/LZMAzstd/zst。默认情况下,会根据文件扩展名自动检测压缩方式。 (等同于将其设置为 auto。)
structure表的结构。格式为 'column1_name column1_type, column2_name column2_type, ...'

返回值

一个具有指定结构的表,可用于读取指定文件中的数据或向其中写入数据。

示例

AzureBlobStorage 表引擎类似,用户可以使用 Azurite 模拟器在本地开发 Azure Storage。更多详情请参见此处。下文假设可通过主机名 azurite1 访问 Azurite。 使用 cluster_simple 集群中的所有节点,统计文件 test_cluster_*.csv 的数量:
SELECT count(*) FROM azureBlobStorageCluster(
        'cluster_simple', 'http://azurite1:10000/devstoreaccount1', 'testcontainer', 'test_cluster_count.csv', 'devstoreaccount1',
        'Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==', 'CSV',
        'auto', 'key UInt64')

使用共享访问签名 (SAS)

示例请参见 azureBlobStorage
最后修改于 2026年6月10日