示例代码:
运行结果
集群版本
建表操作方式如下:
drop table if exists dws.`jx_dws_study_law_knowledge_graph_unique_ed_day_20240828_new`;
CREATE TABLE dws.`jx_dws_study_law_knowledge_graph_unique_ed_day_20240828_new` (
`sys_id` SMALLINT NULL COMMENT '项目id',
`user_id` BIGINT NULL COMMENT '用户id',
`batch_id` BIGINT NULL COMMENT '批次id',
`ob_unique` BIGINT NULL COMMENT '客观题做题唯一量',
`ob_knowledge_graph_unique` BIGINT NULL COMMENT '客观题知识图谱做题唯一量',
`su_unique` BIGINT NULL COMMENT '主观题做题唯一量',
`su_big_unique` BIGINT NULL COMMENT '主观题大案例做题唯一量',
`su_small_unique` BIGINT NULL COMMENT '主观题小案例做题唯一量',
`su_part_case_unique` BIGINT NULL COMMENT '纯案例速练唯一量 a.mock_type = 1 AND a.not_practice IN (1) AND a.status = 3 AND a.is_delete = 1',
`su_satisfy_big_unique` BIGINT NULL COMMENT '达标主观题大案例做题唯一量',
`su_case_unique` BIGINT NULL COMMENT '案例题唯一量',
`su_satisfy_part_case_unique` BIGINT NULL COMMENT '达标纯案例速练唯一量a.mock_type = 1 AND a.not_practice IN (1) AND a.status = 3 AND a.is_delete = 1'
)
UNIQUE KEY(`sys_id`, `user_id`, `batch_id`)
COMMENT 'OLAP'
DISTRIBUTED BY HASH(`user_id`) BUCKETS 1
PROPERTIES (
"replication_allocation" = "tag.location.default: 1,tag.location.default: 2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"store_row_column" = "true"
);
insert into dws.`jx_dws_study_law_knowledge_graph_unique_ed_day_20240828_new` values(5,2,612,1112,6001,151,122,434,987,162,66,55),
(5,1111165140,612,1112,6001,151,122,434,987,162,66,55
)