mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-12 12:37:55 +00:00
(improvement)(headless)Normalize space SQL strings in the log messages.
This commit is contained in:
@@ -39,7 +39,7 @@ public class GroupByCorrector extends BaseSemanticCorrector {
|
||||
SemanticSchema semanticSchema = queryContext.getSemanticSchema();
|
||||
// check has distinct
|
||||
if (SqlSelectHelper.hasDistinct(correctS2SQL)) {
|
||||
log.info("not add group by ,exist distinct in correctS2SQL:{}", correctS2SQL);
|
||||
log.debug("no need to add groupby ,existed distinct in s2sql:{}", correctS2SQL);
|
||||
return false;
|
||||
}
|
||||
//add alias field name
|
||||
@@ -53,7 +53,7 @@ public class GroupByCorrector extends BaseSemanticCorrector {
|
||||
return false;
|
||||
}
|
||||
if (SqlSelectHelper.hasGroupBy(correctS2SQL)) {
|
||||
log.info("not add group by ,exist group by in correctS2SQL:{}", correctS2SQL);
|
||||
log.debug("No need to add groupby, existed groupby in s2sql:{}", correctS2SQL);
|
||||
return false;
|
||||
}
|
||||
Environment environment = ContextUtils.getBean(Environment.class);
|
||||
|
||||
@@ -17,7 +17,6 @@ import com.tencent.supersonic.headless.chat.parser.SatisfactionChecker;
|
||||
import com.tencent.supersonic.headless.chat.query.llm.s2sql.LLMReq;
|
||||
import com.tencent.supersonic.headless.chat.query.llm.s2sql.LLMResp;
|
||||
import com.tencent.supersonic.headless.chat.utils.ComponentFactory;
|
||||
import com.tencent.supersonic.headless.chat.utils.S2SqlDateHelper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
@@ -28,7 +27,6 @@ import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -101,11 +99,7 @@ public class LLMRequestService {
|
||||
}
|
||||
llmReq.setLinking(linking);
|
||||
|
||||
String currentDate = S2SqlDateHelper.getReferenceDate(queryCtx, dataSetId);
|
||||
if (StringUtils.isEmpty(currentDate)) {
|
||||
currentDate = DateUtils.getBeforeDate(0);
|
||||
}
|
||||
llmReq.setCurrentDate(currentDate);
|
||||
llmReq.setCurrentDate(DateUtils.getBeforeDate(0));
|
||||
llmReq.setSqlGenType(LLMReq.SqlGenType.valueOf(parserConfig.getParameterValue(PARSER_STRATEGY_TYPE)));
|
||||
llmReq.setLlmConfig(queryCtx.getLlmConfig());
|
||||
|
||||
|
||||
@@ -35,12 +35,12 @@ public class LLMSqlParser implements SemanticParser {
|
||||
if (dataSetId == null) {
|
||||
return;
|
||||
}
|
||||
log.info("Try generating query statement for dataSetId:{}", dataSetId);
|
||||
log.info("try generating query statement for dataSetId:{}", dataSetId);
|
||||
|
||||
//3.invoke LLM service to do parsing.
|
||||
tryParse(queryCtx, dataSetId);
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to parse query:", e);
|
||||
log.error("failed to parse query:", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user