有对ReplacingMergeTree结合Distributed熟悉的大佬么?
请教几个问题:
1)ReplacingMergeTree按照排序键去重,那么orderBy的字段组合必须是唯一的是么?
比如表中 (pid, store_id, topicdate) 这三个列的组合记录是唯一的; 如果是MergeTree,我可能只想设计成 orderBy(pid, store_id)就足够需要了; 那如果是用ReplacingMergeTree,此时是不是必须要 orderBy(pid, store_id, topicdate),不然去重就错了?
2)ReplacingMergeTree的合并是不是要在同一个节点的同一个分区上才行,导致Distributed的分片键要适应ReplacingMergeTree的排序键?
假如本地表是:ReplacingMergeTree() ORDER BY (pid, store_id, topicdate) 那么分布式表是:Distributed(cluster_name, database, table, [sharding Key]) 这个sharding Key可以是 (pid, store_id, topicdate),也可以是粒度更粗的 pid 或 store_id 或 (pid, store_id)组合? 总之要保证每一组唯一去重的字段组合要hash到同一个节点?
3)如果shardingKey是多个字段,语句怎么写? 官网没看到示例
是 用括号把元组括起来,比如 Distributed(cluster_name, database, table, (field1, field2, field3)) 么? 还是 Distributed(cluster_name, database, table, intHash64(field1, field2, field3))?