【详述】我page_log表的events列是json数组,怎样使用unnest将其一列转多行?
【背景】
建表语句:
CREATE TABLE IF NOT EXISTS page_log (
user_id string COMMENT “用户ID”,
events JSON COMMENT “事件列表”
)
DUPLICATE KEY(user_id)
COMMENT “”
DISTRIBUTED BY HASH(user_id)
PROPERTIES (
“replication_num” = “3”
);
样例数据:
INSERT INTO dwd_buried_log_page (events,user_id) VALUES
(’[{“event_id”: “anlipanliAdvancedSearch_ContentClick”, “item_id”: “4001919”, “item_index”: 1, “item_type”: “anlipanli”, “res_code”: 200, “sort_by”: “”, “ts”: 1691118512249}]’,‘1648179193459144863’),
(’[{“event_id”: “anlipanliAdvancedSearch_ContentClick”, “item_id”: “4001919”, “item_index”: 1, “item_type”: “anlipanli”, “res_code”: 200, “sort_by”: “”, “ts”: 1691118512249}]’,‘1648179193459144863’);
【是否存算分离】否
【StarRocks版本】2.5-stable
【集群规模】例如:3fe(1 follower+2observer)+5be(fe与be混部)
【机器信息】CPU虚拟核/内存/网卡,例如:48C/64G/万兆