(fix)(chat)Fix WhereCorrector's handling of time dimensions of weeks and months (#372)

This commit is contained in:
yangde
2023-11-13 21:06:49 +08:00
committed by GitHub
parent 551a376b00
commit 805abeb261
2 changed files with 17 additions and 1 deletions

View File

@@ -70,7 +70,7 @@ public class WhereCorrector extends BaseSemanticCorrector {
private void addDateIfNotExist(SemanticParseInfo semanticParseInfo) {
String correctS2SQL = semanticParseInfo.getSqlInfo().getCorrectS2SQL();
List<String> whereFields = SqlParserSelectHelper.getWhereFields(correctS2SQL);
if (CollectionUtils.isEmpty(whereFields) || !whereFields.contains(TimeDimensionEnum.DAY.getChName())) {
if (CollectionUtils.isEmpty(whereFields) || !TimeDimensionEnum.containsZhTimeDimension(whereFields)) {
String currentDate = S2SQLDateHelper.getReferenceDate(semanticParseInfo.getModelId());
if (StringUtils.isNotBlank(currentDate)) {
correctS2SQL = SqlParserAddHelper.addParenthesisToWhere(correctS2SQL);