mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-04-20 21:54:19 +08:00
(feature)(semantic) add materialization optimizer (#239)
Co-authored-by: jipengli <jipengli@tencent.com>
This commit is contained in:
@@ -160,6 +160,7 @@ CREATE TABLE IF NOT EXISTS `s2_datasource` (
|
||||
`description` varchar(500) DEFAULT NULL ,
|
||||
`database_id` INT NOT NULL ,
|
||||
`datasource_detail` LONGVARCHAR NOT NULL ,
|
||||
`depends` varchar(500) DEFAULT NULL ,
|
||||
`created_at` TIMESTAMP NOT NULL ,
|
||||
`created_by` varchar(100) NOT NULL ,
|
||||
`updated_at` TIMESTAMP NOT NULL ,
|
||||
@@ -208,6 +209,7 @@ CREATE TABLE IF NOT EXISTS `s2_dimension` (
|
||||
`description` varchar(500) NOT NULL ,
|
||||
`status` INT NOT NULL , -- status, 0 is normal, 1 is off the shelf, 2 is deleted
|
||||
`sensitive_level` INT DEFAULT NULL ,
|
||||
`data_type` varchar(50) DEFAULT NULL , -- type date,array,varchar
|
||||
`type` varchar(50) NOT NULL , -- type categorical,time
|
||||
`type_params` LONGVARCHAR DEFAULT NULL ,
|
||||
`expr` LONGVARCHAR NOT NULL , -- expression
|
||||
@@ -283,6 +285,7 @@ CREATE TABLE `s2_query_stat_info` (
|
||||
`use_sql_cache` TINYINT DEFAULT '-1' , -- whether to hit the sql cache
|
||||
`sql_cache_key`LONGVARCHAR , -- sql cache key
|
||||
`result_cache_key`LONGVARCHAR , -- result cache key
|
||||
`query_opt_mode` varchar(50) DEFAULT NULL ,
|
||||
PRIMARY KEY (`id`)
|
||||
) ;
|
||||
COMMENT ON TABLE s2_query_stat_info IS 'query statistics table';
|
||||
@@ -459,4 +462,65 @@ COMMENT ON TABLE song IS 'song';
|
||||
|
||||
-- benchmark
|
||||
|
||||
create table s2_materialization
|
||||
(
|
||||
id int AUTO_INCREMENT ,
|
||||
name varchar(255) not null,
|
||||
materialized_type varchar(255) not null ,
|
||||
update_cycle varchar(255) ,
|
||||
model_id bigint ,
|
||||
database_id bigint not null ,
|
||||
level int not null default 0 ,
|
||||
status int not null default 1 ,
|
||||
destination_table varchar(255) not null ,
|
||||
date_info varchar(255) null ,
|
||||
entities varchar(255) null ,
|
||||
principals varchar(255) DEFAULT NULL ,
|
||||
created_at TIMESTAMP null,
|
||||
created_by varchar(100) null,
|
||||
updated_at TIMESTAMP null,
|
||||
updated_by varchar(100) not null,
|
||||
description varchar(255) null,
|
||||
primary key (id)
|
||||
) ;
|
||||
|
||||
create table s2_materialization_element
|
||||
(
|
||||
id bigint not null ,
|
||||
type varchar(255) not null ,
|
||||
materialization_id bigint not null ,
|
||||
depends varchar(255) DEFAULT NULL,
|
||||
element_type varchar(255) DEFAULT NULL ,
|
||||
default_value varchar(255) DEFAULT NULL ,
|
||||
outlier varchar(255) DEFAULT NULL ,
|
||||
frequency varchar(255) DEFAULT NULL ,
|
||||
created_at TIMESTAMP null,
|
||||
created_by varchar(100) null,
|
||||
updated_at TIMESTAMP null,
|
||||
updated_by varchar(100) not null,
|
||||
description varchar(255) null ,
|
||||
status int not null default 1 ,
|
||||
PRIMARY KEY (id, type, materialization_id)
|
||||
) ;
|
||||
|
||||
CREATE TABLE s2_materialization_record
|
||||
(
|
||||
`id` bigint NOT NULL AUTO_INCREMENT ,
|
||||
`materialization_id` bigint NOT null ,
|
||||
`element_type` varchar(255) not null ,
|
||||
`element_id` bigint DEFAULT NULL ,
|
||||
`element_name` varchar(255) not null ,
|
||||
`data_time` varchar(64) DEFAULT NULL ,
|
||||
`state` varchar(255) DEFAULT NULL ,
|
||||
`task_id` varchar(255) DEFAULT NULL,
|
||||
`created_at` TIMESTAMP null,
|
||||
`updated_at` TIMESTAMP null,
|
||||
`created_by` varchar(100) null,
|
||||
`updated_by` varchar(100) not null,
|
||||
`retry_count` bigint NOT NULL default 0,
|
||||
`source_count` bigint NOT NULL default 0,
|
||||
`sink_count` bigint NOT NULL default 0,
|
||||
`message` varchar(255) ,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user