[improvement](chat) Add a LLMParserLayer to interact with a Python service and add comments to certain classes (#388)

This commit is contained in:
lexluo09
2023-11-15 14:49:22 +08:00
committed by GitHub
parent 7ef3d92f2c
commit aa448b1ba3
11 changed files with 101 additions and 36 deletions

View File

@@ -166,7 +166,7 @@ public class SqlParserSelectHelper {
return new ArrayList<>(results);
}
private static ArrayList<String> getFieldsByPlainSelect(PlainSelect plainSelect) {
private static List<String> getFieldsByPlainSelect(PlainSelect plainSelect) {
if (Objects.isNull(plainSelect)) {
return new ArrayList<>();
}
@@ -396,9 +396,7 @@ public class SqlParserSelectHelper {
}
SelectBody selectBody = selectStatement.getSelectBody();
PlainSelect plainSelect = (PlainSelect) selectBody;
Table table = (Table) plainSelect.getFromItem();
return table;
return (Table) plainSelect.getFromItem();
}
public static String getDbTableName(String sql) {
@@ -406,5 +404,12 @@ public class SqlParserSelectHelper {
return table.getFullyQualifiedName();
}
public static String getNormalizedSql(String sql) {
Select selectStatement = getSelect(sql);
if (selectStatement == null) {
return null;
}
return selectStatement.toString();
}
}