mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 19:51:00 +00:00
(improvement)(project) Fix compilation and test failures. (#1018)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package com.tencent.supersonic.common.pojo.enums;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -65,7 +65,7 @@ public enum TimeDimensionEnum {
|
||||
* @return true/false
|
||||
*/
|
||||
public static boolean containsZhTimeDimension(List<String> fields) {
|
||||
if (CollectionUtil.isEmpty(fields)) {
|
||||
if (CollectionUtils.isEmpty(fields)) {
|
||||
return false;
|
||||
}
|
||||
return fields.stream().anyMatch(field -> containsTimeDimension(field));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.tencent.supersonic.common.util.jsqlparser;
|
||||
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import org.junit.Assert;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
@@ -14,27 +14,29 @@ class SqlEqualHelperTest {
|
||||
void testEquals() {
|
||||
String sql1 = "SELECT * FROM table1 WHERE column1 = 1 AND column2 = 2";
|
||||
String sql2 = "SELECT * FROM table1 WHERE column2 = 2 AND column1 = 1";
|
||||
Assert.equals(SqlEqualHelper.equals(sql1, sql2), true);
|
||||
Assert.assertEquals(SqlEqualHelper.equals(sql1, sql2), true);
|
||||
|
||||
sql1 = "SELECT a,b,c,d FROM table1 WHERE column1 = 1 AND column2 = 2 order by a";
|
||||
sql2 = "SELECT d,c,b,a FROM table1 WHERE column2 = 2 AND column1 = 1 order by a";
|
||||
Assert.equals(SqlEqualHelper.equals(sql1, sql2), true);
|
||||
Assert.assertEquals(SqlEqualHelper.equals(sql1, sql2), true);
|
||||
|
||||
sql1 = "SELECT a,sum(b),sum(c),sum(d) FROM table1 WHERE column1 = 1 AND column2 = 2 group by a order by a";
|
||||
|
||||
sql2 = "SELECT sum(d),sum(c),sum(b),a FROM table1 WHERE column2 = 2 AND column1 = 1 group by a order by a";
|
||||
|
||||
Assert.equals(SqlEqualHelper.equals(sql1, sql2), true);
|
||||
Assert.assertEquals(SqlEqualHelper.equals(sql1, sql2), true);
|
||||
|
||||
sql1 = "SELECT a,sum(b),sum(c),sum(d) FROM table1 WHERE column1 = 1 AND column2 = 2 group by a order by a";
|
||||
|
||||
sql2 = "SELECT sum(d),sum(c),sum(b),a FROM table1 WHERE column2 = 2 AND column1 = 1 group by a order by a";
|
||||
|
||||
Assert.equals(SqlEqualHelper.equals(sql1, sql2), true);
|
||||
Assert.assertEquals(SqlEqualHelper.equals(sql1, sql2), true);
|
||||
|
||||
|
||||
sql1 = "SELECT a,b,c,d FROM table1 WHERE column1 = 1 AND column2 = 2 order by a";
|
||||
sql2 = "SELECT d,c,b,f FROM table1 WHERE column2 = 2 AND column1 = 1 order by a";
|
||||
Assert.equals(SqlEqualHelper.equals(sql1, sql2), false);
|
||||
Assert.assertEquals(SqlEqualHelper.equals(sql1, sql2), false);
|
||||
|
||||
|
||||
sql1 = "SELECT\n"
|
||||
+ "页面,\n"
|
||||
@@ -63,7 +65,6 @@ class SqlEqualHelperTest {
|
||||
+ "页面\n"
|
||||
+ "LIMIT\n"
|
||||
+ "365";
|
||||
|
||||
Assert.equals(SqlEqualHelper.equals(sql1, sql2), true);
|
||||
Assert.assertEquals(SqlEqualHelper.equals(sql1, sql2), true);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.tencent.supersonic.headless.core.parser;
|
||||
|
||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
import com.google.common.base.Strings;
|
||||
import com.tencent.supersonic.common.util.StringUtil;
|
||||
import com.tencent.supersonic.headless.api.pojo.MetricTable;
|
||||
@@ -97,7 +96,7 @@ public class DefaultQueryParser implements QueryParser {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("physicalSql error {}", ExceptionUtil.getMessage(e));
|
||||
log.error("physicalSql error {}", e);
|
||||
queryStatement.setErrMsg(e.getMessage());
|
||||
}
|
||||
return queryStatement;
|
||||
@@ -114,7 +113,7 @@ public class DefaultQueryParser implements QueryParser {
|
||||
return ComponentFactory.getSqlParser().explain(queryStatement, isAgg);
|
||||
} catch (Exception e) {
|
||||
queryStatement.setErrMsg(e.getMessage());
|
||||
log.error("parser error metricQueryReq[{}] error [{}]", metricQueryParam, ExceptionUtil.getMessage(e));
|
||||
log.error("parser error metricQueryReq[{}] error [{}]", metricQueryParam, e);
|
||||
}
|
||||
return queryStatement;
|
||||
}
|
||||
|
||||
@@ -15,10 +15,8 @@ import com.tencent.supersonic.chat.server.service.AgentService;
|
||||
import com.tencent.supersonic.chat.server.service.ChatManageService;
|
||||
import com.tencent.supersonic.chat.server.service.ChatService;
|
||||
import com.tencent.supersonic.common.pojo.SysParameter;
|
||||
import com.tencent.supersonic.common.pojo.enums.S2ModelProvider;
|
||||
import com.tencent.supersonic.common.service.SysParameterService;
|
||||
import com.tencent.supersonic.common.util.JsonUtil;
|
||||
import com.tencent.supersonic.headless.api.pojo.LLMConfig;
|
||||
import com.tencent.supersonic.headless.api.pojo.response.ParseResp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -106,9 +104,9 @@ public class ChatDemoLoader implements CommandLineRunner {
|
||||
public void addSampleChats2(Integer agentId) throws Exception {
|
||||
Long chatId = chatManageService.addChat(user, "样例对话2", agentId);
|
||||
|
||||
parseAndExecute(chatId.intValue(), agentId,"alice 停留时长");
|
||||
parseAndExecute(chatId.intValue(), agentId,"对比alice和lucy的访问次数");
|
||||
parseAndExecute(chatId.intValue(), agentId,"访问次数最高的部门");
|
||||
parseAndExecute(chatId.intValue(), agentId, "alice 停留时长");
|
||||
parseAndExecute(chatId.intValue(), agentId, "对比alice和lucy的访问次数");
|
||||
parseAndExecute(chatId.intValue(), agentId, "访问次数最高的部门");
|
||||
}
|
||||
|
||||
public void addSysParameter() {
|
||||
|
||||
Reference in New Issue
Block a user