mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 12:07:42 +00:00
[improvement][supersonic] add text-to-sql evaluation (#696)
* [improvement] llm supports all models * [improvement] alias convert to SemanticParseInfo * [improvement] support join * [improvement] add evaluation.py * [improvement] add text2sql_evalution.py * [improvement] add text2sql_evalution.py * [improvement] add evalution * [improvement] add evalution * [improvement] add evalution --------- Co-authored-by: zuopengge <hwzuopengge@tencent.com>
This commit is contained in:
@@ -91,6 +91,7 @@ public class ChatDemoLoader implements CommandLineRunner {
|
||||
addAgent1();
|
||||
addAgent2();
|
||||
addAgent3();
|
||||
addAgent4();
|
||||
addSampleChats();
|
||||
addSampleChats2();
|
||||
updateQueryScore(1);
|
||||
@@ -508,6 +509,26 @@ public class ChatDemoLoader implements CommandLineRunner {
|
||||
agentService.createAgent(agent, User.getFakeUser());
|
||||
}
|
||||
|
||||
private void addAgent4() {
|
||||
Agent agent = new Agent();
|
||||
agent.setId(4);
|
||||
agent.setName("DuSQL 互联网企业");
|
||||
agent.setDescription("DuSQL");
|
||||
agent.setStatus(1);
|
||||
agent.setEnableSearch(1);
|
||||
agent.setExamples(Lists.newArrayList());
|
||||
AgentConfig agentConfig = new AgentConfig();
|
||||
|
||||
LLMParserTool llmParserTool = new LLMParserTool();
|
||||
llmParserTool.setId("1");
|
||||
llmParserTool.setType(AgentToolType.NL2SQL_LLM);
|
||||
llmParserTool.setModelIds(Lists.newArrayList(9L, 10L, 11L, 12L));
|
||||
agentConfig.getTools().add(llmParserTool);
|
||||
|
||||
agent.setAgentConfig(JSONObject.toJSONString(agentConfig));
|
||||
agentService.createAgent(agent, User.getFakeUser());
|
||||
}
|
||||
|
||||
private void updateQueryScore(Integer queryId) {
|
||||
chatService.updateFeedback(queryId, 5, "");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,292 @@
|
||||
package com.tencent.supersonic;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.tencent.supersonic.auth.api.authentication.pojo.User;
|
||||
import com.tencent.supersonic.common.pojo.JoinCondition;
|
||||
import com.tencent.supersonic.common.pojo.ModelRela;
|
||||
import com.tencent.supersonic.common.pojo.enums.AggOperatorEnum;
|
||||
import com.tencent.supersonic.common.pojo.enums.FilterOperatorEnum;
|
||||
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.Dim;
|
||||
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.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.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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class DuSQLDemoDataLoader {
|
||||
|
||||
private User user = User.getFakeUser();
|
||||
|
||||
@Autowired
|
||||
private DomainService domainService;
|
||||
@Autowired
|
||||
private ModelService modelService;
|
||||
@Autowired
|
||||
private ModelRelaService modelRelaService;
|
||||
@Autowired
|
||||
private MetricService metricService;
|
||||
|
||||
public void doRun() {
|
||||
try {
|
||||
addDomain();
|
||||
addModel_1();
|
||||
addModel_2();
|
||||
addModel_3();
|
||||
addModel_4();
|
||||
addModelRela_1();
|
||||
addModelRela_2();
|
||||
addModelRela_3();
|
||||
addModelRela_4();
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to add bench mark demo data", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void addDomain() {
|
||||
DomainReq domainReq = new DomainReq();
|
||||
domainReq.setName("DuSQL_互联网企业");
|
||||
domainReq.setBizName("internet");
|
||||
domainReq.setParentId(0L);
|
||||
domainReq.setViewers(Arrays.asList("admin", "tom", "jack"));
|
||||
domainReq.setViewOrgs(Collections.singletonList("1"));
|
||||
domainReq.setAdmins(Collections.singletonList("admin"));
|
||||
domainReq.setAdminOrgs(Collections.emptyList());
|
||||
domainService.createDomain(domainReq, user);
|
||||
}
|
||||
|
||||
//9
|
||||
public void addModel_1() throws Exception {
|
||||
ModelReq modelReq = new ModelReq();
|
||||
modelReq.setName("公司");
|
||||
modelReq.setBizName("company");
|
||||
modelReq.setDescription("公司");
|
||||
modelReq.setDatabaseId(1L);
|
||||
modelReq.setDomainId(4L);
|
||||
modelReq.setViewers(Arrays.asList("admin", "tom", "jack"));
|
||||
modelReq.setViewOrgs(Collections.singletonList("1"));
|
||||
modelReq.setAdmins(Collections.singletonList("admin"));
|
||||
modelReq.setAdminOrgs(Collections.emptyList());
|
||||
ModelDetail modelDetail = new ModelDetail();
|
||||
List<Dim> dimensions = new ArrayList<>();
|
||||
Dim dimension1 = new Dim("", "imp_date", DimensionType.time.name(), 0);
|
||||
DimensionTimeTypeParams dimensionTimeTypeParams = new DimensionTimeTypeParams("false", "none");
|
||||
dimension1.setTypeParams(dimensionTimeTypeParams);
|
||||
dimensions.add(dimension1);
|
||||
dimensions.add(new Dim("公司名称", "company_name", DimensionType.categorical.name(), 1));
|
||||
dimensions.add(new Dim("总部地点", "headquarter_address", DimensionType.categorical.name(), 1));
|
||||
dimensions.add(new Dim("公司成立时间", "company_established_time", DimensionType.categorical.name(), 1));
|
||||
dimensions.add(new Dim("创始人", "founder", DimensionType.categorical.name(), 1));
|
||||
dimensions.add(new Dim("首席执行官", "ceo", DimensionType.categorical.name(), 1));
|
||||
modelDetail.setDimensions(dimensions);
|
||||
|
||||
List<Identify> identifiers = new ArrayList<>();
|
||||
identifiers.add(new Identify("公司id", IdentifyType.primary.name(), "company_id"));
|
||||
modelDetail.setIdentifiers(identifiers);
|
||||
|
||||
List<Measure> measures = new ArrayList<>();
|
||||
measures.add(new Measure("年营业额", "annual_turnover", AggOperatorEnum.SUM.name(), 1));
|
||||
Measure measure = new Measure("员工数", "employee_count", AggOperatorEnum.SUM.name(), 1);
|
||||
measures.add(measure);
|
||||
modelDetail.setMeasures(measures);
|
||||
|
||||
modelDetail.setQueryType("sql_query");
|
||||
modelDetail.setSqlQuery("SELECT imp_date,company_id,company_name,headquarter_address,"
|
||||
+ "company_established_time,founder,ceo,annual_turnover,employee_count FROM company");
|
||||
modelReq.setModelDetail(modelDetail);
|
||||
modelService.createModel(modelReq, user);
|
||||
}
|
||||
|
||||
// 10
|
||||
public void addModel_2() throws Exception {
|
||||
ModelReq modelReq = new ModelReq();
|
||||
modelReq.setName("品牌");
|
||||
modelReq.setBizName("brand");
|
||||
modelReq.setDescription("品牌");
|
||||
modelReq.setDatabaseId(1L);
|
||||
modelReq.setDomainId(4L);
|
||||
modelReq.setViewers(Arrays.asList("admin", "tom", "jack"));
|
||||
modelReq.setViewOrgs(Collections.singletonList("1"));
|
||||
modelReq.setAdmins(Collections.singletonList("admin"));
|
||||
modelReq.setAdminOrgs(Collections.emptyList());
|
||||
ModelDetail modelDetail = new ModelDetail();
|
||||
List<Dim> dimensions = new ArrayList<>();
|
||||
Dim dimension1 = new Dim("", "imp_date", DimensionType.time.name(), 0);
|
||||
DimensionTimeTypeParams dimensionTimeTypeParams = new DimensionTimeTypeParams("false", "none");
|
||||
dimension1.setTypeParams(dimensionTimeTypeParams);
|
||||
dimensions.add(dimension1);
|
||||
dimensions.add(new Dim("品牌名称", "brand_name", DimensionType.categorical.name(), 1));
|
||||
dimensions.add(new Dim("品牌成立时间", "brand_established_time", DimensionType.categorical.name(), 1));
|
||||
dimensions.add(new Dim("法定代表人", "legal_representative", DimensionType.categorical.name(), 1));
|
||||
modelDetail.setDimensions(dimensions);
|
||||
|
||||
List<Identify> identifiers = new ArrayList<>();
|
||||
identifiers.add(new Identify("品牌id", IdentifyType.primary.name(), "brand_id"));
|
||||
identifiers.add(new Identify("公司id", IdentifyType.foreign.name(), "company_id"));
|
||||
modelDetail.setIdentifiers(identifiers);
|
||||
|
||||
List<Measure> measures = new ArrayList<>();
|
||||
measures.add(new Measure("注册资本", "registered_capital", AggOperatorEnum.SUM.name(), 1));
|
||||
modelDetail.setMeasures(measures);
|
||||
|
||||
modelDetail.setQueryType("sql_query");
|
||||
modelDetail.setSqlQuery("SELECT imp_date,brand_id,brand_name,brand_established_time,"
|
||||
+ "company_id,legal_representative,registered_capital FROM brand");
|
||||
modelReq.setModelDetail(modelDetail);
|
||||
modelService.createModel(modelReq, user);
|
||||
}
|
||||
|
||||
// 11
|
||||
public void addModel_3() throws Exception {
|
||||
ModelReq modelReq = new ModelReq();
|
||||
modelReq.setName("公司各品牌收入排名");
|
||||
modelReq.setBizName("company_revenue");
|
||||
modelReq.setDescription("公司各品牌收入排名");
|
||||
modelReq.setDatabaseId(1L);
|
||||
modelReq.setDomainId(4L);
|
||||
modelReq.setViewers(Arrays.asList("admin", "tom", "jack"));
|
||||
modelReq.setViewOrgs(Collections.singletonList("1"));
|
||||
modelReq.setAdmins(Collections.singletonList("admin"));
|
||||
modelReq.setAdminOrgs(Collections.emptyList());
|
||||
ModelDetail modelDetail = new ModelDetail();
|
||||
List<Dim> dimensions = new ArrayList<>();
|
||||
Dim dimension1 = new Dim("", "imp_date", DimensionType.time.name(), 0);
|
||||
DimensionTimeTypeParams dimensionTimeTypeParams = new DimensionTimeTypeParams("false", "none");
|
||||
dimension1.setTypeParams(dimensionTimeTypeParams);
|
||||
dimensions.add(dimension1);
|
||||
modelDetail.setDimensions(dimensions);
|
||||
|
||||
List<Identify> identifiers = new ArrayList<>();
|
||||
identifiers.add(new Identify("公司id", IdentifyType.foreign.name(), "company_id"));
|
||||
identifiers.add(new Identify("品牌id", IdentifyType.foreign.name(), "brand_id"));
|
||||
modelDetail.setIdentifiers(identifiers);
|
||||
|
||||
List<Measure> measures = new ArrayList<>();
|
||||
Measure measure = new Measure("营收占比", "revenue_proportion", AggOperatorEnum.SUM.name(), 1);
|
||||
measures.add(measure);
|
||||
measures.add(new Measure("利润占比", "profit_proportion", AggOperatorEnum.SUM.name(), 1));
|
||||
measures.add(new Measure("支出占比", "expenditure_proportion", AggOperatorEnum.SUM.name(), 1));
|
||||
modelDetail.setMeasures(measures);
|
||||
|
||||
modelDetail.setQueryType("sql_query");
|
||||
modelDetail.setSqlQuery("SELECT imp_date,company_id,brand_id,revenue_proportion,"
|
||||
+ "profit_proportion,expenditure_proportion FROM company_revenue");
|
||||
modelReq.setModelDetail(modelDetail);
|
||||
modelService.createModel(modelReq, user);
|
||||
MetricResp metricResp = metricService.getMetric(13L, user);
|
||||
|
||||
MetricReq metricReq = new MetricReq();
|
||||
BeanUtils.copyProperties(metricResp, metricReq);
|
||||
metricReq.setAlias("收入比例");
|
||||
metricService.updateMetric(metricReq, user);
|
||||
}
|
||||
|
||||
// 12
|
||||
public void addModel_4() throws Exception {
|
||||
ModelReq modelReq = new ModelReq();
|
||||
modelReq.setName("公司品牌历年收入");
|
||||
modelReq.setBizName("company_brand_revenue");
|
||||
modelReq.setDescription("公司品牌历年收入");
|
||||
modelReq.setDatabaseId(1L);
|
||||
modelReq.setDomainId(4L);
|
||||
modelReq.setViewers(Arrays.asList("admin", "tom", "jack"));
|
||||
modelReq.setViewOrgs(Collections.singletonList("1"));
|
||||
modelReq.setAdmins(Collections.singletonList("admin"));
|
||||
modelReq.setAdminOrgs(Collections.emptyList());
|
||||
ModelDetail modelDetail = new ModelDetail();
|
||||
List<Dim> dimensions = new ArrayList<>();
|
||||
Dim dimension1 = new Dim("", "imp_date", DimensionType.time.name(), 0);
|
||||
DimensionTimeTypeParams dimensionTimeTypeParams = new DimensionTimeTypeParams("false", "none");
|
||||
dimension1.setTypeParams(dimensionTimeTypeParams);
|
||||
dimensions.add(dimension1);
|
||||
dimensions.add(new Dim("年份", "year_time", DimensionType.categorical.name(), 1));
|
||||
modelDetail.setDimensions(dimensions);
|
||||
|
||||
List<Identify> identifiers = new ArrayList<>();
|
||||
identifiers.add(new Identify("品牌id", IdentifyType.foreign.name(), "brand_id"));
|
||||
modelDetail.setIdentifiers(identifiers);
|
||||
|
||||
List<Measure> measures = new ArrayList<>();
|
||||
measures.add(new Measure("营收", "revenue", AggOperatorEnum.SUM.name(), 1));
|
||||
measures.add(new Measure("利润", "profit", AggOperatorEnum.SUM.name(), 1));
|
||||
measures.add(new Measure("营收同比增长", "revenue_growth_year_on_year", AggOperatorEnum.SUM.name(), 1));
|
||||
measures.add(new Measure("利润同比增长", "profit_growth_year_on_year", AggOperatorEnum.SUM.name(), 1));
|
||||
modelDetail.setMeasures(measures);
|
||||
|
||||
modelDetail.setQueryType("sql_query");
|
||||
modelDetail.setSqlQuery("SELECT imp_date,year_time,brand_id,revenue,profit,"
|
||||
+ "revenue_growth_year_on_year,profit_growth_year_on_year FROM company_brand_revenue");
|
||||
modelReq.setModelDetail(modelDetail);
|
||||
modelService.createModel(modelReq, user);
|
||||
|
||||
}
|
||||
|
||||
public void addModelRela_1() {
|
||||
List<JoinCondition> joinConditions = Lists.newArrayList();
|
||||
joinConditions.add(new JoinCondition("company_id", "company_id", FilterOperatorEnum.EQUALS));
|
||||
ModelRela modelRelaReq = new ModelRela();
|
||||
modelRelaReq.setDomainId(4L);
|
||||
modelRelaReq.setFromModelId(9L);
|
||||
modelRelaReq.setToModelId(10L);
|
||||
modelRelaReq.setJoinType("inner join");
|
||||
modelRelaReq.setJoinConditions(joinConditions);
|
||||
modelRelaService.save(modelRelaReq, user);
|
||||
}
|
||||
|
||||
public void addModelRela_2() {
|
||||
List<JoinCondition> joinConditions = Lists.newArrayList();
|
||||
joinConditions.add(new JoinCondition("company_id", "company_id", FilterOperatorEnum.EQUALS));
|
||||
ModelRela modelRelaReq = new ModelRela();
|
||||
modelRelaReq.setDomainId(4L);
|
||||
modelRelaReq.setFromModelId(9L);
|
||||
modelRelaReq.setToModelId(11L);
|
||||
modelRelaReq.setJoinType("inner join");
|
||||
modelRelaReq.setJoinConditions(joinConditions);
|
||||
modelRelaService.save(modelRelaReq, user);
|
||||
}
|
||||
|
||||
public void addModelRela_3() {
|
||||
List<JoinCondition> joinConditions = Lists.newArrayList();
|
||||
joinConditions.add(new JoinCondition("brand_id", "brand_id", FilterOperatorEnum.EQUALS));
|
||||
ModelRela modelRelaReq = new ModelRela();
|
||||
modelRelaReq.setDomainId(4L);
|
||||
modelRelaReq.setFromModelId(10L);
|
||||
modelRelaReq.setToModelId(11L);
|
||||
modelRelaReq.setJoinType("inner join");
|
||||
modelRelaReq.setJoinConditions(joinConditions);
|
||||
modelRelaService.save(modelRelaReq, user);
|
||||
}
|
||||
|
||||
public void addModelRela_4() {
|
||||
List<JoinCondition> joinConditions = Lists.newArrayList();
|
||||
joinConditions.add(new JoinCondition("brand_id", "brand_id", FilterOperatorEnum.EQUALS));
|
||||
ModelRela modelRelaReq = new ModelRela();
|
||||
modelRelaReq.setDomainId(4L);
|
||||
modelRelaReq.setFromModelId(10L);
|
||||
modelRelaReq.setToModelId(12L);
|
||||
modelRelaReq.setJoinType("inner join");
|
||||
modelRelaReq.setJoinConditions(joinConditions);
|
||||
modelRelaService.save(modelRelaReq, user);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,6 +25,9 @@ public class HeadlessDemoLoader implements CommandLineRunner {
|
||||
@Autowired
|
||||
private BenchMarkDemoDataLoader benchMarkDemoLoader;
|
||||
|
||||
@Autowired
|
||||
private DuSQLDemoDataLoader duSQLDemoDataLoader;
|
||||
|
||||
@Value("${demo.enabled:false}")
|
||||
private boolean demoEnabled;
|
||||
|
||||
@@ -36,6 +39,7 @@ public class HeadlessDemoLoader implements CommandLineRunner {
|
||||
}
|
||||
modelDataDemoLoader.doRun();
|
||||
benchMarkDemoLoader.doRun();
|
||||
duSQLDemoDataLoader.doRun();
|
||||
isLoad = true;
|
||||
}
|
||||
|
||||
@@ -50,4 +54,4 @@ public class HeadlessDemoLoader implements CommandLineRunner {
|
||||
return isLoad;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,4 +91,4 @@ inMemoryEmbeddingStore:
|
||||
|
||||
query:
|
||||
optimizer:
|
||||
enable: true
|
||||
enable: true
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
阿里云 _10_20 5
|
||||
天猫 _10_20 5
|
||||
腾讯游戏 _10_20 5
|
||||
度小满 _10_20 5
|
||||
京东金融 _10_20 5
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
张勇 _10_22 5
|
||||
马化腾 _10_22 5
|
||||
朱光 _10_22 5
|
||||
刘强东 _10_22 5
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
百度集团 _9_15 5
|
||||
阿里巴巴集团 _9_15 5
|
||||
深圳市腾讯计算机系统有限公司 _9_15 5
|
||||
北京京东世纪贸易有限公司 _9_15 5
|
||||
网易公司 _9_15 5
|
||||
@@ -0,0 +1,4 @@
|
||||
北京 _9_16 5
|
||||
杭州 _9_16 5
|
||||
深圳 _9_16 5
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
李彦宏 _9_18 5
|
||||
马云 _9_18 5
|
||||
马化腾 _9_18 5
|
||||
刘强东 _9_18 5
|
||||
丁磊 _9_18 5
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
李彦宏 _9_19 5
|
||||
张勇 _9_19 5
|
||||
刘炽平 _9_19 5
|
||||
刘强东 _9_19 5
|
||||
丁磊 _9_19 5
|
||||
|
||||
|
||||
@@ -1111,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);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
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_134','张勇',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_134','张勇',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_131','马化腾',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_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_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_134','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_135','item_enterprise_13_139',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_131','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_135','item_enterprise_13_137',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_138',100000000000,-300000000,10,50);
|
||||
|
||||
-- benchmark
|
||||
|
||||
@@ -455,6 +455,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,
|
||||
@@ -498,4 +543,4 @@ CREATE TABLE IF NOT EXISTS `s2_app` (
|
||||
created_by VARCHAR(255),
|
||||
updated_at TIMESTAMP,
|
||||
updated_by VARCHAR(255)
|
||||
);
|
||||
);
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
root=.
|
||||
CustomDictionaryPath=data/dictionary/custom/DimValue_1_1.txt;data/dictionary/custom/DimValue_1_2.txt;data/dictionary/custom/DimValue_1_3.txt;data/dictionary/custom/benchmark_cspider.txt;
|
||||
CustomDictionaryPath=data/dictionary/custom/DimValue_1_1.txt;data/dictionary/custom/DimValue_1_2.txt;data/dictionary/custom/DimValue_9_15.txt;data/dictionary/custom/DimValue_9_16.txt;data/dictionary/custom/DimValue_9_18.txt;data/dictionary/custom/DimValue_9_19.txt;data/dictionary/custom/DimValue_10_20.txt;data/dictionary/custom/DimValue_10_22.txt;
|
||||
|
||||
Reference in New Issue
Block a user