[improvement] supersonic adapt checkstyle (#451)

This commit is contained in:
mainmain
2023-11-30 11:41:55 +08:00
committed by GitHub
parent f8bdb8a4b4
commit e469c449b4
172 changed files with 42 additions and 321 deletions

View File

@@ -43,7 +43,6 @@ public abstract class BaseSemanticCorrector implements SemanticCorrector {
}
}
public abstract void doCorrect(QueryReq queryReq, SemanticParseInfo semanticParseInfo);
protected Map<String, String> getFieldNameMap(Set<Long> modelIds) {

View File

@@ -62,5 +62,4 @@ public class HavingCorrector extends BaseSemanticCorrector {
return;
}
}

View File

@@ -86,7 +86,6 @@ public class SchemaCorrector extends BaseSemanticCorrector {
return parseResult.getLinkingValues();
}
private void updateFieldValueByLinkingValue(SemanticParseInfo semanticParseInfo) {
List<ElementValue> linking = getLinkingValues(semanticParseInfo);
if (CollectionUtils.isEmpty(linking)) {

View File

@@ -44,7 +44,6 @@ public abstract class BaseMapper implements SchemaMapper {
public abstract void doMap(QueryContext queryContext);
public void addToSchemaMap(SchemaMapInfo schemaMap, Long modelId, SchemaElementMatch newElementMatch) {
Map<Long, List<SchemaElementMatch>> modelElementMatches = schemaMap.getModelElementMatches();
List<SchemaElementMatch> schemaElementMatches = modelElementMatches.putIfAbsent(modelId, new ArrayList<>());

View File

@@ -154,5 +154,4 @@ public abstract class BaseMatchStrategy<T> implements MatchStrategy<T> {
public abstract void detectByStep(QueryContext queryContext, Set<T> results,
Set<Long> detectModelIds, Integer startIndex, Integer index, int offset);
}

View File

@@ -46,7 +46,6 @@ public class EmbeddingMatchStrategy extends BaseMatchStrategy<EmbeddingResult> {
return a.getName() + Constants.UNDERLINE + a.getId();
}
@Override
protected void detectByBatch(QueryContext queryContext, Set<EmbeddingResult> results, Set<Long> detectModelIds,
Set<String> detectSegments) {

View File

@@ -36,7 +36,6 @@ public class FuzzyNameMatchStrategy extends BaseMatchStrategy<FuzzyResult> {
private SchemaService schemaService;
private List<SchemaElement> allElements;
@Override
public Map<MatchText, List<FuzzyResult>> match(QueryContext queryContext, List<Term> terms,
Set<Long> detectModelIds) {
@@ -97,7 +96,6 @@ public class FuzzyNameMatchStrategy extends BaseMatchStrategy<FuzzyResult> {
return allElements;
}
private Double getThreshold(QueryContext queryContext) {
Double metricDimensionThresholdConfig = optimizationConfig.getMetricDimensionThresholdConfig();
Double metricDimensionMinThresholdConfig = optimizationConfig.getMetricDimensionMinThresholdConfig();

View File

@@ -39,7 +39,6 @@ public class HanlpDictMapper extends BaseMapper {
convertTermsToSchemaMapInfo(matches, queryContext.getMapInfo(), terms);
}
private void convertTermsToSchemaMapInfo(List<HanlpMapResult> hanlpMapResults, SchemaMapInfo schemaMap,
List<Term> terms) {
if (CollectionUtils.isEmpty(hanlpMapResults)) {
@@ -82,5 +81,4 @@ public class HanlpDictMapper extends BaseMapper {
}
}
}

View File

@@ -41,7 +41,6 @@ public class MapperHelper {
return index;
}
public Integer getStepOffset(List<Term> termList, Integer index) {
List<Integer> offsetList = termList.stream().sorted(Comparator.comparing(Term::getOffset))
.map(term -> term.getOffset()).collect(Collectors.toList());

View File

@@ -99,7 +99,6 @@ public abstract class PluginParser implements SemanticParser {
return semanticParseInfo;
}
private void fillSemanticParseInfo(SemanticParseInfo semanticParseInfo) {
List<SchemaElementMatch> schemaElementMatches = semanticParseInfo.getElementMatches();
if (CollectionUtils.isEmpty(schemaElementMatches)) {

View File

@@ -86,7 +86,6 @@ public class HeuristicModelResolver implements ModelResolver {
return null;
}
public static Map<String, ModelMatchResult> getModelTypeMap(SchemaModelClusterMapInfo schemaMap) {
Map<String, ModelMatchResult> modelCount = new HashMap<>();
for (Map.Entry<String, List<SchemaElementMatch>> entry : schemaMap.getModelElementMatches().entrySet()) {
@@ -114,7 +113,6 @@ public class HeuristicModelResolver implements ModelResolver {
return modelCount;
}
public String resolve(QueryContext queryContext, ChatContext chatCtx, Set<Long> restrictiveModels) {
SchemaModelClusterMapInfo mapInfo = queryContext.getModelClusterMapInfo();
Set<String> matchedModelClusters = mapInfo.getElementMatchesByModelIds(restrictiveModels).keySet();

View File

@@ -59,7 +59,6 @@ public class LLMRequestService {
@Autowired
private OptimizationConfig optimizationConfig;
public boolean check(QueryContext queryCtx) {
QueryReq request = queryCtx.getRequest();
if (StringUtils.isEmpty(llmParserConfig.getUrl())) {
@@ -192,7 +191,6 @@ public class LLMRequestService {
return extraInfoSb.toString();
}
protected List<ElementValue> getValueList(QueryContext queryCtx, ModelCluster modelCluster) {
Map<Long, String> itemIdToName = getItemIdToName(modelCluster);
@@ -223,7 +221,6 @@ public class LLMRequestService {
.collect(Collectors.toMap(SchemaElement::getId, SchemaElement::getName, (value1, value2) -> value2));
}
private Set<String> getTopNFieldNames(ModelCluster modelCluster, LLMParserConfig llmParserConfig) {
SemanticSchema semanticSchema = schemaService.getSemanticSchema();
Set<String> results = semanticSchema.getDimensions(modelCluster.getModelIds()).stream()
@@ -242,7 +239,6 @@ public class LLMRequestService {
return results;
}
protected Set<String> getMatchedFieldNames(QueryContext queryCtx, ModelCluster modelCluster) {
Map<Long, String> itemIdToName = getItemIdToName(modelCluster);
List<SchemaElementMatch> matchedElements = queryCtx.getModelClusterMapInfo()

View File

@@ -79,5 +79,4 @@ public class LLMSqlParser implements SemanticParser {
}
}
}

View File

@@ -45,7 +45,6 @@ public class ChatContextRepositoryImpl implements ChatContextRepository {
}
}
private ChatContext cast(ChatContextDO contextDO) {
ChatContext chatContext = new ChatContext();
chatContext.setChatId(contextDO.getChatId());

View File

@@ -185,7 +185,6 @@ public class ChatQueryRepositoryImpl implements ChatQueryRepository {
return chatQueryDOMapper.updateByPrimaryKeyWithBLOBs(chatQueryDO);
}
public ChatParseDO getParseInfo(Long questionId, int parseId) {
return chatParseMapper.getParseInfo(questionId, parseId);
}

View File

@@ -30,7 +30,6 @@ public class ChatRepositoryImpl implements ChatRepository {
return chatMapper.getAll(creator, agentId);
}
@Override
public Boolean updateChatName(Long chatId, String chatName, String lastTime, String creator) {
return chatMapper.updateChatName(chatId, chatName, lastTime, creator);

View File

@@ -24,5 +24,4 @@ public class StatisticsRepositoryImpl implements StatisticsRepository {
statisticsMapper.batchSaveStatistics(list);
}
}

View File

@@ -285,7 +285,6 @@ public class PluginManager {
.collect(Collectors.toSet());
}
private static List<ParamOption> getSemanticOption(Plugin plugin) {
WebBase webBase = JSONObject.parseObject(plugin.getConfig(), WebBase.class);
if (Objects.isNull(webBase)) {

View File

@@ -103,7 +103,6 @@ public class MetricCheckProcessor implements ParseResultProcessor {
return removeFieldInSql(correctSql, metricToRemove, groupByToRemove, whereFieldsToRemove);
}
/**
* To check whether the dimension bound to the metric exists,
* eg: metric like UV is calculated in a certain dimension, it cannot be used on other dimensions.

View File

@@ -11,7 +11,6 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
public class TimeCostProcessor implements ParseResultProcessor {
@Override
public void process(ParseResp parseResp, QueryContext queryContext, ChatContext chatContext) {
long parseStartTime = parseResp.getParseTimeCost().getParseStartTime();
@@ -19,5 +18,4 @@ public class TimeCostProcessor implements ParseResultProcessor {
System.currentTimeMillis() - parseStartTime - parseResp.getParseTimeCost().getSqlTime());
}
}

View File

@@ -126,7 +126,6 @@ public class MetricAnalyzeQuery extends LLMSemanticQuery {
}
}
private String replaceAnswer(String text, Map<String, String> replacedMap) {
for (String key : replacedMap.keySet()) {
text = text.replaceAll(key, replacedMap.get(key));
@@ -149,7 +148,6 @@ public class MetricAnalyzeQuery extends LLMSemanticQuery {
return tableBuilder.toString();
}
public String fetchInterpret(String queryText, String dataText) {
PluginManager pluginManager = ContextUtils.getBean(PluginManager.class);
LLMAnswerReq lLmAnswerReq = new LLMAnswerReq();
@@ -164,5 +162,4 @@ public class MetricAnalyzeQuery extends LLMSemanticQuery {
return null;
}
}

View File

@@ -191,7 +191,6 @@ public abstract class RuleSemanticQuery extends BaseSemanticQuery {
}
}
@Override
public QueryResult execute(User user) {
String queryMode = parseInfo.getQueryMode();
@@ -285,7 +284,6 @@ public abstract class RuleSemanticQuery extends BaseSemanticQuery {
return matchedQueries;
}
protected QueryStructReq convertQueryStruct() {
return QueryReqBuilder.buildStructReq(parseInfo);
}

View File

@@ -42,7 +42,6 @@ public class ChatConfigController {
private SemanticInterpreter semanticInterpreter = ComponentFactory.getSemanticLayer();
@PostMapping
public Long addChatConfig(@RequestBody ChatConfigBaseReq extendBaseCmd,
HttpServletRequest request,
@@ -59,7 +58,6 @@ public class ChatConfigController {
return configService.editConfig(extendEditCmd, user);
}
@PostMapping("/search")
public List<ChatConfigResp> search(@RequestBody ChatConfigFilter filter,
HttpServletRequest request,
@@ -68,7 +66,6 @@ public class ChatConfigController {
return configService.search(filter, user);
}
@GetMapping("/richDesc/{modelId}")
public ChatConfigRichResp getModelExtendRichInfo(@PathVariable("modelId") Long modelId) {
return configService.getConfigRichInfo(modelId);
@@ -123,5 +120,4 @@ public class ChatConfigController {
return semanticInterpreter.getMetricPage(pageMetricReq, user);
}
}

View File

@@ -33,7 +33,6 @@ public class ChatQueryController {
@Autowired
private SearchService searchService;
@PostMapping("search")
public Object search(@RequestBody QueryReq queryCtx, HttpServletRequest request,
HttpServletResponse response) {

View File

@@ -72,7 +72,6 @@ public class ChatServiceImpl implements ChatService {
return null;
}
@Override
public ChatContext getOrCreateContext(int chatId) {
return chatContextRepository.getOrCreateContext(chatId);
@@ -90,7 +89,6 @@ public class ChatServiceImpl implements ChatService {
chatCtx.setParseInfo(new SemanticParseInfo());
}
@Override
public Boolean addChat(User user, String chatName, Integer agentId) {
ChatDO chatDO = new ChatDO();
@@ -176,7 +174,6 @@ public class ChatServiceImpl implements ChatService {
return showCaseResp;
}
private void fillParseInfo(List<QueryResp> queryResps) {
List<Long> queryIds = queryResps.stream()
.map(QueryResp::getQuestionId).collect(Collectors.toList());

View File

@@ -97,7 +97,6 @@ public class ConfigServiceImpl implements ConfigService {
}
}
@Override
public Long editConfig(ChatConfigEditReqReq configEditCmd, User user) {
log.info("[edit model extend] object:{}", JsonUtil.toString(configEditCmd, true));
@@ -168,13 +167,11 @@ public class ConfigServiceImpl implements ConfigService {
return chaConfigDescList;
}
@Override
public ChatConfigResp fetchConfigByModelId(Long modelId) {
return chatConfigRepository.getConfigByModelId(modelId);
}
private ItemVisibilityInfo fetchVisibilityDescByConfig(ItemVisibility visibility,
ModelSchema modelSchema) {
ItemVisibilityInfo itemVisibilityDesc = new ItemVisibilityInfo();
@@ -329,7 +326,6 @@ public class ConfigServiceImpl implements ConfigService {
return defaultRichConfig;
}
private List<KnowledgeInfoReq> fillKnowledgeBizName(List<KnowledgeInfoReq> knowledgeInfos,
ModelSchema modelSchema) {
if (CollectionUtils.isEmpty(knowledgeInfos)) {

View File

@@ -73,7 +73,6 @@ public class PluginServiceImpl implements PluginService {
}
}
@Override
public List<Plugin> getPluginList() {
List<Plugin> plugins = Lists.newArrayList();
@@ -90,7 +89,6 @@ public class PluginServiceImpl implements PluginService {
return convertList(pluginDOS);
}
@Override
public List<Plugin> query(PluginQueryReq pluginQueryReq) {
PluginDOExample pluginDOExample = new PluginDOExample();

View File

@@ -172,7 +172,6 @@ public class QueryServiceImpl implements QueryService {
return parseResult;
}
@Override
@TimeCost
public QueryResult performExecution(ExecuteQueryReq queryReq) throws Exception {

View File

@@ -46,7 +46,6 @@ public class ChatConfigHelper {
return chatConfig;
}
public ChatConfig editChatConfig(ChatConfigEditReqReq extendEditCmd, User facadeUser) {
ChatConfig chatConfig = new ChatConfig();

View File

@@ -48,7 +48,6 @@ public class DictQueryHelper {
@Value("${dimension.white.weight:60000000}")
private Long dimensionWhiteWeight;
public List<String> fetchDimValueSingle(Long modelId, DefaultMetric defaultMetricDesc, Dim4Dict dim4Dict,
User user) {
List<String> data = new ArrayList<>();
@@ -214,4 +213,4 @@ public class DictQueryHelper {
return joiner.toString();
}
}
}

View File

@@ -242,5 +242,4 @@ public class QueryReqBuilder {
return queryStructCmd;
}
}

View File

@@ -7,7 +7,6 @@ import org.junit.jupiter.api.Test;
class LoadRemoveServiceTest {
@Test
void edit() {
int compute = EditDistance.compute("", "在你的身边");

View File

@@ -19,7 +19,6 @@ public interface FileHandler {
*/
void createDir(String path);
Boolean existPath(String path);
/**

View File

@@ -106,7 +106,6 @@ public class LocalFileHandler implements FileHandler {
return Paths.get(path).toAbsolutePath().toString();
}
@Override
public String getDictRootPath() {
return Paths.get(localFileConfig.getDictDirectoryLatest()).toAbsolutePath().toString();

View File

@@ -22,7 +22,6 @@ public class DimensionWordBuilder extends BaseWordBuilder {
@Value("${nlp.dimension.use.suffix:true}")
private boolean nlpDimensionUseSuffix = true;
@Override
public List<DictWord> doGet(String word, SchemaElement schemaElement) {
List<DictWord> result = Lists.newArrayList();

View File

@@ -44,7 +44,6 @@ public class DictRepositoryImpl implements DictRepository {
return dictTaskDO.getId();
}
@Override
public Boolean updateDictTaskStatus(Integer status, DictTaskDO dictTaskDO) {
dictTaskDO.setStatus(status);

View File

@@ -31,7 +31,6 @@ public class KnowledgeServiceImpl implements KnowledgeService {
SearchService.loadSuffix(suffixes);
}
public void reloadAllData(List<DictWord> natures) {
// 1. reload custom knowledge
try {

View File

@@ -21,7 +21,6 @@ public class LoadRemoveService {
@Value("${mapper.remove.nature.prefix:}")
private String mapperRemoveNaturePrefix;
public List removeNatures(List value, Integer agentId, Set<Long> detectModelIds) {
if (CollectionUtils.isEmpty(value)) {
return value;
@@ -52,4 +51,4 @@ public class LoadRemoveService {
return resultList;
}
}
}

View File

@@ -118,7 +118,6 @@ public class SearchService {
trie.put(key, getValue(attribute.nature));
}
public static void loadSuffix(List<DictWord> suffixes) {
if (CollectionUtils.isEmpty(suffixes)) {
return;

View File

@@ -104,7 +104,6 @@ public class NatureHelper {
.build();
}
private static long getModelCount(List<Term> terms) {
return terms.stream().filter(term -> isModelOrEntity(term, getModelByNature(term.nature))).count();
}