mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 12:07:42 +00:00
(improvement)(Headless)(Chat) Change View to DataSet (#782)
* (improvement)(Headless)(Chat) Change view to dataSet --------- Co-authored-by: jolunoluo <jolunoluo@tencent.com>
This commit is contained in:
@@ -13,8 +13,8 @@ import com.tencent.supersonic.headless.api.pojo.TimeDefaultConfig;
|
||||
import com.tencent.supersonic.headless.api.pojo.ModelDetail;
|
||||
import com.tencent.supersonic.headless.api.pojo.Dim;
|
||||
import com.tencent.supersonic.headless.api.pojo.DimensionTimeTypeParams;
|
||||
import com.tencent.supersonic.headless.api.pojo.ViewDetail;
|
||||
import com.tencent.supersonic.headless.api.pojo.ViewModelConfig;
|
||||
import com.tencent.supersonic.headless.api.pojo.DataSetDetail;
|
||||
import com.tencent.supersonic.headless.api.pojo.DataSetModelConfig;
|
||||
import com.tencent.supersonic.headless.api.pojo.Identify;
|
||||
import com.tencent.supersonic.headless.api.pojo.Measure;
|
||||
import com.tencent.supersonic.headless.api.pojo.QueryConfig;
|
||||
@@ -24,11 +24,11 @@ import com.tencent.supersonic.headless.api.pojo.enums.DimensionType;
|
||||
import com.tencent.supersonic.headless.api.pojo.enums.IdentifyType;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.DomainReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.ModelReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.ViewReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.DataSetReq;
|
||||
import com.tencent.supersonic.headless.server.service.DomainService;
|
||||
import com.tencent.supersonic.headless.server.service.ModelRelaService;
|
||||
import com.tencent.supersonic.headless.server.service.ModelService;
|
||||
import com.tencent.supersonic.headless.server.service.ViewService;
|
||||
import com.tencent.supersonic.headless.server.service.DataSetService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -52,7 +52,7 @@ public class BenchMarkDemoDataLoader {
|
||||
private ModelRelaService modelRelaService;
|
||||
|
||||
@Autowired
|
||||
private ViewService viewService;
|
||||
private DataSetService viewService;
|
||||
|
||||
public void doRun() {
|
||||
try {
|
||||
@@ -214,22 +214,22 @@ public class BenchMarkDemoDataLoader {
|
||||
}
|
||||
|
||||
public void addView_1() {
|
||||
ViewReq viewReq = new ViewReq();
|
||||
DataSetReq viewReq = new DataSetReq();
|
||||
viewReq.setName("cspider");
|
||||
viewReq.setBizName("singer");
|
||||
viewReq.setDomainId(3L);
|
||||
viewReq.setDescription("包含cspider数据集相关标签和指标信息");
|
||||
viewReq.setAdmins(Lists.newArrayList("admin"));
|
||||
List<ViewModelConfig> viewModelConfigs = Lists.newArrayList(
|
||||
new ViewModelConfig(5L, Lists.newArrayList(8L), Lists.newArrayList()),
|
||||
new ViewModelConfig(6L, Lists.newArrayList(9L, 10L), Lists.newArrayList()),
|
||||
new ViewModelConfig(7L, Lists.newArrayList(11L, 12L), Lists.newArrayList()),
|
||||
new ViewModelConfig(8L, Lists.newArrayList(13L, 14L), Lists.newArrayList(8L, 9L))
|
||||
List<DataSetModelConfig> viewModelConfigs = Lists.newArrayList(
|
||||
new DataSetModelConfig(5L, Lists.newArrayList(8L), Lists.newArrayList()),
|
||||
new DataSetModelConfig(6L, Lists.newArrayList(9L, 10L), Lists.newArrayList()),
|
||||
new DataSetModelConfig(7L, Lists.newArrayList(11L, 12L), Lists.newArrayList()),
|
||||
new DataSetModelConfig(8L, Lists.newArrayList(13L, 14L), Lists.newArrayList(8L, 9L))
|
||||
);
|
||||
ViewDetail viewDetail = new ViewDetail();
|
||||
viewDetail.setViewModelConfigs(viewModelConfigs);
|
||||
viewReq.setViewDetail(viewDetail);
|
||||
viewReq.setTypeEnum(TypeEnums.VIEW);
|
||||
DataSetDetail viewDetail = new DataSetDetail();
|
||||
viewDetail.setDataSetModelConfigs(viewModelConfigs);
|
||||
viewReq.setDataSetDetail(viewDetail);
|
||||
viewReq.setTypeEnum(TypeEnums.DATASET);
|
||||
QueryConfig queryConfig = new QueryConfig();
|
||||
TagTypeDefaultConfig tagTypeDefaultConfig = new TagTypeDefaultConfig();
|
||||
TimeDefaultConfig tagTimeDefaultConfig = new TimeDefaultConfig();
|
||||
|
||||
@@ -134,7 +134,7 @@ public class ChatDemoLoader implements CommandLineRunner {
|
||||
private void addPlugin_1() {
|
||||
Plugin plugin1 = new Plugin();
|
||||
plugin1.setType("WEB_PAGE");
|
||||
plugin1.setViewList(Arrays.asList(1L));
|
||||
plugin1.setDataSetList(Arrays.asList(1L));
|
||||
plugin1.setPattern("用于分析超音数的流量概况,包含UV、PV等核心指标的追踪。P.S. 仅作为示例展示,无实际看板");
|
||||
plugin1.setName("超音数流量分析看板");
|
||||
PluginParseConfig pluginParseConfig = new PluginParseConfig();
|
||||
@@ -169,14 +169,14 @@ public class ChatDemoLoader implements CommandLineRunner {
|
||||
RuleParserTool ruleQueryTool = new RuleParserTool();
|
||||
ruleQueryTool.setType(AgentToolType.NL2SQL_RULE);
|
||||
ruleQueryTool.setId("0");
|
||||
ruleQueryTool.setViewIds(Lists.newArrayList(1L));
|
||||
ruleQueryTool.setDataSetIds(Lists.newArrayList(1L));
|
||||
ruleQueryTool.setQueryTypes(Lists.newArrayList(QueryType.METRIC.name()));
|
||||
agentConfig.getTools().add(ruleQueryTool);
|
||||
if (demoEnabledNl2SqlLlm) {
|
||||
LLMParserTool llmParserTool = new LLMParserTool();
|
||||
llmParserTool.setId("1");
|
||||
llmParserTool.setType(AgentToolType.NL2SQL_LLM);
|
||||
llmParserTool.setViewIds(Lists.newArrayList(-1L));
|
||||
llmParserTool.setDataSetIds(Lists.newArrayList(-1L));
|
||||
agentConfig.getTools().add(llmParserTool);
|
||||
}
|
||||
agent.setAgentConfig(JSONObject.toJSONString(agentConfig));
|
||||
@@ -195,7 +195,7 @@ public class ChatDemoLoader implements CommandLineRunner {
|
||||
RuleParserTool ruleQueryTool = new RuleParserTool();
|
||||
ruleQueryTool.setId("0");
|
||||
ruleQueryTool.setType(AgentToolType.NL2SQL_RULE);
|
||||
ruleQueryTool.setViewIds(Lists.newArrayList(2L));
|
||||
ruleQueryTool.setDataSetIds(Lists.newArrayList(2L));
|
||||
ruleQueryTool.setQueryTypes(Lists.newArrayList(QueryType.TAG.name()));
|
||||
agentConfig.getTools().add(ruleQueryTool);
|
||||
|
||||
@@ -203,7 +203,7 @@ public class ChatDemoLoader implements CommandLineRunner {
|
||||
LLMParserTool llmParserTool = new LLMParserTool();
|
||||
llmParserTool.setId("1");
|
||||
llmParserTool.setType(AgentToolType.NL2SQL_LLM);
|
||||
llmParserTool.setViewIds(Lists.newArrayList(-1L));
|
||||
llmParserTool.setDataSetIds(Lists.newArrayList(-1L));
|
||||
agentConfig.getTools().add(llmParserTool);
|
||||
}
|
||||
agent.setAgentConfig(JSONObject.toJSONString(agentConfig));
|
||||
@@ -225,7 +225,7 @@ public class ChatDemoLoader implements CommandLineRunner {
|
||||
LLMParserTool llmParserTool = new LLMParserTool();
|
||||
llmParserTool.setId("1");
|
||||
llmParserTool.setType(AgentToolType.NL2SQL_LLM);
|
||||
llmParserTool.setViewIds(Lists.newArrayList(3L));
|
||||
llmParserTool.setDataSetIds(Lists.newArrayList(3L));
|
||||
agentConfig.getTools().add(llmParserTool);
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ public class ChatDemoLoader implements CommandLineRunner {
|
||||
LLMParserTool llmParserTool = new LLMParserTool();
|
||||
llmParserTool.setId("1");
|
||||
llmParserTool.setType(AgentToolType.NL2SQL_LLM);
|
||||
llmParserTool.setViewIds(Lists.newArrayList(4L));
|
||||
llmParserTool.setDataSetIds(Lists.newArrayList(4L));
|
||||
agentConfig.getTools().add(llmParserTool);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,21 +15,21 @@ import com.tencent.supersonic.headless.api.pojo.DimensionTimeTypeParams;
|
||||
import com.tencent.supersonic.headless.api.pojo.Identify;
|
||||
import com.tencent.supersonic.headless.api.pojo.Measure;
|
||||
import com.tencent.supersonic.headless.api.pojo.ModelDetail;
|
||||
import com.tencent.supersonic.headless.api.pojo.ViewDetail;
|
||||
import com.tencent.supersonic.headless.api.pojo.ViewModelConfig;
|
||||
import com.tencent.supersonic.headless.api.pojo.DataSetDetail;
|
||||
import com.tencent.supersonic.headless.api.pojo.DataSetModelConfig;
|
||||
import com.tencent.supersonic.headless.api.pojo.QueryConfig;
|
||||
import com.tencent.supersonic.headless.api.pojo.MetricTypeDefaultConfig;
|
||||
import com.tencent.supersonic.headless.api.pojo.TimeDefaultConfig;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.DomainReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.MetricReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.ModelReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.ViewReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.DataSetReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.response.MetricResp;
|
||||
import com.tencent.supersonic.headless.server.service.DomainService;
|
||||
import com.tencent.supersonic.headless.server.service.MetricService;
|
||||
import com.tencent.supersonic.headless.server.service.ModelRelaService;
|
||||
import com.tencent.supersonic.headless.server.service.ModelService;
|
||||
import com.tencent.supersonic.headless.server.service.ViewService;
|
||||
import com.tencent.supersonic.headless.server.service.DataSetService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -56,7 +56,7 @@ public class DuSQLDemoDataLoader {
|
||||
private MetricService metricService;
|
||||
|
||||
@Autowired
|
||||
private ViewService viewService;
|
||||
private DataSetService viewService;
|
||||
|
||||
public void doRun() {
|
||||
try {
|
||||
@@ -255,22 +255,22 @@ public class DuSQLDemoDataLoader {
|
||||
}
|
||||
|
||||
public void addView_1() {
|
||||
ViewReq viewReq = new ViewReq();
|
||||
DataSetReq viewReq = new DataSetReq();
|
||||
viewReq.setName("DuSQL 互联网企业");
|
||||
viewReq.setBizName("internet");
|
||||
viewReq.setDomainId(4L);
|
||||
viewReq.setDescription("DuSQL互联网企业数据源相关的指标和维度等");
|
||||
viewReq.setAdmins(Lists.newArrayList("admin"));
|
||||
List<ViewModelConfig> viewModelConfigs = Lists.newArrayList(
|
||||
new ViewModelConfig(9L, Lists.newArrayList(16L, 17L, 18L, 19L, 20L), Lists.newArrayList(10L, 11L)),
|
||||
new ViewModelConfig(10L, Lists.newArrayList(21L, 22L, 23L), Lists.newArrayList(12L)),
|
||||
new ViewModelConfig(11L, Lists.newArrayList(), Lists.newArrayList(13L, 14L, 15L)),
|
||||
new ViewModelConfig(12L, Lists.newArrayList(24L), Lists.newArrayList(16L, 17L, 18L, 19L)));
|
||||
List<DataSetModelConfig> viewModelConfigs = Lists.newArrayList(
|
||||
new DataSetModelConfig(9L, Lists.newArrayList(16L, 17L, 18L, 19L, 20L), Lists.newArrayList(10L, 11L)),
|
||||
new DataSetModelConfig(10L, Lists.newArrayList(21L, 22L, 23L), Lists.newArrayList(12L)),
|
||||
new DataSetModelConfig(11L, Lists.newArrayList(), Lists.newArrayList(13L, 14L, 15L)),
|
||||
new DataSetModelConfig(12L, Lists.newArrayList(24L), Lists.newArrayList(16L, 17L, 18L, 19L)));
|
||||
|
||||
ViewDetail viewDetail = new ViewDetail();
|
||||
viewDetail.setViewModelConfigs(viewModelConfigs);
|
||||
viewReq.setViewDetail(viewDetail);
|
||||
viewReq.setTypeEnum(TypeEnums.VIEW);
|
||||
DataSetDetail viewDetail = new DataSetDetail();
|
||||
viewDetail.setDataSetModelConfigs(viewModelConfigs);
|
||||
viewReq.setDataSetDetail(viewDetail);
|
||||
viewReq.setTypeEnum(TypeEnums.DATASET);
|
||||
QueryConfig queryConfig = new QueryConfig();
|
||||
MetricTypeDefaultConfig metricTypeDefaultConfig = new MetricTypeDefaultConfig();
|
||||
TimeDefaultConfig timeDefaultConfig = new TimeDefaultConfig();
|
||||
|
||||
@@ -38,21 +38,21 @@ import com.tencent.supersonic.headless.api.pojo.MetricDefineByMetricParams;
|
||||
import com.tencent.supersonic.headless.api.pojo.MetricParam;
|
||||
import com.tencent.supersonic.headless.api.pojo.ModelDetail;
|
||||
import com.tencent.supersonic.headless.api.pojo.RelateDimension;
|
||||
import com.tencent.supersonic.headless.api.pojo.ViewDetail;
|
||||
import com.tencent.supersonic.headless.api.pojo.ViewModelConfig;
|
||||
import com.tencent.supersonic.headless.api.pojo.DataSetDetail;
|
||||
import com.tencent.supersonic.headless.api.pojo.DataSetModelConfig;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.DatabaseReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.DimensionReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.DomainReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.MetricReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.ModelReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.ViewReq;
|
||||
import com.tencent.supersonic.headless.api.pojo.request.DataSetReq;
|
||||
import com.tencent.supersonic.headless.server.service.DatabaseService;
|
||||
import com.tencent.supersonic.headless.server.service.DimensionService;
|
||||
import com.tencent.supersonic.headless.server.service.DomainService;
|
||||
import com.tencent.supersonic.headless.server.service.MetricService;
|
||||
import com.tencent.supersonic.headless.server.service.ModelRelaService;
|
||||
import com.tencent.supersonic.headless.server.service.ModelService;
|
||||
import com.tencent.supersonic.headless.server.service.ViewService;
|
||||
import com.tencent.supersonic.headless.server.service.DataSetService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -84,7 +84,7 @@ public class ModelDemoDataLoader {
|
||||
@Autowired
|
||||
private AuthService authService;
|
||||
@Autowired
|
||||
private ViewService viewService;
|
||||
private DataSetService dataSetService;
|
||||
@Autowired
|
||||
private DataSourceProperties dataSourceProperties;
|
||||
|
||||
@@ -446,21 +446,21 @@ public class ModelDemoDataLoader {
|
||||
}
|
||||
|
||||
public void addView_1() {
|
||||
ViewReq viewReq = new ViewReq();
|
||||
viewReq.setName("超音数");
|
||||
viewReq.setBizName("s2");
|
||||
viewReq.setDomainId(1L);
|
||||
viewReq.setDescription("包含超音数访问统计相关的指标和维度等");
|
||||
viewReq.setAdmins(Lists.newArrayList("admin"));
|
||||
List<ViewModelConfig> viewModelConfigs = Lists.newArrayList(
|
||||
new ViewModelConfig(1L, Lists.newArrayList(1L, 2L), Lists.newArrayList()),
|
||||
new ViewModelConfig(2L, Lists.newArrayList(), Lists.newArrayList(1L, 2L, 3L)),
|
||||
new ViewModelConfig(3L, Lists.newArrayList(3L), Lists.newArrayList(4L)));
|
||||
DataSetReq dataSetReq = new DataSetReq();
|
||||
dataSetReq.setName("超音数");
|
||||
dataSetReq.setBizName("s2");
|
||||
dataSetReq.setDomainId(1L);
|
||||
dataSetReq.setDescription("包含超音数访问统计相关的指标和维度等");
|
||||
dataSetReq.setAdmins(Lists.newArrayList("admin"));
|
||||
List<DataSetModelConfig> dataSetModelConfigs = Lists.newArrayList(
|
||||
new DataSetModelConfig(1L, Lists.newArrayList(1L, 2L), Lists.newArrayList()),
|
||||
new DataSetModelConfig(2L, Lists.newArrayList(), Lists.newArrayList(1L, 2L, 3L)),
|
||||
new DataSetModelConfig(3L, Lists.newArrayList(3L), Lists.newArrayList(4L)));
|
||||
|
||||
ViewDetail viewDetail = new ViewDetail();
|
||||
viewDetail.setViewModelConfigs(viewModelConfigs);
|
||||
viewReq.setViewDetail(viewDetail);
|
||||
viewReq.setTypeEnum(TypeEnums.VIEW);
|
||||
DataSetDetail dataSetDetail = new DataSetDetail();
|
||||
dataSetDetail.setDataSetModelConfigs(dataSetModelConfigs);
|
||||
dataSetReq.setDataSetDetail(dataSetDetail);
|
||||
dataSetReq.setTypeEnum(TypeEnums.DATASET);
|
||||
QueryConfig queryConfig = new QueryConfig();
|
||||
MetricTypeDefaultConfig metricTypeDefaultConfig = new MetricTypeDefaultConfig();
|
||||
TimeDefaultConfig timeDefaultConfig = new TimeDefaultConfig();
|
||||
@@ -468,25 +468,25 @@ public class ModelDemoDataLoader {
|
||||
timeDefaultConfig.setUnit(7);
|
||||
metricTypeDefaultConfig.setTimeDefaultConfig(timeDefaultConfig);
|
||||
queryConfig.setMetricTypeDefaultConfig(metricTypeDefaultConfig);
|
||||
viewReq.setQueryConfig(queryConfig);
|
||||
viewService.save(viewReq, User.getFakeUser());
|
||||
dataSetReq.setQueryConfig(queryConfig);
|
||||
dataSetService.save(dataSetReq, User.getFakeUser());
|
||||
}
|
||||
|
||||
public void addView_2() {
|
||||
ViewReq viewReq = new ViewReq();
|
||||
viewReq.setName("艺人库");
|
||||
viewReq.setBizName("singer");
|
||||
viewReq.setDomainId(2L);
|
||||
viewReq.setDescription("包含艺人相关标签和指标信息");
|
||||
viewReq.setAdmins(Lists.newArrayList("admin", "jack"));
|
||||
List<ViewModelConfig> viewModelConfigs = Lists.newArrayList(
|
||||
new ViewModelConfig(4L, Lists.newArrayList(4L, 5L, 6L, 7L),
|
||||
DataSetReq dataSetReq = new DataSetReq();
|
||||
dataSetReq.setName("艺人库");
|
||||
dataSetReq.setBizName("singer");
|
||||
dataSetReq.setDomainId(2L);
|
||||
dataSetReq.setDescription("包含艺人相关标签和指标信息");
|
||||
dataSetReq.setAdmins(Lists.newArrayList("admin", "jack"));
|
||||
List<DataSetModelConfig> dataSetModelConfigs = Lists.newArrayList(
|
||||
new DataSetModelConfig(4L, Lists.newArrayList(4L, 5L, 6L, 7L),
|
||||
Lists.newArrayList(5L, 6L, 7L))
|
||||
);
|
||||
ViewDetail viewDetail = new ViewDetail();
|
||||
viewDetail.setViewModelConfigs(viewModelConfigs);
|
||||
viewReq.setViewDetail(viewDetail);
|
||||
viewReq.setTypeEnum(TypeEnums.VIEW);
|
||||
DataSetDetail dataSetDetail = new DataSetDetail();
|
||||
dataSetDetail.setDataSetModelConfigs(dataSetModelConfigs);
|
||||
dataSetReq.setDataSetDetail(dataSetDetail);
|
||||
dataSetReq.setTypeEnum(TypeEnums.DATASET);
|
||||
QueryConfig queryConfig = new QueryConfig();
|
||||
TagTypeDefaultConfig tagTypeDefaultConfig = new TagTypeDefaultConfig();
|
||||
TimeDefaultConfig tagTimeDefaultConfig = new TimeDefaultConfig();
|
||||
@@ -504,8 +504,8 @@ public class ModelDemoDataLoader {
|
||||
metricTypeDefaultConfig.setTimeDefaultConfig(timeDefaultConfig);
|
||||
queryConfig.setTagTypeDefaultConfig(tagTypeDefaultConfig);
|
||||
queryConfig.setMetricTypeDefaultConfig(metricTypeDefaultConfig);
|
||||
viewReq.setQueryConfig(queryConfig);
|
||||
viewService.save(viewReq, User.getFakeUser());
|
||||
dataSetReq.setQueryConfig(queryConfig);
|
||||
dataSetService.save(dataSetReq, User.getFakeUser());
|
||||
}
|
||||
|
||||
public void addAuthGroup_1() {
|
||||
|
||||
@@ -28,8 +28,8 @@ com.tencent.supersonic.chat.server.processor.parse.ParseResultProcessor=\
|
||||
com.tencent.supersonic.chat.core.query.semantic.SemanticInterpreter=\
|
||||
com.tencent.supersonic.chat.core.query.semantic.LocalSemanticInterpreter
|
||||
|
||||
com.tencent.supersonic.chat.core.parser.sql.llm.ViewResolver=\
|
||||
com.tencent.supersonic.chat.core.parser.sql.llm.HeuristicViewResolver
|
||||
com.tencent.supersonic.chat.core.parser.sql.llm.DataSetResolver=\
|
||||
com.tencent.supersonic.chat.core.parser.sql.llm.HeuristicDataSetResolver
|
||||
|
||||
com.tencent.supersonic.auth.authentication.interceptor.AuthenticationInterceptor=\
|
||||
com.tencent.supersonic.auth.authentication.interceptor.DefaultAuthenticationInterceptor
|
||||
|
||||
@@ -242,3 +242,10 @@ CREATE TABLE IF NOT EXISTS `s2_dictionary_task` (
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
COMMENT ON TABLE s2_dictionary_task IS 'dictionary task information table';
|
||||
|
||||
|
||||
--20240229
|
||||
alter table s2_view rename to s2_data_set;
|
||||
alter table s2_query_stat_info change view_id data_set_id bigint;
|
||||
alter table s2_plugin change `view` data_set varchar(200);
|
||||
alter table s2_data_set change view_detail data_set_detail text;
|
||||
@@ -1112,17 +1112,17 @@ MERGE INTO song(imp_date,song_name,artist_name,country,f_id,g_name,rating,langua
|
||||
MERGE INTO song(imp_date,song_name,artist_name,country,f_id,g_name,rating,languages,releasedate,resolution) VALUES (DATEADD('DAY', 0, CURRENT_DATE()),'阿杰伊阿卡什','Topu','印度',6,'现代',10,'孟加拉语','27-MAR-2004',320);
|
||||
|
||||
|
||||
insert into company(imp_date,company_id,company_name,headquarter_address,company_established_time,founder,ceo,annual_turnover,employee_count) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_131','百度集团','北京','2000','李彦宏','李彦宏',102300000000,40000);
|
||||
insert into company(imp_date,company_id,company_name,headquarter_address,company_established_time,founder,ceo,annual_turnover,employee_count) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_132','阿里巴巴集团','杭州','1999年','马云','张勇',376800000000,103699);
|
||||
insert into company(imp_date,company_id,company_name,headquarter_address,company_established_time,founder,ceo,annual_turnover,employee_count) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_133','深圳市腾讯计算机系统有限公司','深圳','1998','马化腾','刘炽平',321600000000,56310);
|
||||
insert into company(imp_date,company_id,company_name,headquarter_address,company_established_time,founder,ceo,annual_turnover,employee_count) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_134','北京京东世纪贸易有限公司','北京','1998','刘强东','刘强东',28800000000,179000);
|
||||
insert into company(imp_date,company_id,company_name,headquarter_address,company_established_time,founder,ceo,annual_turnover,employee_count) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_135','网易公司','杭州','1997','丁磊','丁磊',67500000000,20000);
|
||||
MERGE into company(imp_date,company_id,company_name,headquarter_address,company_established_time,founder,ceo,annual_turnover,employee_count) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_131','百度集团','北京','2000','李彦宏','李彦宏',102300000000,40000);
|
||||
MERGE into company(imp_date,company_id,company_name,headquarter_address,company_established_time,founder,ceo,annual_turnover,employee_count) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_132','阿里巴巴集团','杭州','1999年','马云','张勇',376800000000,103699);
|
||||
MERGE into company(imp_date,company_id,company_name,headquarter_address,company_established_time,founder,ceo,annual_turnover,employee_count) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_133','深圳市腾讯计算机系统有限公司','深圳','1998','马化腾','刘炽平',321600000000,56310);
|
||||
MERGE into company(imp_date,company_id,company_name,headquarter_address,company_established_time,founder,ceo,annual_turnover,employee_count) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_134','北京京东世纪贸易有限公司','北京','1998','刘强东','刘强东',28800000000,179000);
|
||||
MERGE into company(imp_date,company_id,company_name,headquarter_address,company_established_time,founder,ceo,annual_turnover,employee_count) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_135','网易公司','杭州','1997','丁磊','丁磊',67500000000,20000);
|
||||
|
||||
insert into brand(imp_date,brand_id,brand_name,brand_established_time,company_id,legal_representative,registered_capital) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_136','阿里云','2009年9月10日','item_enterprise_13_132','张勇',50000000);
|
||||
insert into brand(imp_date,brand_id,brand_name,brand_established_time,company_id,legal_representative,registered_capital) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_137','天猫','2012年1月11日','item_enterprise_13_132','张勇',100000000);
|
||||
insert into brand(imp_date,brand_id,brand_name,brand_established_time,company_id,legal_representative,registered_capital) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_138','腾讯游戏','2003','item_enterprise_13_133','马化腾',50000000);
|
||||
insert into brand(imp_date,brand_id,brand_name,brand_established_time,company_id,legal_representative,registered_capital) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_139','度小满','2018','item_enterprise_13_131','朱光',100000000);
|
||||
insert into brand(imp_date,brand_id,brand_name,brand_established_time,company_id,legal_representative,registered_capital) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_140','京东金融','2017','item_enterprise_13_134','刘强东',100000000);
|
||||
MERGE into brand(imp_date,brand_id,brand_name,brand_established_time,company_id,legal_representative,registered_capital) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_136','阿里云','2009年9月10日','item_enterprise_13_132','张勇',50000000);
|
||||
MERGE into brand(imp_date,brand_id,brand_name,brand_established_time,company_id,legal_representative,registered_capital) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_137','天猫','2012年1月11日','item_enterprise_13_132','张勇',100000000);
|
||||
MERGE into brand(imp_date,brand_id,brand_name,brand_established_time,company_id,legal_representative,registered_capital) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_138','腾讯游戏','2003','item_enterprise_13_133','马化腾',50000000);
|
||||
MERGE into brand(imp_date,brand_id,brand_name,brand_established_time,company_id,legal_representative,registered_capital) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_139','度小满','2018','item_enterprise_13_131','朱光',100000000);
|
||||
MERGE into brand(imp_date,brand_id,brand_name,brand_established_time,company_id,legal_representative,registered_capital) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_140','京东金融','2017','item_enterprise_13_134','刘强东',100000000);
|
||||
|
||||
insert into company_revenue(imp_date,company_id,brand_id,revenue_proportion,profit_proportion,expenditure_proportion) VALUES ( DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_131','item_enterprise_13_139',10,10,30);
|
||||
insert into company_revenue(imp_date,company_id,brand_id,revenue_proportion,profit_proportion,expenditure_proportion) VALUES ( DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_133','item_enterprise_13_138',80,80,60);
|
||||
|
||||
@@ -248,7 +248,7 @@ CREATE TABLE IF NOT EXISTS `s2_query_stat_info` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`trace_id` varchar(200) DEFAULT NULL, -- query unique identifier
|
||||
`model_id` INT DEFAULT NULL,
|
||||
`view_id` INT DEFAULT NULL,
|
||||
`data_set_id` INT DEFAULT NULL,
|
||||
`user` varchar(200) DEFAULT NULL,
|
||||
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
|
||||
`query_type` varchar(200) DEFAULT NULL, -- the corresponding scene
|
||||
@@ -326,7 +326,7 @@ CREATE TABLE IF NOT EXISTS `s2_plugin`
|
||||
(
|
||||
`id` INT AUTO_INCREMENT,
|
||||
`type` varchar(50) NULL,
|
||||
`view` varchar(100) NULL,
|
||||
`data_set` varchar(100) NULL,
|
||||
`pattern` varchar(500) NULL,
|
||||
`parse_mode` varchar(100) NULL,
|
||||
`parse_mode_config` LONGVARCHAR NULL,
|
||||
@@ -556,7 +556,7 @@ CREATE TABLE IF NOT EXISTS `s2_app` (
|
||||
updated_by VARCHAR(255)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `s2_view` (
|
||||
CREATE TABLE IF NOT EXISTS `s2_data_set` (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
domain_id BIGINT,
|
||||
`name` VARCHAR(255),
|
||||
@@ -564,7 +564,7 @@ CREATE TABLE IF NOT EXISTS `s2_view` (
|
||||
description VARCHAR(255),
|
||||
status INT,
|
||||
alias VARCHAR(255),
|
||||
view_detail TEXT,
|
||||
data_set_detail TEXT,
|
||||
created_at TIMESTAMP,
|
||||
created_by VARCHAR(255),
|
||||
updated_at TIMESTAMP,
|
||||
|
||||
@@ -112,7 +112,7 @@ public class QueryBySqlTest extends BaseTest {
|
||||
SemanticQueryResp semanticQueryResp =
|
||||
queryBySql("SELECT SUM(stay_hours) FROM 停留时长统计 WHERE department ='HR'", tom);
|
||||
Assertions.assertNotNull(semanticQueryResp.getQueryAuthorization().getMessage());
|
||||
Assertions.assertTrue(semanticQueryResp.getSql().contains("`user_name` = 'tom'"));
|
||||
Assertions.assertTrue(semanticQueryResp.getSql().contains("user_name = 'tom'"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ import com.tencent.supersonic.auth.api.authentication.pojo.User;
|
||||
import com.tencent.supersonic.common.pojo.enums.AuthType;
|
||||
import com.tencent.supersonic.headless.api.pojo.response.DomainResp;
|
||||
import com.tencent.supersonic.headless.api.pojo.response.ModelResp;
|
||||
import com.tencent.supersonic.headless.api.pojo.response.ViewResp;
|
||||
import com.tencent.supersonic.headless.api.pojo.response.DataSetResp;
|
||||
import com.tencent.supersonic.headless.server.service.DomainService;
|
||||
import com.tencent.supersonic.headless.server.service.ModelService;
|
||||
import com.tencent.supersonic.headless.server.service.ViewService;
|
||||
import com.tencent.supersonic.headless.server.service.DataSetService;
|
||||
import com.tencent.supersonic.util.DataUtils;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -22,7 +22,7 @@ public class SchemaAuthTest extends BaseTest {
|
||||
private DomainService domainService;
|
||||
|
||||
@Autowired
|
||||
private ViewService viewService;
|
||||
private DataSetService viewService;
|
||||
|
||||
@Autowired
|
||||
private ModelService modelService;
|
||||
@@ -57,10 +57,10 @@ public class SchemaAuthTest extends BaseTest {
|
||||
@Test
|
||||
public void test_getViewList_alice() {
|
||||
User user = DataUtils.getUserAlice();
|
||||
List<ViewResp> modelResps = viewService.getViewsInheritAuth(user, 0L);
|
||||
List<DataSetResp> modelResps = viewService.getDataSetsInheritAuth(user, 0L);
|
||||
List<Long> expectedViewIds = Lists.newArrayList(2L);
|
||||
Assertions.assertEquals(expectedViewIds,
|
||||
modelResps.stream().map(ViewResp::getId).collect(Collectors.toList()));
|
||||
modelResps.stream().map(DataSetResp::getId).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -84,10 +84,10 @@ public class SchemaAuthTest extends BaseTest {
|
||||
@Test
|
||||
public void test_getViewList_jack() {
|
||||
User user = DataUtils.getUserJack();
|
||||
List<ViewResp> modelResps = viewService.getViewsInheritAuth(user, 0L);
|
||||
List<DataSetResp> modelResps = viewService.getDataSetsInheritAuth(user, 0L);
|
||||
List<Long> expectedViewIds = Lists.newArrayList(1L, 2L);
|
||||
Assertions.assertEquals(expectedViewIds,
|
||||
modelResps.stream().map(ViewResp::getId).collect(Collectors.toList()));
|
||||
modelResps.stream().map(DataSetResp::getId).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ public class DataUtils {
|
||||
private static RuleParserTool getRuleQueryTool() {
|
||||
RuleParserTool ruleQueryTool = new RuleParserTool();
|
||||
ruleQueryTool.setType(AgentToolType.NL2SQL_RULE);
|
||||
ruleQueryTool.setViewIds(Lists.newArrayList(-1L));
|
||||
ruleQueryTool.setDataSetIds(Lists.newArrayList(-1L));
|
||||
ruleQueryTool.setQueryModes(Lists.newArrayList("METRIC_TAG", "METRIC_FILTER", "METRIC_MODEL",
|
||||
"TAG_DETAIL", "TAG_LIST_FILTER", "TAG_ID"));
|
||||
return ruleQueryTool;
|
||||
|
||||
@@ -77,4 +77,4 @@ logging:
|
||||
|
||||
inMemoryEmbeddingStore:
|
||||
persistent:
|
||||
path: d://
|
||||
path: /tmp
|
||||
|
||||
@@ -5,7 +5,6 @@ MERGE INTO s2_user (id, `name`, password, display_name, email) values (3, 'tom',
|
||||
MERGE INTO s2_user (id, `name`, password, display_name, email, is_admin) values (4, 'lucy','123456','lucy','lucy@xx.com', 1);
|
||||
MERGE INTO s2_user (id, `name`, password, display_name, email) values (5, 'alice','123456','alice','alice@xx.com');
|
||||
|
||||
|
||||
MERGE INTO s2_available_date_info(`id`,`item_id` ,`type` ,`date_format` ,`start_date` ,`end_date` ,`unavailable_date` ,`created_at` ,`created_by` ,`updated_at` ,`updated_by` )
|
||||
values (1 , 1, 'dimension', 'yyyy-MM-dd', DATEADD('DAY', -28, CURRENT_DATE()), DATEADD('DAY', -1, CURRENT_DATE()), '[]', '2023-06-01', 'admin', '2023-06-01', 'admin');
|
||||
MERGE INTO s2_available_date_info(`id`,`item_id` ,`type` ,`date_format` ,`start_date` ,`end_date` ,`unavailable_date` ,`created_at` ,`created_by` ,`updated_at` ,`updated_by` )
|
||||
@@ -13,7 +12,6 @@ values (2 , 2, 'dimension', 'yyyy-MM-dd', DATEADD('DAY', -28, CURRENT_DATE()), D
|
||||
MERGE INTO s2_available_date_info(`id`,`item_id` ,`type` ,`date_format` ,`start_date` ,`end_date` ,`unavailable_date` ,`created_at` ,`created_by` ,`updated_at` ,`updated_by` )
|
||||
values (3 , 3, 'dimension', 'yyyy-MM-dd', DATEADD('DAY', -28, CURRENT_DATE()), DATEADD('DAY', -1, CURRENT_DATE()), '[]', '2023-06-01', 'admin', '2023-06-01', 'admin');
|
||||
|
||||
|
||||
MERGE INTO s2_canvas(`id`, `domain_id`, `type`, `config` ,`created_at` ,`created_by` ,`updated_at` ,`updated_by` )
|
||||
values (1, 1, 'modelEdgeRelation', '[{"source":"datasource-1","target":"datasource-3","type":"polyline","id":"edge-0.305251275235679741702883718912","style":{"active":{"stroke":"rgb(95, 149, 255)","lineWidth":1},"selected":{"stroke":"rgb(95, 149, 255)","lineWidth":2,"shadowColor":"rgb(95, 149, 255)","shadowBlur":10,"text-shape":{"fontWeight":500}},"highlight":{"stroke":"rgb(95, 149, 255)","lineWidth":2,"text-shape":{"fontWeight":500}},"inactive":{"stroke":"rgb(234, 234, 234)","lineWidth":1},"disable":{"stroke":"rgb(245, 245, 245)","lineWidth":1},"stroke":"#296df3","endArrow":true},"startPoint":{"x":-94,"y":-137.5,"anchorIndex":0,"id":"-94|||-137.5"},"endPoint":{"x":-234,"y":-45,"anchorIndex":1,"id":"-234|||-45"},"sourceAnchor":2,"targetAnchor":1,"label":"模型关系编辑"},{"source":"datasource-1","target":"datasource-2","type":"polyline","id":"edge-0.466237264629309141702883756359","style":{"active":{"stroke":"rgb(95, 149, 255)","lineWidth":1},"selected":{"stroke":"rgb(95, 149, 255)","lineWidth":2,"shadowColor":"rgb(95, 149, 255)","shadowBlur":10,"text-shape":{"fontWeight":500}},"highlight":{"stroke":"rgb(95, 149, 255)","lineWidth":2,"text-shape":{"fontWeight":500}},"inactive":{"stroke":"rgb(234, 234, 234)","lineWidth":1},"disable":{"stroke":"rgb(245, 245, 245)","lineWidth":1},"stroke":"#296df3","endArrow":true},"startPoint":{"x":-12,"y":-137.5,"anchorIndex":1,"id":"-12|||-137.5"},"endPoint":{"x":85,"y":31.5,"anchorIndex":0,"id":"85|||31.5"},"sourceAnchor":1,"targetAnchor":2,"label":"模型关系编辑"}]', '2023-06-01', 'admin', '2023-06-01', 'admin');
|
||||
|
||||
@@ -1113,4 +1111,29 @@ MERGE INTO song(imp_date,song_name,artist_name,country,f_id,g_name,rating,langua
|
||||
MERGE INTO song(imp_date,song_name,artist_name,country,f_id,g_name,rating,languages,releasedate,resolution) VALUES (DATEADD('DAY', 0, CURRENT_DATE()),'打败它','Michel','英国',5,'流行',8,'英文','17-MAR-2002',720);
|
||||
MERGE INTO song(imp_date,song_name,artist_name,country,f_id,g_name,rating,languages,releasedate,resolution) VALUES (DATEADD('DAY', 0, CURRENT_DATE()),'阿杰伊阿卡什','Topu','印度',6,'现代',10,'孟加拉语','27-MAR-2004',320);
|
||||
|
||||
|
||||
MERGE into company(imp_date,company_id,company_name,headquarter_address,company_established_time,founder,ceo,annual_turnover,employee_count) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_131','百度集团','北京','2000','李彦宏','李彦宏',102300000000,40000);
|
||||
MERGE into company(imp_date,company_id,company_name,headquarter_address,company_established_time,founder,ceo,annual_turnover,employee_count) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_132','阿里巴巴集团','杭州','1999年','马云','张勇',376800000000,103699);
|
||||
MERGE into company(imp_date,company_id,company_name,headquarter_address,company_established_time,founder,ceo,annual_turnover,employee_count) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_133','深圳市腾讯计算机系统有限公司','深圳','1998','马化腾','刘炽平',321600000000,56310);
|
||||
MERGE into company(imp_date,company_id,company_name,headquarter_address,company_established_time,founder,ceo,annual_turnover,employee_count) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_134','北京京东世纪贸易有限公司','北京','1998','刘强东','刘强东',28800000000,179000);
|
||||
MERGE into company(imp_date,company_id,company_name,headquarter_address,company_established_time,founder,ceo,annual_turnover,employee_count) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_135','网易公司','杭州','1997','丁磊','丁磊',67500000000,20000);
|
||||
|
||||
MERGE into brand(imp_date,brand_id,brand_name,brand_established_time,company_id,legal_representative,registered_capital) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_136','阿里云','2009年9月10日','item_enterprise_13_132','张勇',50000000);
|
||||
MERGE into brand(imp_date,brand_id,brand_name,brand_established_time,company_id,legal_representative,registered_capital) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_137','天猫','2012年1月11日','item_enterprise_13_132','张勇',100000000);
|
||||
MERGE into brand(imp_date,brand_id,brand_name,brand_established_time,company_id,legal_representative,registered_capital) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_138','腾讯游戏','2003','item_enterprise_13_133','马化腾',50000000);
|
||||
MERGE into brand(imp_date,brand_id,brand_name,brand_established_time,company_id,legal_representative,registered_capital) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_139','度小满','2018','item_enterprise_13_131','朱光',100000000);
|
||||
MERGE into brand(imp_date,brand_id,brand_name,brand_established_time,company_id,legal_representative,registered_capital) VALUES (DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_140','京东金融','2017','item_enterprise_13_134','刘强东',100000000);
|
||||
|
||||
insert into company_revenue(imp_date,company_id,brand_id,revenue_proportion,profit_proportion,expenditure_proportion) VALUES ( DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_131','item_enterprise_13_139',10,10,30);
|
||||
insert into company_revenue(imp_date,company_id,brand_id,revenue_proportion,profit_proportion,expenditure_proportion) VALUES ( DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_133','item_enterprise_13_138',80,80,60);
|
||||
insert into company_revenue(imp_date,company_id,brand_id,revenue_proportion,profit_proportion,expenditure_proportion) VALUES ( DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_134','item_enterprise_13_140',80,80,60);
|
||||
insert into company_revenue(imp_date,company_id,brand_id,revenue_proportion,profit_proportion,expenditure_proportion) VALUES ( DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_132','item_enterprise_13_137',80,80,60);
|
||||
insert into company_revenue(imp_date,company_id,brand_id,revenue_proportion,profit_proportion,expenditure_proportion) VALUES ( DATEADD('DAY', -1, CURRENT_DATE()),'item_enterprise_13_132','item_enterprise_13_136',10,10,30);
|
||||
|
||||
insert into company_brand_revenue(imp_date,year_time,brand_id,revenue,profit,revenue_growth_year_on_year,profit_growth_year_on_year) VALUES (DATEADD('DAY', -1, CURRENT_DATE()), '2018','item_enterprise_13_138',500000000,-300000000,10,-10);
|
||||
insert into company_brand_revenue(imp_date,year_time,brand_id,revenue,profit,revenue_growth_year_on_year,profit_growth_year_on_year) VALUES (DATEADD('DAY', -1, CURRENT_DATE()), '2019','item_enterprise_13_136',100000000000,50000000000,100,50);
|
||||
insert into company_brand_revenue(imp_date,year_time,brand_id,revenue,profit,revenue_growth_year_on_year,profit_growth_year_on_year) VALUES ( DATEADD('DAY', -1, CURRENT_DATE()),'2018','item_enterprise_13_137',100000000000,50000000000,100,-10);
|
||||
insert into company_brand_revenue(imp_date,year_time,brand_id,revenue,profit,revenue_growth_year_on_year,profit_growth_year_on_year) VALUES (DATEADD('DAY', -1, CURRENT_DATE()), '2018','item_enterprise_13_139',500000000,50000000000,10,50);
|
||||
insert into company_brand_revenue(imp_date,year_time,brand_id,revenue,profit,revenue_growth_year_on_year,profit_growth_year_on_year) VALUES ( DATEADD('DAY', -1, CURRENT_DATE()),'2018','item_enterprise_13_140',100000000000,-300000000,10,50);
|
||||
|
||||
-- benchmark
|
||||
|
||||
@@ -242,14 +242,14 @@ create table IF NOT EXISTS s2_canvas
|
||||
updated_by varchar(100) not null,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
COMMENT ON TABLE s2_canvas IS 'view information table';
|
||||
COMMENT ON TABLE s2_canvas IS 'canvas table';
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `s2_query_stat_info` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`trace_id` varchar(200) DEFAULT NULL, -- query unique identifier
|
||||
`model_id` INT DEFAULT NULL,
|
||||
`view_id` INT DEFAULT NULL,
|
||||
`data_set_id` INT DEFAULT NULL,
|
||||
`user` varchar(200) DEFAULT NULL,
|
||||
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
|
||||
`query_type` varchar(200) DEFAULT NULL, -- the corresponding scene
|
||||
@@ -327,7 +327,7 @@ CREATE TABLE IF NOT EXISTS `s2_plugin`
|
||||
(
|
||||
`id` INT AUTO_INCREMENT,
|
||||
`type` varchar(50) NULL,
|
||||
`view` varchar(100) NULL,
|
||||
`data_set` varchar(100) NULL,
|
||||
`pattern` varchar(500) NULL,
|
||||
`parse_mode` varchar(100) NULL,
|
||||
`parse_mode_config` LONGVARCHAR NULL,
|
||||
@@ -467,6 +467,51 @@ CREATE TABLE IF NOT EXISTS `song` (
|
||||
);
|
||||
COMMENT ON TABLE song IS 'song';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `company` (
|
||||
`imp_date` varchar(50) ,
|
||||
`company_id` varchar(50) NOT NULL ,
|
||||
`company_name` varchar(50) NOT NULL ,
|
||||
`headquarter_address` varchar(50) NOT NULL ,
|
||||
`company_established_time` varchar(20) NOT NULL ,
|
||||
`founder` varchar(20) NOT NULL ,
|
||||
`ceo` varchar(20) NOT NULL ,
|
||||
`annual_turnover` bigint(15) ,
|
||||
`employee_count` int(7) ,
|
||||
PRIMARY KEY (`company_id`)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `brand` (
|
||||
`imp_date` varchar(50) ,
|
||||
`brand_id` varchar(50) NOT NULL ,
|
||||
`brand_name` varchar(50) NOT NULL ,
|
||||
`brand_established_time` varchar(20) NOT NULL ,
|
||||
`company_id` varchar(50) NOT NULL ,
|
||||
`legal_representative` varchar(20) NOT NULL ,
|
||||
`registered_capital` bigint(15) ,
|
||||
PRIMARY KEY (`brand_id`)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `company_revenue` (
|
||||
`imp_date` varchar(50) ,
|
||||
`company_id` varchar(50) NOT NULL ,
|
||||
`brand_id` varchar(50) NOT NULL ,
|
||||
`revenue_proportion` double NOT NULL,
|
||||
`profit_proportion` double NOT NULL ,
|
||||
`expenditure_proportion` double NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `company_brand_revenue` (
|
||||
`imp_date` varchar(50) ,
|
||||
`year_time` varchar(10) NOT NULL ,
|
||||
`brand_id` varchar(50) NOT NULL ,
|
||||
`revenue` bigint(15) NOT NULL,
|
||||
`profit` bigint(15) NOT NULL ,
|
||||
`revenue_growth_year_on_year` double NOT NULL ,
|
||||
`profit_growth_year_on_year` double NOT NULL
|
||||
);
|
||||
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS s2_sys_parameter
|
||||
(
|
||||
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
@@ -512,7 +557,7 @@ CREATE TABLE IF NOT EXISTS `s2_app` (
|
||||
updated_by VARCHAR(255)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `s2_view` (
|
||||
CREATE TABLE IF NOT EXISTS `s2_data_set` (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
domain_id BIGINT,
|
||||
`name` VARCHAR(255),
|
||||
@@ -520,12 +565,11 @@ CREATE TABLE IF NOT EXISTS `s2_view` (
|
||||
description VARCHAR(255),
|
||||
status INT,
|
||||
alias VARCHAR(255),
|
||||
view_detail TEXT,
|
||||
data_set_detail TEXT,
|
||||
created_at TIMESTAMP,
|
||||
created_by VARCHAR(255),
|
||||
updated_at TIMESTAMP,
|
||||
updated_by VARCHAR(255),
|
||||
filter_sql VARCHAR(1000),
|
||||
query_config VARCHAR(3000),
|
||||
`admin` varchar(3000) DEFAULT NULL,
|
||||
`admin_org` varchar(3000) DEFAULT NULL
|
||||
|
||||
Reference in New Issue
Block a user