mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 19:51:00 +00:00
(improvement)(test) Fix Python exemplar file name error and fix chat unit tests. (#661)
This commit is contained in:
@@ -51,7 +51,7 @@ text2sql_agent.reload_setting(sql_ids, sql_exemplars, TEXT2DSL_EXAMPLE_NUM, TEXT
|
||||
if text2sql_agent_autoCoT.count_examples()==0:
|
||||
source_dir_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
example_dir_path = os.path.join(source_dir_path, 'few_shot_example')
|
||||
example_json_file = os.path.join(example_dir_path, 's2ql_examplar3_transformed.json')
|
||||
example_json_file = os.path.join(example_dir_path, 's2sql_exemplar3_transformed.json.json')
|
||||
with open(example_json_file, 'r', encoding='utf-8') as f:
|
||||
transformed_sql_examplar_list = json.load(f)
|
||||
|
||||
|
||||
@@ -47,10 +47,11 @@ public class BaseQueryTest {
|
||||
@MockBean
|
||||
protected AgentService agentService;
|
||||
|
||||
protected QueryResult submitMultiTurnChat(String queryText) throws Exception {
|
||||
ParseResp parseResp = submitParse(queryText);
|
||||
protected QueryResult submitMultiTurnChat(String queryText, Integer agentId) throws Exception {
|
||||
ParseResp parseResp = submitParse(queryText, agentId);
|
||||
|
||||
ExecuteQueryReq request = ExecuteQueryReq.builder()
|
||||
.agentId(agentId)
|
||||
.queryId(parseResp.getQueryId())
|
||||
.parseId(parseResp.getSelectedParses().get(0).getId())
|
||||
.chatId(parseResp.getChatId())
|
||||
@@ -63,10 +64,11 @@ public class BaseQueryTest {
|
||||
return queryService.performExecution(request);
|
||||
}
|
||||
|
||||
protected QueryResult submitNewChat(String queryText) throws Exception {
|
||||
ParseResp parseResp = submitParse(queryText);
|
||||
protected QueryResult submitNewChat(String queryText, Integer agentId) throws Exception {
|
||||
ParseResp parseResp = submitParse(queryText, agentId);
|
||||
|
||||
ExecuteQueryReq request = ExecuteQueryReq.builder()
|
||||
.agentId(agentId)
|
||||
.queryId(parseResp.getQueryId())
|
||||
.parseId(parseResp.getSelectedParses().get(0).getId())
|
||||
.chatId(parseResp.getChatId())
|
||||
@@ -85,8 +87,9 @@ public class BaseQueryTest {
|
||||
return result;
|
||||
}
|
||||
|
||||
protected ParseResp submitParse(String queryText) {
|
||||
protected ParseResp submitParse(String queryText, Integer agentId) {
|
||||
QueryReq queryContextReq = DataUtils.getQueryContextReq(10, queryText);
|
||||
queryContextReq.setAgentId(agentId);
|
||||
return queryService.performParsing(queryContextReq);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public class MetricInterpretTest {
|
||||
|
||||
@Test
|
||||
public void testMetricInterpret() throws Exception {
|
||||
MockConfiguration.mockAgent(agentService);
|
||||
MockConfiguration.mockMetricAgent(agentService);
|
||||
MockConfiguration.mockEmbeddingUrl(embeddingConfig);
|
||||
|
||||
LLMAnswerResp lLmAnswerResp = new LLMAnswerResp();
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.tencent.supersonic.integration;
|
||||
|
||||
import static com.tencent.supersonic.common.pojo.enums.AggregateTypeEnum.NONE;
|
||||
import static com.tencent.supersonic.common.pojo.enums.AggregateTypeEnum.SUM;
|
||||
|
||||
import com.tencent.supersonic.chat.api.pojo.SemanticParseInfo;
|
||||
import com.tencent.supersonic.chat.api.pojo.request.QueryFilter;
|
||||
import com.tencent.supersonic.chat.api.pojo.response.ParseResp;
|
||||
@@ -9,27 +12,24 @@ import com.tencent.supersonic.chat.core.query.rule.metric.MetricGroupByQuery;
|
||||
import com.tencent.supersonic.chat.core.query.rule.metric.MetricModelQuery;
|
||||
import com.tencent.supersonic.chat.core.query.rule.metric.MetricTopNQuery;
|
||||
import com.tencent.supersonic.common.pojo.DateConf;
|
||||
import com.tencent.supersonic.common.pojo.enums.QueryType;
|
||||
import com.tencent.supersonic.common.pojo.enums.FilterOperatorEnum;
|
||||
import com.tencent.supersonic.common.pojo.enums.QueryType;
|
||||
import com.tencent.supersonic.util.DataUtils;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.tencent.supersonic.common.pojo.enums.AggregateTypeEnum.NONE;
|
||||
import static com.tencent.supersonic.common.pojo.enums.AggregateTypeEnum.SUM;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
public class MetricQueryTest extends BaseQueryTest {
|
||||
|
||||
@Test
|
||||
public void queryTest_metric_filter() throws Exception {
|
||||
QueryResult actualResult = submitNewChat("alice的访问次数");
|
||||
MockConfiguration.mockMetricAgent(agentService);
|
||||
QueryResult actualResult = submitNewChat("alice的访问次数", DataUtils.metricAgentId);
|
||||
|
||||
QueryResult expectedResult = new QueryResult();
|
||||
SemanticParseInfo expectedParseInfo = new SemanticParseInfo();
|
||||
@@ -52,8 +52,8 @@ public class MetricQueryTest extends BaseQueryTest {
|
||||
@Test
|
||||
public void queryTest_metric_filter_with_agent() {
|
||||
//agent only support METRIC_ENTITY, METRIC_FILTER
|
||||
MockConfiguration.mockAgent(agentService);
|
||||
ParseResp parseResp = submitParseWithAgent("alice的访问次数", DataUtils.getAgent().getId());
|
||||
MockConfiguration.mockMetricAgent(agentService);
|
||||
ParseResp parseResp = submitParseWithAgent("alice的访问次数", DataUtils.getMetricAgent().getId());
|
||||
Assert.assertNotNull(parseResp.getSelectedParses());
|
||||
List<String> queryModes = parseResp.getSelectedParses().stream()
|
||||
.map(SemanticParseInfo::getQueryMode).collect(Collectors.toList());
|
||||
@@ -62,7 +62,8 @@ public class MetricQueryTest extends BaseQueryTest {
|
||||
|
||||
@Test
|
||||
public void queryTest_metric_domain() throws Exception {
|
||||
QueryResult actualResult = submitNewChat("超音数的访问次数");
|
||||
MockConfiguration.mockMetricAgent(agentService);
|
||||
QueryResult actualResult = submitNewChat("超音数的访问次数", DataUtils.metricAgentId);
|
||||
|
||||
QueryResult expectedResult = new QueryResult();
|
||||
SemanticParseInfo expectedParseInfo = new SemanticParseInfo();
|
||||
@@ -82,8 +83,8 @@ public class MetricQueryTest extends BaseQueryTest {
|
||||
@Test
|
||||
public void queryTest_metric_model_with_agent() {
|
||||
//agent only support METRIC_ENTITY, METRIC_FILTER
|
||||
MockConfiguration.mockAgent(agentService);
|
||||
ParseResp parseResp = submitParseWithAgent("超音数的访问次数", DataUtils.getAgent().getId());
|
||||
MockConfiguration.mockMetricAgent(agentService);
|
||||
ParseResp parseResp = submitParseWithAgent("超音数的访问次数", DataUtils.getMetricAgent().getId());
|
||||
List<String> queryModes = parseResp.getSelectedParses().stream()
|
||||
.map(SemanticParseInfo::getQueryMode).collect(Collectors.toList());
|
||||
Assert.assertTrue(queryModes.contains("METRIC_MODEL"));
|
||||
@@ -91,7 +92,7 @@ public class MetricQueryTest extends BaseQueryTest {
|
||||
|
||||
@Test
|
||||
public void queryTest_metric_groupby() throws Exception {
|
||||
QueryResult actualResult = submitNewChat("超音数各部门的访问次数");
|
||||
QueryResult actualResult = submitNewChat("超音数各部门的访问次数", DataUtils.metricAgentId);
|
||||
|
||||
QueryResult expectedResult = new QueryResult();
|
||||
SemanticParseInfo expectedParseInfo = new SemanticParseInfo();
|
||||
@@ -111,7 +112,8 @@ public class MetricQueryTest extends BaseQueryTest {
|
||||
|
||||
@Test
|
||||
public void queryTest_metric_filter_compare() throws Exception {
|
||||
QueryResult actualResult = submitNewChat("对比alice和lucy的访问次数");
|
||||
MockConfiguration.mockMetricAgent(agentService);
|
||||
QueryResult actualResult = submitNewChat("对比alice和lucy的访问次数", DataUtils.metricAgentId);
|
||||
|
||||
QueryResult expectedResult = new QueryResult();
|
||||
SemanticParseInfo expectedParseInfo = new SemanticParseInfo();
|
||||
@@ -135,7 +137,7 @@ public class MetricQueryTest extends BaseQueryTest {
|
||||
|
||||
@Test
|
||||
public void queryTest_metric_topn() throws Exception {
|
||||
QueryResult actualResult = submitNewChat("近3天访问次数最多的用户");
|
||||
QueryResult actualResult = submitNewChat("近3天访问次数最多的用户", DataUtils.metricAgentId);
|
||||
|
||||
QueryResult expectedResult = new QueryResult();
|
||||
SemanticParseInfo expectedParseInfo = new SemanticParseInfo();
|
||||
@@ -157,7 +159,7 @@ public class MetricQueryTest extends BaseQueryTest {
|
||||
|
||||
@Test
|
||||
public void queryTest_metric_groupby_sum() throws Exception {
|
||||
QueryResult actualResult = submitNewChat("超音数各部门的访问次数总和");
|
||||
QueryResult actualResult = submitNewChat("超音数各部门的访问次数总和", DataUtils.metricAgentId);
|
||||
QueryResult expectedResult = new QueryResult();
|
||||
SemanticParseInfo expectedParseInfo = new SemanticParseInfo();
|
||||
expectedResult.setChatContext(expectedParseInfo);
|
||||
@@ -176,11 +178,12 @@ public class MetricQueryTest extends BaseQueryTest {
|
||||
|
||||
@Test
|
||||
public void queryTest_metric_filter_time() throws Exception {
|
||||
MockConfiguration.mockMetricAgent(agentService);
|
||||
DateFormat format = new SimpleDateFormat("yyyy-mm-dd");
|
||||
DateFormat textFormat = new SimpleDateFormat("yyyy年mm月dd日");
|
||||
String dateStr = textFormat.format(format.parse(startDay));
|
||||
|
||||
QueryResult actualResult = submitNewChat(String.format("想知道%salice的访问次数", dateStr));
|
||||
QueryResult actualResult = submitNewChat(String.format("想知道%salice的访问次数", dateStr), DataUtils.metricAgentId);
|
||||
|
||||
QueryResult expectedResult = new QueryResult();
|
||||
SemanticParseInfo expectedParseInfo = new SemanticParseInfo();
|
||||
|
||||
@@ -31,8 +31,13 @@ public class MockConfiguration {
|
||||
when(embeddingConfig.getUrl()).thenReturn("test");
|
||||
}
|
||||
|
||||
public static void mockAgent(AgentService agentService) {
|
||||
when(agentService.getAgent(1)).thenReturn(DataUtils.getAgent());
|
||||
public static void mockMetricAgent(AgentService agentService) {
|
||||
when(agentService.getAgent(1)).thenReturn(DataUtils.getMetricAgent());
|
||||
}
|
||||
|
||||
public static void mockTagAgent(AgentService agentService) {
|
||||
when(agentService.getAgent(2)).thenReturn(DataUtils.getTagAgent());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,8 @@ public class MultiTurnsTest extends BaseQueryTest {
|
||||
@Test
|
||||
@Order(1)
|
||||
public void queryTest_01() throws Exception {
|
||||
QueryResult actualResult = submitMultiTurnChat("alice的访问次数");
|
||||
MockConfiguration.mockMetricAgent(agentService);
|
||||
QueryResult actualResult = submitMultiTurnChat("alice的访问次数", DataUtils.metricAgentId);
|
||||
|
||||
QueryResult expectedResult = new QueryResult();
|
||||
SemanticParseInfo expectedParseInfo = new SemanticParseInfo();
|
||||
@@ -43,7 +44,8 @@ public class MultiTurnsTest extends BaseQueryTest {
|
||||
@Test
|
||||
@Order(2)
|
||||
public void queryTest_02() throws Exception {
|
||||
QueryResult actualResult = submitMultiTurnChat("停留时长呢");
|
||||
MockConfiguration.mockMetricAgent(agentService);
|
||||
QueryResult actualResult = submitMultiTurnChat("停留时长呢", DataUtils.metricAgentId);
|
||||
|
||||
QueryResult expectedResult = new QueryResult();
|
||||
SemanticParseInfo expectedParseInfo = new SemanticParseInfo();
|
||||
@@ -66,7 +68,8 @@ public class MultiTurnsTest extends BaseQueryTest {
|
||||
@Test
|
||||
@Order(3)
|
||||
public void queryTest_03() throws Exception {
|
||||
QueryResult actualResult = submitMultiTurnChat("lucy的如何");
|
||||
MockConfiguration.mockMetricAgent(agentService);
|
||||
QueryResult actualResult = submitMultiTurnChat("lucy的如何", DataUtils.metricAgentId);
|
||||
|
||||
QueryResult expectedResult = new QueryResult();
|
||||
SemanticParseInfo expectedParseInfo = new SemanticParseInfo();
|
||||
@@ -89,7 +92,8 @@ public class MultiTurnsTest extends BaseQueryTest {
|
||||
@Test
|
||||
@Order(4)
|
||||
public void queryTest_04() throws Exception {
|
||||
QueryResult actualResult = submitMultiTurnChat("按部门统计");
|
||||
MockConfiguration.mockMetricAgent(agentService);
|
||||
QueryResult actualResult = submitMultiTurnChat("按部门统计", DataUtils.metricAgentId);
|
||||
|
||||
QueryResult expectedResult = new QueryResult();
|
||||
SemanticParseInfo expectedParseInfo = new SemanticParseInfo();
|
||||
@@ -110,9 +114,11 @@ public class MultiTurnsTest extends BaseQueryTest {
|
||||
@Test
|
||||
@Order(5)
|
||||
public void queryTest_05() throws Exception {
|
||||
MockConfiguration.mockMetricAgent(agentService);
|
||||
DateFormat format = new SimpleDateFormat("yyyy-mm-dd");
|
||||
DateFormat textFormat = new SimpleDateFormat("yyyy年mm月dd日");
|
||||
QueryResult actualResult = submitMultiTurnChat(textFormat.format(format.parse(startDay)));
|
||||
QueryResult actualResult = submitMultiTurnChat(textFormat.format(format.parse(startDay)),
|
||||
DataUtils.metricAgentId);
|
||||
|
||||
QueryResult expectedResult = new QueryResult();
|
||||
SemanticParseInfo expectedParseInfo = new SemanticParseInfo();
|
||||
@@ -133,7 +139,8 @@ public class MultiTurnsTest extends BaseQueryTest {
|
||||
@Test
|
||||
@Order(6)
|
||||
public void queryTest_06() throws Exception {
|
||||
QueryResult actualResult = submitMultiTurnChat("近30天");
|
||||
MockConfiguration.mockMetricAgent(agentService);
|
||||
QueryResult actualResult = submitMultiTurnChat("近30天", DataUtils.metricAgentId);
|
||||
|
||||
QueryResult expectedResult = new QueryResult();
|
||||
SemanticParseInfo expectedParseInfo = new SemanticParseInfo();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.tencent.supersonic.integration;
|
||||
|
||||
import static com.tencent.supersonic.common.pojo.enums.AggregateTypeEnum.NONE;
|
||||
|
||||
import com.tencent.supersonic.chat.api.pojo.SchemaElement;
|
||||
import com.tencent.supersonic.chat.api.pojo.SemanticParseInfo;
|
||||
import com.tencent.supersonic.chat.api.pojo.request.QueryFilter;
|
||||
@@ -8,19 +10,18 @@ import com.tencent.supersonic.chat.core.query.rule.metric.MetricTagQuery;
|
||||
import com.tencent.supersonic.chat.core.query.rule.tag.TagFilterQuery;
|
||||
import com.tencent.supersonic.common.pojo.DateConf;
|
||||
import com.tencent.supersonic.common.pojo.DateConf.DateMode;
|
||||
import com.tencent.supersonic.common.pojo.enums.QueryType;
|
||||
import com.tencent.supersonic.common.pojo.enums.FilterOperatorEnum;
|
||||
import com.tencent.supersonic.common.pojo.enums.QueryType;
|
||||
import com.tencent.supersonic.util.DataUtils;
|
||||
import org.junit.Test;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import static com.tencent.supersonic.common.pojo.enums.AggregateTypeEnum.NONE;
|
||||
import org.junit.Test;
|
||||
|
||||
public class TagQueryTest extends BaseQueryTest {
|
||||
|
||||
@Test
|
||||
public void queryTest_metric_tag_query() throws Exception {
|
||||
QueryResult actualResult = submitNewChat("艺人周杰伦的播放量");
|
||||
QueryResult actualResult = submitNewChat("艺人周杰伦的播放量", null);
|
||||
|
||||
QueryResult expectedResult = new QueryResult();
|
||||
SemanticParseInfo expectedParseInfo = new SemanticParseInfo();
|
||||
@@ -43,7 +44,7 @@ public class TagQueryTest extends BaseQueryTest {
|
||||
|
||||
@Test
|
||||
public void queryTest_tag_list_filter() throws Exception {
|
||||
QueryResult actualResult = submitNewChat("爱情、流行类型的艺人");
|
||||
QueryResult actualResult = submitNewChat("爱情、流行类型的艺人", null);
|
||||
|
||||
QueryResult expectedResult = new QueryResult();
|
||||
SemanticParseInfo expectedParseInfo = new SemanticParseInfo();
|
||||
|
||||
@@ -23,7 +23,7 @@ public class MapperTest extends BaseQueryTest {
|
||||
QueryReq queryContextReq = DataUtils.getQueryContextReq(10, "艺人周杰伦的播放量");
|
||||
queryContextReq.setAgentId(1);
|
||||
|
||||
QueryResult actualResult = submitNewChat("艺人周杰伦的播放量");
|
||||
QueryResult actualResult = submitNewChat("艺人周杰伦的播放量",1);
|
||||
|
||||
QueryResult expectedResult = new QueryResult();
|
||||
SemanticParseInfo expectedParseInfo = new SemanticParseInfo();
|
||||
|
||||
@@ -80,9 +80,9 @@ public class PluginRecognizeTest extends BasePluginTest {
|
||||
public void pluginRecognizeWithAgent() {
|
||||
MockConfiguration.mockEmbeddingRecognize(pluginManager, "alice最近的访问情况怎么样", "1");
|
||||
MockConfiguration.mockEmbeddingUrl(embeddingConfig);
|
||||
MockConfiguration.mockAgent(agentService);
|
||||
MockConfiguration.mockMetricAgent(agentService);
|
||||
QueryReq queryContextReq = DataUtils.getQueryReqWithAgent(1000, "alice最近的访问情况怎么样",
|
||||
DataUtils.getAgent().getId());
|
||||
DataUtils.getMetricAgent().getId());
|
||||
ParseResp parseResp = queryService.performParsing(queryContextReq);
|
||||
Assert.assertTrue(parseResp.getSelectedParses() != null
|
||||
&& parseResp.getSelectedParses().size() > 0);
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
package com.tencent.supersonic.util;
|
||||
|
||||
import static java.time.LocalDate.now;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.tencent.supersonic.auth.api.authentication.pojo.User;
|
||||
import com.tencent.supersonic.chat.api.pojo.SchemaElement;
|
||||
import com.tencent.supersonic.chat.api.pojo.request.QueryFilter;
|
||||
import com.tencent.supersonic.chat.api.pojo.request.QueryReq;
|
||||
import com.tencent.supersonic.chat.core.agent.Agent;
|
||||
import com.tencent.supersonic.chat.core.agent.AgentConfig;
|
||||
import com.tencent.supersonic.chat.core.agent.AgentToolType;
|
||||
import com.tencent.supersonic.chat.core.agent.PluginTool;
|
||||
import com.tencent.supersonic.chat.core.agent.RuleParserTool;
|
||||
import com.tencent.supersonic.chat.api.pojo.SchemaElement;
|
||||
import com.tencent.supersonic.chat.api.pojo.SchemaElementType;
|
||||
import com.tencent.supersonic.chat.api.pojo.request.QueryFilter;
|
||||
import com.tencent.supersonic.chat.api.pojo.request.QueryReq;
|
||||
import com.tencent.supersonic.common.pojo.DateConf;
|
||||
import com.tencent.supersonic.common.pojo.enums.FilterOperatorEnum;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import static java.time.LocalDate.now;
|
||||
|
||||
public class DataUtils {
|
||||
|
||||
private static final User user_test = User.getFakeUser();
|
||||
|
||||
public static final Integer metricAgentId = 1;
|
||||
public static final Integer tagAgentId = 2;
|
||||
|
||||
public static User getUser() {
|
||||
return user_test;
|
||||
}
|
||||
@@ -50,30 +50,8 @@ public class DataUtils {
|
||||
.build();
|
||||
}
|
||||
|
||||
public static SchemaElement getMetric(Long modelId, Long id, String name, String bizName) {
|
||||
return SchemaElement.builder()
|
||||
.model(modelId)
|
||||
.id(id)
|
||||
.name(name)
|
||||
.bizName(bizName)
|
||||
.useCnt(0L)
|
||||
.type(SchemaElementType.METRIC)
|
||||
.build();
|
||||
}
|
||||
|
||||
public static SchemaElement getDimension(Long modelId, Long id, String name, String bizName) {
|
||||
return SchemaElement.builder()
|
||||
.model(modelId)
|
||||
.id(id)
|
||||
.name(name)
|
||||
.bizName(bizName)
|
||||
.useCnt(null)
|
||||
.type(SchemaElementType.DIMENSION)
|
||||
.build();
|
||||
}
|
||||
|
||||
public static QueryFilter getFilter(String bizName, FilterOperatorEnum filterOperatorEnum,
|
||||
Object value, String name, Long elementId) {
|
||||
Object value, String name, Long elementId) {
|
||||
QueryFilter filter = new QueryFilter();
|
||||
filter.setBizName(bizName);
|
||||
filter.setOperator(filterOperatorEnum);
|
||||
@@ -94,7 +72,7 @@ public class DataUtils {
|
||||
}
|
||||
|
||||
public static DateConf getDateConf(DateConf.DateMode dateMode, Integer unit,
|
||||
String period, String startDate, String endDate) {
|
||||
String period, String startDate, String endDate) {
|
||||
DateConf dateInfo = new DateConf();
|
||||
dateInfo.setUnit(unit);
|
||||
dateInfo.setDateMode(dateMode);
|
||||
@@ -112,46 +90,24 @@ public class DataUtils {
|
||||
return dateInfo;
|
||||
}
|
||||
|
||||
public static Boolean compareDate(DateConf dateInfo1, DateConf dateInfo2) {
|
||||
Boolean timeFilterExist = dateInfo1.getUnit().equals(dateInfo2.getUnit())
|
||||
&& dateInfo1.getDateMode().equals(dateInfo2.getDateMode())
|
||||
&& dateInfo1.getPeriod().equals(dateInfo2.getPeriod());
|
||||
return timeFilterExist;
|
||||
}
|
||||
|
||||
public static Boolean compareDateDimension(Set<SchemaElement> dimensions) {
|
||||
SchemaElement schemaItemDimension = new SchemaElement();
|
||||
schemaItemDimension.setBizName("sys_imp_date");
|
||||
Boolean dimensionExist = false;
|
||||
for (SchemaElement schemaItem : dimensions) {
|
||||
if (schemaItem.getBizName().equals(schemaItemDimension.getBizName())) {
|
||||
dimensionExist = true;
|
||||
}
|
||||
}
|
||||
return dimensionExist;
|
||||
}
|
||||
|
||||
public static Boolean compareDimensionFilter(Set<QueryFilter> dimensionFilters, QueryFilter dimensionFilter) {
|
||||
Boolean dimensionFilterExist = false;
|
||||
for (QueryFilter filter : dimensionFilters) {
|
||||
if (filter.getBizName().equals(dimensionFilter.getBizName())
|
||||
&& filter.getOperator().equals(dimensionFilter.getOperator())
|
||||
&& filter.getValue().toString().equals(dimensionFilter.getValue().toString())
|
||||
&& filter.getElementID().equals(dimensionFilter.getElementID())
|
||||
&& filter.getName().equals(dimensionFilter.getName())) {
|
||||
dimensionFilterExist = true;
|
||||
}
|
||||
}
|
||||
return dimensionFilterExist;
|
||||
}
|
||||
|
||||
public static Agent getAgent() {
|
||||
public static Agent getMetricAgent() {
|
||||
Agent agent = new Agent();
|
||||
agent.setId(1);
|
||||
agent.setName("查信息");
|
||||
agent.setDescription("查信息");
|
||||
AgentConfig agentConfig = new AgentConfig();
|
||||
agentConfig.getTools().add(getRuleQueryTool());
|
||||
agent.setAgentConfig(JSONObject.toJSONString(agentConfig));
|
||||
return agent;
|
||||
}
|
||||
|
||||
public static Agent getTagAgent() {
|
||||
Agent agent = new Agent();
|
||||
agent.setId(2);
|
||||
agent.setName("标签圈选");
|
||||
agent.setDescription("标签圈选");
|
||||
AgentConfig agentConfig = new AgentConfig();
|
||||
agentConfig.getTools().add(getRuleQueryTool());
|
||||
agentConfig.getTools().add(getPluginTool());
|
||||
agent.setAgentConfig(JSONObject.toJSONString(agentConfig));
|
||||
return agent;
|
||||
@@ -161,7 +117,8 @@ public class DataUtils {
|
||||
RuleParserTool ruleQueryTool = new RuleParserTool();
|
||||
ruleQueryTool.setType(AgentToolType.NL2SQL_RULE);
|
||||
ruleQueryTool.setModelIds(Lists.newArrayList(1L, 2L));
|
||||
ruleQueryTool.setQueryModes(Lists.newArrayList("METRIC_ENTITY", "METRIC_FILTER", "METRIC_MODEL"));
|
||||
ruleQueryTool.setQueryModes(Lists.newArrayList("METRIC_ENTITY", "METRIC_FILTER", "METRIC_MODEL",
|
||||
"TAG_DETAIL", "TAG_LIST_FILTER", "TAG_ID"));
|
||||
return ruleQueryTool;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
insert into s2_user (id, `name`, password, display_name, email, is_admin) values (1, 'admin','admin','admin','admin@xx.com', 1);
|
||||
insert into s2_user (id, `name`, password, display_name, email) values (2, 'jack','123456','jack','jack@xx.com');
|
||||
insert into s2_user (id, `name`, password, display_name, email) values (3, 'tom','123456','tom','tom@xx.com');
|
||||
insert into s2_user (id, `name`, password, display_name, email) values (4, 'lucy','123456','lucy','lucy@xx.com');
|
||||
insert into s2_user (id, `name`, password, display_name, email, is_admin) values (4, 'lucy','123456','lucy','lucy@xx.com', 1);
|
||||
insert into s2_user (id, `name`, password, display_name, email) values (5, 'alice','123456','alice','alice@xx.com');
|
||||
|
||||
insert into s2_available_date_info(`item_id` ,`type` ,`date_format` ,`start_date` ,`end_date` ,`unavailable_date` ,`created_at` ,`created_by` ,`updated_at` ,`updated_by` )
|
||||
values (1, 'dimension', 'yyyy-MM-dd', DATEADD('DAY', -28, CURRENT_DATE()), DATEADD('DAY', -1, CURRENT_DATE()), '[]', '2023-06-01', 'admin', '2023-06-01', 'admin');
|
||||
@@ -11,61 +12,57 @@ values (2, 'dimension', 'yyyy-MM-dd', DATEADD('DAY', -28, CURRENT_DATE()), DATEA
|
||||
insert into s2_available_date_info(`item_id` ,`type` ,`date_format` ,`start_date` ,`end_date` ,`unavailable_date` ,`created_at` ,`created_by` ,`updated_at` ,`updated_by` )
|
||||
values (3, 'dimension', 'yyyy-MM-dd', DATEADD('DAY', -28, CURRENT_DATE()), DATEADD('DAY', -1, CURRENT_DATE()), '[]', '2023-06-01', 'admin', '2023-06-01', 'admin');
|
||||
|
||||
insert into s2_view_info(`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');
|
||||
|
||||
-- sample data
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -1, CURRENT_DATE()), '周杰伦', '中国','青花瓷','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -5, CURRENT_DATE()), '周杰伦', '中国','青花瓷','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -4, CURRENT_DATE()), '周杰伦', '中国','青花瓷','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -3, CURRENT_DATE()), '周杰伦', '中国','青花瓷','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -2, CURRENT_DATE()), '周杰伦', '中国','青花瓷','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -6, CURRENT_DATE()), '周杰伦', '中国','青花瓷','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -7, CURRENT_DATE()), '周杰伦', '中国','青花瓷','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -1, CURRENT_DATE()), '周杰伦', '港台','青花瓷','国风',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -5, CURRENT_DATE()), '周杰伦', '港台','青花瓷','国风',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -4, CURRENT_DATE()), '周杰伦', '港台','青花瓷','国风',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -3, CURRENT_DATE()), '周杰伦', '港台','青花瓷','国风',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -2, CURRENT_DATE()), '周杰伦', '港台','青花瓷','国风',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -6, CURRENT_DATE()), '周杰伦', '港台','青花瓷','国风',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -7, CURRENT_DATE()), '周杰伦', '港台','青花瓷','国风',1000000,1000000,1000000);
|
||||
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -1, CURRENT_DATE()), '陈奕迅', '中国','爱情转移','激情',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -5, CURRENT_DATE()), '陈奕迅', '中国','爱情转移','激情',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -4, CURRENT_DATE()), '陈奕迅', '中国','爱情转移','激情',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -3, CURRENT_DATE()), '陈奕迅', '中国','爱情转移','激情',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -2, CURRENT_DATE()), '陈奕迅', '中国','爱情转移','激情',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -6, CURRENT_DATE()), '陈奕迅', '中国','爱情转移','激情',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -7, CURRENT_DATE()), '陈奕迅', '中国','爱情转移','激情',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -1, CURRENT_DATE()), '陈奕迅', '港台','爱情转移','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -5, CURRENT_DATE()), '陈奕迅', '港台','爱情转移','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -4, CURRENT_DATE()), '陈奕迅', '港台','爱情转移','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -3, CURRENT_DATE()), '陈奕迅', '港台','爱情转移','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -2, CURRENT_DATE()), '陈奕迅', '港台','爱情转移','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -6, CURRENT_DATE()), '陈奕迅', '港台','爱情转移','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -7, CURRENT_DATE()), '陈奕迅', '港台','爱情转移','流行',1000000,1000000,1000000);
|
||||
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -1, CURRENT_DATE()), '林俊杰', '中国','美人鱼','爱情',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -5, CURRENT_DATE()), '林俊杰', '中国','美人鱼','爱情',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -4, CURRENT_DATE()), '林俊杰', '中国','美人鱼','爱情',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -3, CURRENT_DATE()), '林俊杰', '中国','美人鱼','爱情',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -2, CURRENT_DATE()), '林俊杰', '中国','美人鱼','爱情',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -6, CURRENT_DATE()), '林俊杰', '中国','美人鱼','爱情',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -7, CURRENT_DATE()), '林俊杰', '中国','美人鱼','爱情',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -1, CURRENT_DATE()), '林俊杰', '港台','美人鱼','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -5, CURRENT_DATE()), '林俊杰', '港台','美人鱼','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -4, CURRENT_DATE()), '林俊杰', '港台','美人鱼','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -3, CURRENT_DATE()), '林俊杰', '港台','美人鱼','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -2, CURRENT_DATE()), '林俊杰', '港台','美人鱼','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -6, CURRENT_DATE()), '林俊杰', '港台','美人鱼','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -7, CURRENT_DATE()), '林俊杰', '港台','美人鱼','流行',1000000,1000000,1000000);
|
||||
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -1, CURRENT_DATE()), '张碧晨', '中国','光的方向','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -5, CURRENT_DATE()), '张碧晨', '中国','光的方向','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -4, CURRENT_DATE()), '张碧晨', '中国','光的方向','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -3, CURRENT_DATE()), '张碧晨', '中国','光的方向','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -2, CURRENT_DATE()), '张碧晨', '中国','光的方向','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -6, CURRENT_DATE()), '张碧晨', '中国','光的方向','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -7, CURRENT_DATE()), '张碧晨', '中国','光的方向','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -1, CURRENT_DATE()), '张碧晨', '内地','光的方向','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -5, CURRENT_DATE()), '张碧晨', '内地','光的方向','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -4, CURRENT_DATE()), '张碧晨', '内地','光的方向','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -3, CURRENT_DATE()), '张碧晨', '内地','光的方向','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -2, CURRENT_DATE()), '张碧晨', '内地','光的方向','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -6, CURRENT_DATE()), '张碧晨', '内地','光的方向','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -7, CURRENT_DATE()), '张碧晨', '内地','光的方向','流行',1000000,1000000,1000000);
|
||||
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -1, CURRENT_DATE()), '程响', '中国','人间烟火','国风',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -5, CURRENT_DATE()), '程响', '中国','人间烟火','国风',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -4, CURRENT_DATE()), '程响', '中国','人间烟火','国风',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -3, CURRENT_DATE()), '程响', '中国','人间烟火','国风',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -2, CURRENT_DATE()), '程响', '中国','人间烟火','国风',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -6, CURRENT_DATE()), '程响', '中国','人间烟火','国风',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -7, CURRENT_DATE()), '程响', '中国','人间烟火','国风',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -1, CURRENT_DATE()), '程响', '内地','人间烟火','国风',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -5, CURRENT_DATE()), '程响', '内地','人间烟火','国风',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -4, CURRENT_DATE()), '程响', '内地','人间烟火','国风',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -3, CURRENT_DATE()), '程响', '内地','人间烟火','国风',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -2, CURRENT_DATE()), '程响', '内地','人间烟火','国风',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -6, CURRENT_DATE()), '程响', '内地','人间烟火','国风',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -7, CURRENT_DATE()), '程响', '内地','人间烟火','国风',1000000,1000000,1000000);
|
||||
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -1, CURRENT_DATE()), 'Taylor Swift
|
||||
', '欧美','Love Story','爱情',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -5, CURRENT_DATE()), 'Taylor Swift
|
||||
', '欧美','Love Story','爱情',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -4, CURRENT_DATE()), 'Taylor Swift
|
||||
', '欧美','Love Story','爱情',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -3, CURRENT_DATE()), 'Taylor Swift
|
||||
', '欧美','Love Story','爱情',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -2, CURRENT_DATE()), 'Taylor Swift
|
||||
', '欧美','Love Story','爱情',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -6, CURRENT_DATE()), 'Taylor Swift
|
||||
', '欧美','Love Story','爱情',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -7, CURRENT_DATE()), 'Taylor Swift
|
||||
', '欧美','Love Story','爱情',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -1, CURRENT_DATE()), 'Taylor Swift', '欧美','Love Story','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -5, CURRENT_DATE()), 'Taylor Swift', '欧美','Love Story','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -4, CURRENT_DATE()), 'Taylor Swift', '欧美','Love Story','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -3, CURRENT_DATE()), 'Taylor Swift', '欧美','Love Story','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -2, CURRENT_DATE()), 'Taylor Swift', '欧美','Love Story','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -6, CURRENT_DATE()), 'Taylor Swift', '欧美','Love Story','流行',1000000,1000000,1000000);
|
||||
INSERT INTO singer (imp_date,singer_name,act_area, song_name,genre,js_play_cnt,down_cnt,favor_cnt) VALUES (DATEADD('DAY', -7, CURRENT_DATE()), 'Taylor Swift', '欧美','Love Story','流行',1000000,1000000,1000000);
|
||||
|
||||
---demo data for semantic and chat
|
||||
insert into s2_user_department (user_name, department) values ('jack','HR');
|
||||
@@ -1083,3 +1080,35 @@ INSERT INTO s2_stay_time_statis (imp_date, user_name, stay_hours, page) VALUES (
|
||||
INSERT INTO s2_stay_time_statis (imp_date, user_name, stay_hours, page) VALUES (DATEADD('DAY', -19, CURRENT_DATE()), 'alice', '0.8131712486302015', 'p2');
|
||||
INSERT INTO s2_stay_time_statis (imp_date, user_name, stay_hours, page) VALUES (DATEADD('DAY', -15, CURRENT_DATE()), 'lucy', '0.8124302447925607', 'p4');
|
||||
INSERT INTO s2_stay_time_statis (imp_date, user_name, stay_hours, page) VALUES (DATEADD('DAY', -8, CURRENT_DATE()), 'lucy', '0.039935860913407284', 'p2');
|
||||
|
||||
|
||||
|
||||
insert into genre(g_name,rating,most_popular_in) VALUES ('tagore',8,'孟加拉国');
|
||||
insert into genre(g_name,rating,most_popular_in) VALUES ('nazrul',7,'孟加拉国');
|
||||
insert into genre(g_name,rating,most_popular_in) VALUES ('民间',9,'锡尔赫特、吉大港、库斯蒂亚');
|
||||
insert into genre(g_name,rating,most_popular_in) VALUES ('现代',8,'孟加拉国');
|
||||
insert into genre(g_name,rating,most_popular_in) VALUES ('蓝调',7,'加拿大');
|
||||
insert into genre(g_name,rating,most_popular_in) VALUES ('流行',9,'美国');
|
||||
|
||||
insert into artist(artist_name,country,gender,g_name) VALUES ('Shrikanta','印度','男性','tagore');
|
||||
insert into artist(artist_name,country,gender,g_name) VALUES ('Prity','孟加拉国','女性','nazrul');
|
||||
insert into artist(artist_name,country,gender,g_name) VALUES ('Farida','孟加拉国','女性','民间');
|
||||
insert into artist(artist_name,country,gender,g_name) VALUES ('Topu','印度','女性','现代');
|
||||
insert into artist(artist_name,country,gender,g_name) VALUES ('Enrique','美国','男性','蓝调');
|
||||
insert into artist(artist_name,country,gender,g_name) VALUES ('Michel','英国','男性','流行');
|
||||
|
||||
insert into files(f_id,artist_name,file_size,duration,formats) VALUES (1,'Shrikanta','3.78 MB','3:45','mp4');
|
||||
insert into files(f_id,artist_name,file_size,duration,formats) VALUES (2,'Prity','4.12 MB','2:56','mp3');
|
||||
insert into files(f_id,artist_name,file_size,duration,formats) VALUES (3,'Farida','3.69 MB','4:12','mp4');
|
||||
insert into files(f_id,artist_name,file_size,duration,formats) VALUES (4,'Enrique','4.58 MB','5:23','mp4');
|
||||
insert into files(f_id,artist_name,file_size,duration,formats) VALUES (5,'Michel','5.10 MB','4:34','mp3');
|
||||
insert into files(f_id,artist_name,file_size,duration,formats) VALUES (6,'Topu','4.10 MB','4:30','mp4');
|
||||
|
||||
insert into song(imp_date,song_name,artist_name,country,f_id,g_name,rating,languages,releasedate,resolution) VALUES (DATEADD('DAY', 0, CURRENT_DATE()),'Tumi 长袍 尼罗布','Shrikanta','印度',1,'tagore',8,'孟加拉语','28-AUG-2011',1080);
|
||||
insert into song(imp_date,song_name,artist_name,country,f_id,g_name,rating,languages,releasedate,resolution) VALUES (DATEADD('DAY', 0, CURRENT_DATE()),'舒克诺 帕塔尔 努普尔 帕埃','Prity','孟加拉国',2,'nazrul',5,'孟加拉语','21-SEP-1997',512);
|
||||
insert into song(imp_date,song_name,artist_name,country,f_id,g_name,rating,languages,releasedate,resolution) VALUES (DATEADD('DAY', 0, CURRENT_DATE()),'阿米·奥帕尔·霍伊','Farida','孟加拉国',3,'民间',7,'孟加拉语','7-APR-2001',320);
|
||||
insert into song(imp_date,song_name,artist_name,country,f_id,g_name,rating,languages,releasedate,resolution) VALUES (DATEADD('DAY', 0, CURRENT_DATE()),'我的爱','Enrique','美国',4,'蓝调',6,'英文','24-JAN-2007',1080);
|
||||
insert 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);
|
||||
insert 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);
|
||||
|
||||
-- benchmark
|
||||
|
||||
@@ -37,7 +37,7 @@ CREATE TABLE `s2_chat_query`
|
||||
`query_result` mediumtext NOT NULL ,
|
||||
`score` int DEFAULT '0',
|
||||
`feedback` varchar(1024) DEFAULT '',
|
||||
`similar_queries` varchar(1024) DEFAULT '',
|
||||
`similar_queries` varchar(1024) DEFAULT '',
|
||||
PRIMARY KEY (`question_id`)
|
||||
);
|
||||
|
||||
@@ -161,21 +161,6 @@ CREATE TABLE `s2_database` (
|
||||
);
|
||||
COMMENT ON TABLE s2_database IS 'database instance table';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `s2_datasource` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`model_id` INT NOT NULL ,
|
||||
`name` varchar(255) NOT NULL ,
|
||||
`biz_name` varchar(255) NOT NULL ,
|
||||
`description` varchar(500) DEFAULT NULL ,
|
||||
|
||||
`created_at` TIMESTAMP NOT NULL ,
|
||||
`created_by` varchar(100) NOT NULL ,
|
||||
`updated_at` TIMESTAMP NOT NULL ,
|
||||
`updated_by` varchar(100) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
COMMENT ON TABLE s2_datasource IS 'datasource table';
|
||||
|
||||
create table s2_auth_groups
|
||||
(
|
||||
group_id INT,
|
||||
@@ -189,9 +174,9 @@ CREATE TABLE IF NOT EXISTS `s2_metric` (
|
||||
`name` varchar(255) NOT NULL ,
|
||||
`biz_name` varchar(255) NOT NULL ,
|
||||
`description` varchar(500) DEFAULT NULL ,
|
||||
`status` INT NOT NULL , -- status, 0 is off the shelf, 1 is normal
|
||||
`status` INT NOT NULL ,
|
||||
`sensitive_level` INT NOT NULL ,
|
||||
`type` varchar(50) NOT NULL , -- type proxy,expr
|
||||
`type` varchar(50) NOT NULL , -- ATOMIC, DERIVED
|
||||
`type_params` LONGVARCHAR DEFAULT NULL ,
|
||||
`created_at` TIMESTAMP NOT NULL ,
|
||||
`created_by` varchar(100) NOT NULL ,
|
||||
@@ -203,6 +188,7 @@ CREATE TABLE IF NOT EXISTS `s2_metric` (
|
||||
`tags` varchar(500) DEFAULT NULL,
|
||||
`relate_dimensions` varchar(500) DEFAULT NULL,
|
||||
`ext` LONGVARCHAR DEFAULT NULL ,
|
||||
`define_type` varchar(50) NOT NULL, -- MEASURE, FIELD, METRIC
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
COMMENT ON TABLE s2_metric IS 'metric information table';
|
||||
@@ -247,8 +233,8 @@ CREATE TABLE s2_model_rela
|
||||
create table s2_view_info
|
||||
(
|
||||
id INT auto_increment,
|
||||
model_id INT null,
|
||||
type varchar(20) null comment 'datasource、dimension、metric',
|
||||
domain_id INT null,
|
||||
type varchar(20) null comment 'model、dimension、metric',
|
||||
config LONGVARCHAR null comment 'config detail',
|
||||
created_at TIMESTAMP null,
|
||||
created_by varchar(100) null,
|
||||
@@ -464,9 +450,6 @@ CREATE TABLE IF NOT EXISTS `song` (
|
||||
);
|
||||
COMMENT ON TABLE song IS 'song';
|
||||
|
||||
-- benchmark
|
||||
|
||||
|
||||
CREATE TABLE s2_sys_parameter
|
||||
(
|
||||
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
@@ -474,20 +457,29 @@ CREATE TABLE s2_sys_parameter
|
||||
parameters text null
|
||||
);
|
||||
|
||||
CREATE TABLE `s2_metric_query_default_config`(
|
||||
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||
`metric_id` bigint,
|
||||
`user_name` varchar(255) NOT NULL,
|
||||
`default_config` varchar(1000) NOT NULL,
|
||||
`created_at` TIMESTAMP null,
|
||||
`updated_at` TIMESTAMP null,
|
||||
`created_by` varchar(100) null,
|
||||
`updated_by` varchar(100) not null,
|
||||
CREATE TABLE `s2_collect` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||
`type` varchar(20) NOT NULL,
|
||||
`username` varchar(20) NOT NULL,
|
||||
`collect_id` bigint NOT NULL,
|
||||
`create_time` TIMESTAMP,
|
||||
`update_time` TIMESTAMP,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
CREATE TABLE `s2_app`
|
||||
(
|
||||
CREATE TABLE `s2_metric_query_default_config` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||
`metric_id` bigint ,
|
||||
`user_name` varchar(255) NOT NULL,
|
||||
`default_config` varchar(1000) NOT NULL,
|
||||
`created_at` TIMESTAMP null,
|
||||
`updated_at` TIMESTAMP null,
|
||||
`created_by` varchar(100) null,
|
||||
`updated_by` varchar(100) not null,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
CREATE TABLE `s2_app` (
|
||||
id bigint AUTO_INCREMENT PRIMARY KEY,
|
||||
name VARCHAR(255),
|
||||
description VARCHAR(255),
|
||||
@@ -495,7 +487,6 @@ CREATE TABLE `s2_app`
|
||||
config TEXT,
|
||||
end_date TIMESTAMP,
|
||||
qps INT,
|
||||
app_key VARCHAR(255),
|
||||
app_secret VARCHAR(255),
|
||||
owner VARCHAR(255),
|
||||
created_at TIMESTAMP,
|
||||
|
||||
Reference in New Issue
Block a user