下图是doris官方结论
地址:https://doris.apache.org/zh-CN/docs/sql-manual/sql-types/Data-Types/VARIANT?_highlight=variant
基于github events一个小时数据量测试,数据大小605M
string建表
CREATE TABLE IF NOT EXISTS github_events_string (
id BIGINT NOT NULL,
type VARCHAR(30) NULL,
actor String NULL,
repo String NULL,
payload String NULL,
public BOOLEAN NULL,
created_at DATETIME NULL,
INDEX idx_payload (payload
) USING INVERTED PROPERTIES("parser" = "english") COMMENT 'inverted index for payload'
)
DUPLICATE KEY(id
)
DISTRIBUTED BY HASH(id) BUCKETS 10
properties("replication_num" = "1");
variant建表
CREATE TABLE IF NOT EXISTS github_events_string (
id BIGINT NOT NULL,
type VARCHAR(30) NULL,
actor variant NULL,
repo variant NULL,
payload variant NULL,
public BOOLEAN NULL,
created_at DATETIME NULL,
INDEX idx_payload (payload
) USING INVERTED PROPERTIES("parser" = "english") COMMENT 'inverted index for payload'
)
DUPLICATE KEY(id
)
DISTRIBUTED BY HASH(id) BUCKETS 10
properties("replication_num" = "1");
测试结果
使用stream load实际导入后,variant类型的表doris中查看是321M,string是156M