mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-19 00:37:08 +00:00
(improvement)(chat) The large model parsing supports SQL result verification and adds three retries (#1194)
This commit is contained in:
@@ -2,13 +2,15 @@ package com.tencent.supersonic.common.jsqlparser;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.jsqlparser.JSQLParserException;
|
||||
import net.sf.jsqlparser.parser.CCJSqlParserUtil;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
||||
/**
|
||||
* Sql Parser equal Helper
|
||||
* Sql Parser valid Helper
|
||||
*/
|
||||
@Slf4j
|
||||
public class SqlEqualHelper {
|
||||
public class SqlValidHelper {
|
||||
|
||||
/**
|
||||
* determine if two SQL statements are equal.
|
||||
@@ -63,5 +65,15 @@ public class SqlEqualHelper {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isValidSQL(String sql) {
|
||||
try {
|
||||
CCJSqlParserUtil.parse(sql);
|
||||
return true;
|
||||
} catch (JSQLParserException e) {
|
||||
log.error("isValidSQL parse:{}", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user