12 Commits

Author SHA1 Message Date
zyclove
dc176590a4 Merge b1dadb4a1a into d2a43a99c8 2025-03-23 23:20:58 +08:00
jerryjzhang
d2a43a99c8 (feature)(headless)Support offset clause in struct query.
Some checks failed
supersonic CentOS CI / build (21) (push) Has been cancelled
supersonic mac CI / build (21) (push) Has been cancelled
supersonic ubuntu CI / build (21) (push) Has been cancelled
supersonic windows CI / build (21) (push) Has been cancelled
2025-03-23 14:30:56 +08:00
iridescentpeo
db8f340e2d 修复同一模型被多个数据集引用时: (#2183) 2025-03-23 14:14:08 +08:00
Kun Gu
2e81b190a4 将utf8的编码修改为utf8mb4,解决部分因为字符出现的BUG (#2182)
Some checks failed
supersonic CentOS CI / build (21) (push) Has been cancelled
supersonic mac CI / build (21) (push) Has been cancelled
supersonic ubuntu CI / build (21) (push) Has been cancelled
supersonic windows CI / build (21) (push) Has been cancelled
2025-03-21 22:54:34 +08:00
guilinlewis
81cd60d2da fix-common-因缓存无法存记忆 (#2181) 2025-03-21 22:30:38 +08:00
jerryjzhang
3ffc8c3d9e (improvement)(headless)Make rule-based corrector switchable. 2025-03-21 22:10:41 +08:00
jerryjzhang
18db24c011 (fix)(headless)Fix issue of dimension value not replaced by alias. #2074 2025-03-21 21:49:47 +08:00
Hwting
cd698ac367 Update docker-compose.yml (#2184) 2025-03-21 21:38:29 +08:00
jerryjzhang
58b640b087 (fix)(headless)Fix issue of dimension value not replaced by alias. 2025-03-21 21:33:40 +08:00
jerryjzhang
1f28aaeaed (feature)(auth)Add last_login field to User. 2025-03-21 20:58:59 +08:00
zhaoyingchao
b1dadb4a1a Merge remote-tracking branch 'origin/master' into hanlp-upgrade 2025-03-05 10:01:32 +08:00
zhaoyingchao
158a0a802a feat:upgrade 1.8.4 2025-03-04 18:55:31 +08:00
22 changed files with 363 additions and 353 deletions

View File

@@ -24,7 +24,7 @@ public class UserWithPassword extends User {
public UserWithPassword(Long id, String name, String displayName, String email, String password,
Integer isAdmin) {
super(id, name, displayName, email, isAdmin);
super(id, name, displayName, email, isAdmin, null);
this.password = password;
}

View File

@@ -18,6 +18,7 @@ import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import java.sql.Timestamp;
import java.util.List;
import java.util.Optional;
import java.util.Set;
@@ -102,7 +103,9 @@ public class DefaultUserAdaptor implements UserAdaptor {
TokenService tokenService = ContextUtils.getBean(TokenService.class);
try {
UserWithPassword user = getUserWithPassword(userReq);
return tokenService.generateToken(UserWithPassword.convert(user), appKey);
String token = tokenService.generateToken(UserWithPassword.convert(user), appKey);
updateLastLogin(userReq.getName());
return token;
} catch (Exception e) {
log.error("", e);
throw new RuntimeException("password encrypt error, please try again");
@@ -267,4 +270,11 @@ public class DefaultUserAdaptor implements UserAdaptor {
userToken.setExpireDate(userTokenDO.getExpireDateTime());
return userToken;
}
private void updateLastLogin(String userName) {
UserRepository userRepository = ContextUtils.getBean(UserRepository.class);
UserDO userDO = userRepository.getUser(userName);
userDO.setLastLogin(new Timestamp(System.currentTimeMillis()));
userRepository.updateUser(userDO);
}
}

View File

@@ -3,7 +3,11 @@ package com.tencent.supersonic.auth.authentication.persistence.dataobject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.sql.Timestamp;
@Data
@TableName("s2_user")
public class UserDO {
@@ -27,71 +31,25 @@ public class UserDO {
/** */
private Integer isAdmin;
/** @return id */
public Long getId() {
return id;
}
/** @param id */
public void setId(Long id) {
this.id = id;
}
/** @return name */
public String getName() {
return name;
}
private Timestamp lastLogin;
/** @param name */
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
/** @return password */
public String getPassword() {
return password;
}
/** @param password */
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
public String getSalt() {
return salt;
}
public void setSalt(String salt) {
this.salt = salt == null ? null : salt.trim();
}
/** @return display_name */
public String getDisplayName() {
return displayName;
}
/** @param displayName */
public void setDisplayName(String displayName) {
this.displayName = displayName == null ? null : displayName.trim();
}
/** @return email */
public String getEmail() {
return email;
}
/** @param email */
public void setEmail(String email) {
this.email = email == null ? null : email.trim();
}
/** @return is_admin */
public Integer getIsAdmin() {
return isAdmin;
}
/** @param isAdmin */
public void setIsAdmin(Integer isAdmin) {
this.isAdmin = isAdmin;
}
}

View File

@@ -136,6 +136,9 @@
<if test="isAdmin != null">
is_admin = #{isAdmin,jdbcType=INTEGER},
</if>
<if test="lastLogin != null">
last_login = #{lastLogin,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>

View File

@@ -6,6 +6,7 @@ import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import java.sql.Timestamp;
@Data
@NoArgsConstructor
@@ -22,26 +23,28 @@ public class User implements Serializable {
private Integer isAdmin;
private Timestamp lastLogin;
public static User get(Long id, String name, String displayName, String email,
Integer isAdmin) {
return new User(id, name, displayName, email, isAdmin);
return new User(id, name, displayName, email, isAdmin, null);
}
public static User get(Long id, String name) {
return new User(id, name, name, name, 0);
return new User(id, name, name, name, 0, null);
}
public static User getDefaultUser() {
return new User(1L, "admin", "admin", "admin@email", 1);
return new User(1L, "admin", "admin", "admin@email", 1, null);
}
public static User getVisitUser() {
return new User(1L, "visit", "visit", "visit@email", 0);
return new User(1L, "visit", "visit", "visit@email", 0, null);
}
public static User getAppUser(int appId) {
String name = String.format("app_%s", appId);
return new User(1L, name, name, "", 1);
return new User(1L, name, name, "", 1, null);
}
public String getDisplayName() {

View File

@@ -49,7 +49,8 @@ public class EmbeddingServiceImpl implements EmbeddingService {
try {
EmbeddingModel embeddingModel = ModelProvider.getEmbeddingModel();
Embedding embedding = embeddingModel.embed(question).content();
boolean existSegment = existSegment(embeddingStore, query, embedding);
boolean existSegment =
existSegment(collectionName, embeddingStore, query, embedding);
if (existSegment) {
continue;
}
@@ -62,14 +63,14 @@ public class EmbeddingServiceImpl implements EmbeddingService {
}
}
private boolean existSegment(EmbeddingStore embeddingStore, TextSegment query,
Embedding embedding) {
private boolean existSegment(String collectionName, EmbeddingStore embeddingStore,
TextSegment query, Embedding embedding) {
String queryId = TextSegmentConvert.getQueryId(query);
if (queryId == null) {
return false;
}
// Check cache first
Boolean cachedResult = cache.getIfPresent(queryId);
Boolean cachedResult = cache.getIfPresent(collectionName + queryId);
if (cachedResult != null) {
return cachedResult;
}
@@ -82,7 +83,7 @@ public class EmbeddingServiceImpl implements EmbeddingService {
EmbeddingSearchResult result = embeddingStore.search(request);
List<EmbeddingMatch<TextSegment>> relevant = result.matches();
boolean exists = CollectionUtils.isNotEmpty(relevant);
cache.put(queryId, exists);
cache.put(collectionName + queryId, exists);
return exists;
}

View File

@@ -11,8 +11,8 @@ services:
POSTGRES_PASSWORD: supersonic_password
ports:
- "15432:5432"
# volumes:
# - postgres_data:/var/lib/postgresql/data
volumes:
- ./supersonic_pg/data:/var/lib/postgresql/data
networks:
- supersonic_network
dns:
@@ -65,7 +65,6 @@ services:
# propagation: rprivate
# create_host_path: true
#volumes:
# postgres_data:
# supersonic_data:
networks:

View File

@@ -30,6 +30,7 @@ public class QueryDataSetReq {
private List<Filter> metricFilters = new ArrayList<>();
private DateConf dateInfo;
private Long limit = 2000L;
private Long offset = 0L;
private QueryType queryType = QueryType.DETAIL;
private boolean innerLayerNative = false;
}

View File

@@ -3,11 +3,7 @@ package com.tencent.supersonic.headless.api.pojo.request;
import com.google.common.collect.Lists;
import com.tencent.supersonic.common.jsqlparser.SqlAddHelper;
import com.tencent.supersonic.common.jsqlparser.SqlReplaceHelper;
import com.tencent.supersonic.common.pojo.Aggregator;
import com.tencent.supersonic.common.pojo.Constants;
import com.tencent.supersonic.common.pojo.DateConf;
import com.tencent.supersonic.common.pojo.Filter;
import com.tencent.supersonic.common.pojo.Order;
import com.tencent.supersonic.common.pojo.*;
import com.tencent.supersonic.common.pojo.enums.AggOperatorEnum;
import com.tencent.supersonic.common.pojo.enums.QueryType;
import com.tencent.supersonic.common.util.ContextUtils;
@@ -25,12 +21,7 @@ import net.sf.jsqlparser.expression.operators.relational.ExpressionList;
import net.sf.jsqlparser.parser.CCJSqlParserUtil;
import net.sf.jsqlparser.schema.Column;
import net.sf.jsqlparser.schema.Table;
import net.sf.jsqlparser.statement.select.GroupByElement;
import net.sf.jsqlparser.statement.select.Limit;
import net.sf.jsqlparser.statement.select.OrderByElement;
import net.sf.jsqlparser.statement.select.ParenthesedSelect;
import net.sf.jsqlparser.statement.select.PlainSelect;
import net.sf.jsqlparser.statement.select.SelectItem;
import net.sf.jsqlparser.statement.select.*;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;
@@ -52,6 +43,7 @@ public class QueryStructReq extends SemanticQueryReq {
private List<Filter> metricFilters = new ArrayList<>();
private DateConf dateInfo;
private long limit = Constants.DEFAULT_DETAIL_LIMIT;
private long offset;
private QueryType queryType = QueryType.DETAIL;
private boolean convertToSql = true;
@@ -170,12 +162,15 @@ public class QueryStructReq extends SemanticQueryReq {
// 5. Set the limit clause
plainSelect.setLimit(buildLimit(queryStructReq));
// 6. Set having clause
// 6. Set the offset clause
plainSelect.setOffset(buildOffset(queryStructReq));
// 7. Set the having clause
plainSelect.setHaving(buildHavingClause(queryStructReq));
select.setSelect(plainSelect);
// 6. Set where clause
// 8. Set the where clause
return addWhereClauses(select.toString(), queryStructReq, isBizName);
}
@@ -262,6 +257,15 @@ public class QueryStructReq extends SemanticQueryReq {
return limit;
}
private Offset buildOffset(QueryStructReq queryStructReq) {
if (Objects.isNull(queryStructReq.getOffset())) {
return null;
}
Offset offset = new Offset();
offset.setOffset(new LongValue(queryStructReq.getOffset()));
return offset;
}
private String addWhereClauses(String sql, QueryStructReq queryStructReq, boolean isBizName)
throws JSQLParserException {
SqlFilterUtils sqlFilterUtils = ContextUtils.getBean(SqlFilterUtils.class);

View File

@@ -1,12 +1,16 @@
package com.tencent.supersonic.headless.chat.corrector;
import com.tencent.supersonic.common.util.ContextUtils;
import com.tencent.supersonic.headless.api.pojo.SemanticParseInfo;
import com.tencent.supersonic.headless.chat.ChatQueryContext;
import com.tencent.supersonic.headless.chat.parser.ParserConfig;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.List;
import static com.tencent.supersonic.headless.chat.parser.ParserConfig.PARSER_RULE_CORRECTOR_ENABLE;
@Slf4j
public class RuleSqlCorrector extends BaseSemanticCorrector {
private List<BaseSemanticCorrector> correctors;
@@ -20,6 +24,11 @@ public class RuleSqlCorrector extends BaseSemanticCorrector {
@Override
public void doCorrect(ChatQueryContext chatQueryContext, SemanticParseInfo semanticParseInfo) {
ParserConfig parserConfig = ContextUtils.getBean(ParserConfig.class);
if (!Boolean.parseBoolean(parserConfig.getParameterValue(PARSER_RULE_CORRECTOR_ENABLE))) {
return;
}
for (BaseSemanticCorrector corrector : correctors) {
corrector.correct(chatQueryContext, semanticParseInfo);
}

View File

@@ -22,4 +22,9 @@ public abstract class MapResult implements Serializable {
return this.getMapKey().equals(otherResult.getMapKey())
&& this.similarity < otherResult.similarity;
}
public Boolean lessOrEqualSimilar(MapResult otherResult) {
return this.getMapKey().equals(otherResult.getMapKey())
&& this.similarity <= otherResult.similarity;
}
}

View File

@@ -75,6 +75,8 @@ public class MetaEmbeddingService {
return dataSetIds.stream().map(dataSetId -> {
Retrieval newRetrieval = new Retrieval();
BeanUtils.copyProperties(retrieval, newRetrieval);
HashMap<String, Object> newMetadata = new HashMap<>(retrieval.getMetadata());
newRetrieval.setMetadata(newMetadata);
newRetrieval.getMetadata().putIfAbsent("dataSetId",
dataSetId + Constants.UNDERLINE);
return newRetrieval;

View File

@@ -56,7 +56,7 @@ public abstract class BaseMatchStrategy<T extends MapResult> implements MatchStr
for (T oneRoundResult : oneRoundResults) {
if (existResults.contains(oneRoundResult)) {
boolean isDeleted = existResults.removeIf(existResult -> {
boolean delete = existResult.lessSimilar(oneRoundResult);
boolean delete = existResult.lessOrEqualSimilar(oneRoundResult);
if (delete) {
log.debug("deleted existResult:{}", existResult);
}

View File

@@ -17,6 +17,10 @@ public class ParserConfig extends ParameterConfig {
"ONE_PASS_SELF_CONSISTENCY: 通过投票方式一步生成sql", "list", "语义解析配置",
Lists.newArrayList("ONE_PASS_SELF_CONSISTENCY"));
public static final Parameter PARSER_RULE_CORRECTOR_ENABLE =
new Parameter("s2.parser.rule.corrector.enable", "false", "是否开启规则修正器",
"规则修正器灵活度有限,在大模型能力足够情况下,不必强制做规则修正", "bool", "语义解析配置");
public static final Parameter PARSER_LINKING_VALUE_ENABLE =
new Parameter("s2.parser.linking.value.enable", "true", "是否将Mapper探测识别到的维度值提供给大模型",
"为了数据安全考虑, 这里可进行开关选择", "bool", "语义解析配置");
@@ -55,7 +59,8 @@ public class ParserConfig extends ParameterConfig {
@Override
public List<Parameter> getSysParameters() {
return Lists.newArrayList(PARSER_LINKING_VALUE_ENABLE, PARSER_FEW_SHOT_NUMBER,
PARSER_SELF_CONSISTENCY_NUMBER, PARSER_SHOW_COUNT, PARSER_FIELDS_COUNT_THRESHOLD);
return Lists.newArrayList(PARSER_LINKING_VALUE_ENABLE, PARSER_RULE_CORRECTOR_ENABLE,
PARSER_FEW_SHOT_NUMBER, PARSER_SELF_CONSISTENCY_NUMBER, PARSER_SHOW_COUNT,
PARSER_FIELDS_COUNT_THRESHOLD);
}
}

View File

@@ -20,6 +20,7 @@ public class StructQuery {
private List<Filter> metricFilters = new ArrayList();
private DateConf dateInfo;
private Long limit = 2000L;
private Long offset = 0L;
private QueryType queryType;
private List<Param> params = new ArrayList<>();
}

View File

@@ -141,7 +141,7 @@ public class DimValueAspect {
List<String> values = JsonUtil.toList(fieldValue, String.class);
List<String> revisedValues = new ArrayList<>();
for (int i = 0; i < values.size(); i++) {
Boolean flag = new Boolean(false);
Boolean flag = false;
for (DimValueMap dimValueMap : dimension.getDimValueMaps()) {
if (!CollectionUtils.isEmpty(dimValueMap.getAlias())
&& dimValueMap.getAlias().contains(values.get(i))) {

View File

@@ -426,6 +426,9 @@ public class DimensionServiceImpl extends ServiceImpl<DimensionDOMapper, Dimensi
dimValueMapList = JsonUtil.toList(dimensionDO.getDimValueMaps(), DimValueMap.class);
}
DimValueMap dimValueMaps = req.getDimValueMaps();
if (StringUtils.isEmpty(dimValueMaps.getTechName())) {
dimValueMaps.setTechName(dimValueMaps.getValue());
}
Map<String, DimValueMap> valeAndMapInfo = dimValueMapList.stream()
.collect(Collectors.toMap(DimValueMap::getValue, v -> v, (v1, v2) -> v2));
String value = dimValueMaps.getValue();

View File

@@ -418,3 +418,6 @@ ALTER TABLE s2_model_rela alter column join_condition type text;
--20250310
ALTER TABLE s2_chat_model add column is_open tinyint DEFAULT NULL COMMENT '是否公开';
ALTER TABLE s2_database add column is_open tinyint DEFAULT NULL COMMENT '是否公开';
--20250321
ALTER TABLE s2_user add column last_loin datetime DEFAULT NULL;

View File

@@ -129,6 +129,7 @@ create table IF NOT EXISTS s2_user
salt varchar(256) NULL,
email varchar(100) null,
is_admin INT null,
last_login TIMESTAMP NULL,
PRIMARY KEY (`id`)
);
COMMENT ON TABLE s2_user IS 'user information table';

View File

@@ -1,19 +1,19 @@
CREATE TABLE IF NOT EXISTS `s2_agent` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`description` TEXT COLLATE utf8_unicode_ci DEFAULT NULL,
`examples` TEXT COLLATE utf8_unicode_ci DEFAULT NULL,
`name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`description` TEXT COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`examples` TEXT COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`status` tinyint DEFAULT NULL,
`model` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`tool_config` TEXT COLLATE utf8_unicode_ci DEFAULT NULL,
`llm_config` TEXT COLLATE utf8_unicode_ci DEFAULT NULL,
`chat_model_config` text COLLATE utf8_unicode_ci DEFAULT NULL,
`visual_config` TEXT COLLATE utf8_unicode_ci DEFAULT NULL,
`model` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`tool_config` TEXT COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`llm_config` TEXT COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`chat_model_config` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`visual_config` TEXT COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`enable_search` tinyint DEFAULT 1,
`enable_feedback` tinyint DEFAULT 1,
`created_by` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_by` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`updated_by` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`updated_by` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`admin` varchar(1000) DEFAULT NULL COMMENT '管理员',
`admin_org` varchar(1000) DEFAULT NULL COMMENT '管理员组织',
@@ -21,13 +21,13 @@ CREATE TABLE IF NOT EXISTS `s2_agent` (
`viewer` varchar(1000) DEFAULT NULL COMMENT '可用用户',
`view_org` varchar(1000) DEFAULT NULL COMMENT '可用组织',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `s2_auth_groups` (
`group_id` int(11) NOT NULL,
`config` varchar(2048) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `s2_available_date_info` (
@@ -46,7 +46,7 @@ CREATE TABLE IF NOT EXISTS `s2_available_date_info` (
`status` tinyint DEFAULT 0,
UNIQUE(`item_id`, `type`),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `s2_chat` (
@@ -60,7 +60,7 @@ CREATE TABLE IF NOT EXISTS `s2_chat` (
`is_delete` tinyint DEFAULT '0' COMMENT 'is deleted',
`is_top` tinyint DEFAULT '0' COMMENT 'is top',
PRIMARY KEY (`chat_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `s2_chat_config` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
@@ -75,7 +75,7 @@ CREATE TABLE IF NOT EXISTS `s2_chat_config` (
`status` tinyint NOT NULL COMMENT '主题域扩展信息状态, 0-删除1-生效',
`llm_examples` text COMMENT 'llm examples',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='主题域扩展信息表';
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='主题域扩展信息表';
CREATE TABLE IF NOT EXISTS `s2_chat_memory` (
`id` INT NOT NULL AUTO_INCREMENT,
@@ -95,7 +95,7 @@ CREATE TABLE IF NOT EXISTS `s2_chat_memory` (
`created_by` varchar(100) DEFAULT NULL ,
`updated_by` varchar(100) DEFAULT NULL ,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `s2_chat_context` (
`chat_id` bigint(20) NOT NULL COMMENT 'context chat id',
@@ -105,7 +105,7 @@ CREATE TABLE IF NOT EXISTS `s2_chat_context` (
`semantic_parse` text COMMENT 'parse data',
`ext_data` text COMMENT 'extend data',
PRIMARY KEY (`chat_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `s2_chat_parse` (
`question_id` bigint NOT NULL,
@@ -117,7 +117,7 @@ CREATE TABLE IF NOT EXISTS `s2_chat_parse` (
`parse_info` mediumtext NOT NULL,
`is_candidate` int(11) DEFAULT '1' COMMENT '1是candidate,0是selected',
KEY `commonIndex` (`question_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `s2_chat_query`
@@ -135,7 +135,7 @@ CREATE TABLE IF NOT EXISTS `s2_chat_query`
`similar_queries` varchar(1024) DEFAULT '',
`parse_time_cost` varchar(1024) DEFAULT '',
PRIMARY KEY (`question_id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
) ENGINE = InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `s2_chat_statistics` (
@@ -148,7 +148,7 @@ CREATE TABLE IF NOT EXISTS `s2_chat_statistics` (
`type` int(11) DEFAULT NULL,
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
KEY `commonIndex` (`question_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `s2_chat_model` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
@@ -163,7 +163,7 @@ CREATE TABLE IF NOT EXISTS `s2_chat_model` (
`viewer` varchar(500) DEFAULT NULL,
`is_open` tinyint DEFAULT NULL COMMENT '是否公开',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='对话大模型实例表';
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='对话大模型实例表';
CREATE TABLE IF NOT EXISTS `s2_database` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
@@ -180,7 +180,7 @@ CREATE TABLE IF NOT EXISTS `s2_database` (
`viewer` varchar(500) DEFAULT NULL,
`is_open` tinyint DEFAULT NULL COMMENT '是否公开',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='数据库实例表';
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='数据库实例表';
CREATE TABLE IF NOT EXISTS `s2_dictionary_conf` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
@@ -192,7 +192,7 @@ CREATE TABLE IF NOT EXISTS `s2_dictionary_conf` (
`created_at` datetime NOT NULL COMMENT '创建时间' ,
`created_by` varchar(100) NOT NULL ,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='字典配置信息表';
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='字典配置信息表';
CREATE TABLE IF NOT EXISTS `s2_dictionary_task` (
@@ -207,7 +207,7 @@ CREATE TABLE IF NOT EXISTS `s2_dictionary_task` (
`created_by` varchar(100) NOT NULL ,
`elapsed_ms` int(10) DEFAULT NULL ,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='字典运行任务表';
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='字典运行任务表';
CREATE TABLE IF NOT EXISTS `s2_dimension` (
@@ -227,13 +227,13 @@ CREATE TABLE IF NOT EXISTS `s2_dimension` (
`updated_at` datetime NOT NULL COMMENT '更新时间',
`updated_by` varchar(100) NOT NULL COMMENT '更新人',
`semantic_type` varchar(20) NOT NULL COMMENT '语义类型DATE, ID, CATEGORY',
`alias` varchar(500) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`alias` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`default_values` varchar(500) DEFAULT NULL,
`dim_value_maps` varchar(5000) DEFAULT NULL,
`is_tag` tinyint DEFAULT NULL,
`ext` varchar(1000) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='维度表';
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='维度表';
CREATE TABLE IF NOT EXISTS `s2_domain` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
@@ -252,7 +252,7 @@ CREATE TABLE IF NOT EXISTS `s2_domain` (
`view_org` varchar(3000) DEFAULT NULL COMMENT '主题域可用组织',
`entity` varchar(500) DEFAULT NULL COMMENT '主题域实体信息',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='主题域基础信息表';
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='主题域基础信息表';
CREATE TABLE IF NOT EXISTS `s2_metric`
@@ -272,35 +272,35 @@ CREATE TABLE IF NOT EXISTS `s2_metric`
`updated_by` varchar(100) NOT NULL COMMENT '更新人',
`data_format_type` varchar(50) DEFAULT NULL COMMENT '数值类型',
`data_format` varchar(500) DEFAULT NULL COMMENT '数值类型参数',
`alias` varchar(500) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`classifications` varchar(500) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`alias` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`classifications` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`relate_dimensions` varchar(500) DEFAULT NULL COMMENT '指标相关维度',
`ext` text DEFAULT NULL,
`define_type` varchar(50) DEFAULT NULL, -- MEASURE, FIELD, METRIC
`is_publish` tinyint DEFAULT NULL COMMENT '是否发布',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8 COMMENT ='指标表';
) ENGINE = InnoDB
DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT ='指标表';
CREATE TABLE IF NOT EXISTS `s2_model` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`biz_name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`biz_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`domain_id` bigint(20) DEFAULT NULL,
`alias` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
`alias` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`status` tinyint DEFAULT NULL,
`description` varchar(500) DEFAULT NULL,
`viewer` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL,
`view_org` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL,
`admin` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL,
`admin_org` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL,
`viewer` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`view_org` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`admin` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`admin_org` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`is_open` tinyint DEFAULT NULL,
`created_by` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_by` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`updated_by` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`updated_by` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`entity` text COLLATE utf8_unicode_ci,
`entity` text COLLATE utf8mb4_unicode_ci,
`drill_down_dimensions` TEXT DEFAULT NULL,
`database_id` INT NOT NULL ,
`model_detail` text NOT NULL ,
@@ -310,24 +310,24 @@ CREATE TABLE IF NOT EXISTS `s2_model` (
`tag_object_id` int(11) DEFAULT '0',
`ext` varchar(1000) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `s2_plugin` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`type` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'DASHBOARD,WIDGET,URL',
`type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'DASHBOARD,WIDGET,URL',
`data_set` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`pattern` varchar(500) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`pattern` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`parse_mode` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`parse_mode_config` text COLLATE utf8mb4_unicode_ci,
`name` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`created_by` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`created_by` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`updated_by` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`config` text CHARACTER SET utf8 COLLATE utf8_unicode_ci,
`updated_by` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`config` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`comment` text COLLATE utf8mb4_unicode_ci,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `s2_query_stat_info` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
@@ -364,7 +364,7 @@ CREATE TABLE IF NOT EXISTS `s2_query_stat_info` (
`query_opt_mode` varchar(20) null comment '优化模式',
PRIMARY KEY (`id`),
KEY `domain_index` (`model_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='查询统计信息表';
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='查询统计信息表';
CREATE TABLE IF NOT EXISTS `s2_canvas`
(
@@ -377,7 +377,7 @@ CREATE TABLE IF NOT EXISTS `s2_canvas`
`updated_at` datetime DEFAULT NULL,
`updated_by` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
) ENGINE = InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS s2_user
(
@@ -388,16 +388,17 @@ CREATE TABLE IF NOT EXISTS s2_user
salt varchar(256) DEFAULT NULL COMMENT 'md5密码盐',
email varchar(100) null,
is_admin tinyint null,
last_login datetime DEFAULT NULL,
UNIQUE (`name`),
PRIMARY KEY (`id`)
);
) ENGINE = InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS s2_system_config
(
id int primary key AUTO_INCREMENT COMMENT '主键id',
admin varchar(500) COMMENT '系统管理员',
parameters text null COMMENT '配置项'
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS s2_model_rela
(
@@ -407,7 +408,7 @@ CREATE TABLE IF NOT EXISTS s2_model_rela
to_model_id bigint,
join_type VARCHAR(255),
join_condition text
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `s2_collect` (
`id` bigint NOT NULL primary key AUTO_INCREMENT,
@@ -416,7 +417,7 @@ CREATE TABLE IF NOT EXISTS `s2_collect` (
`collect_id` bigint NOT NULL,
`create_time` datetime,
`update_time` datetime
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `s2_metric_query_default_config` (
`id` bigint NOT NULL PRIMARY KEY AUTO_INCREMENT,
@@ -427,7 +428,7 @@ CREATE TABLE IF NOT EXISTS `s2_metric_query_default_config` (
`updated_at` datetime null,
`created_by` varchar(100) null,
`updated_by` varchar(100) null
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `s2_app`
(
@@ -444,7 +445,7 @@ CREATE TABLE IF NOT EXISTS `s2_app`
`updated_at` datetime null,
`created_by` varchar(255) null,
`updated_by` varchar(255) null
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS s2_data_set
(
@@ -463,7 +464,7 @@ CREATE TABLE IF NOT EXISTS s2_data_set
query_config VARCHAR(3000),
`admin` varchar(3000) DEFAULT NULL,
`admin_org` varchar(3000) DEFAULT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS s2_tag(
`id` INT NOT NULL AUTO_INCREMENT,
@@ -475,7 +476,7 @@ CREATE TABLE IF NOT EXISTS s2_tag(
`updated_by` varchar(100) DEFAULT NULL ,
`ext` text DEFAULT NULL ,
PRIMARY KEY (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `s2_tag_object`
(
@@ -492,8 +493,8 @@ CREATE TABLE IF NOT EXISTS `s2_tag_object`
`updated_by` varchar(100) NULL COMMENT '更新人',
`ext` text DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8 COMMENT ='标签对象表';
) ENGINE = InnoDB
DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT ='标签对象表';
CREATE TABLE IF NOT EXISTS `s2_query_rule` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
@@ -512,7 +513,7 @@ CREATE TABLE IF NOT EXISTS `s2_query_rule` (
`updated_by` varchar(100) DEFAULT NULL ,
`ext` text DEFAULT NULL ,
PRIMARY KEY (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COMMENT ='查询规则表';
) ENGINE = InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT ='查询规则表';
CREATE TABLE IF NOT EXISTS `s2_term` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
@@ -527,7 +528,7 @@ CREATE TABLE IF NOT EXISTS `s2_term` (
`updated_at` datetime DEFAULT NULL ,
`updated_by` varchar(100) DEFAULT NULL ,
PRIMARY KEY (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COMMENT ='术语表';
) ENGINE = InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT ='术语表';
CREATE TABLE IF NOT EXISTS `s2_user_token` (
`id` bigint NOT NULL AUTO_INCREMENT,
@@ -543,4 +544,4 @@ CREATE TABLE IF NOT EXISTS `s2_user_token` (
`expire_date_time` DATETIME NOT NULL,
unique key name_username (`name`, `user_name`),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin comment='用户令牌信息表';
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci comment='用户令牌信息表';

View File

@@ -498,5 +498,6 @@ CREATE TABLE IF NOT EXISTS s2_user (
salt varchar(256) DEFAULT NULL,
email varchar(100) NULL,
is_admin smallint NULL,
last_login timestamp NULL,
UNIQUE(name)
);

View File

@@ -37,7 +37,7 @@
<pagehelper.spring.version>2.1.0</pagehelper.spring.version>
<mybatis.version>3.5.3</mybatis.version>
<guava.version>32.0.0-jre</guava.version>
<hanlp.version>portable-1.8.3</hanlp.version>
<hanlp.version>portable-1.8.4</hanlp.version>
<hadoop.version>2.7.2</hadoop.version>
<commons.lang.version>2.6</commons.lang.version>
<commons.lang3.version>3.7</commons.lang3.version>