mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-14 22:25:19 +00:00
[improvement] supersonic adapt checkstyle (#451)
This commit is contained in:
@@ -17,4 +17,5 @@ public class DataBaseConfig {
|
||||
public DataSource dataSource() {
|
||||
return new DruidDataSource();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,5 +19,4 @@ public class PageBaseReq {
|
||||
return this.pageSize;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ public class RecordInfo {
|
||||
|
||||
private Date updatedAt;
|
||||
|
||||
|
||||
public RecordInfo createdBy(String userName) {
|
||||
this.createdBy = userName;
|
||||
this.createdAt = new Date();
|
||||
|
||||
@@ -15,7 +15,6 @@ public enum ReturnCode {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
@@ -23,4 +22,4 @@ public enum ReturnCode {
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,5 +52,4 @@ public enum AggOperatorEnum {
|
||||
return null != aggType && aggType.toUpperCase().equals(COUNT_DISTINCT.getOperator());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ public enum AggregateTypeEnum {
|
||||
COUNT,
|
||||
NONE;
|
||||
|
||||
|
||||
public static AggregateTypeEnum of(String agg) {
|
||||
for (AggregateTypeEnum aggEnum : AggregateTypeEnum.values()) {
|
||||
if (aggEnum.name().equalsIgnoreCase(agg)) {
|
||||
|
||||
@@ -36,7 +36,6 @@ public enum DictWordType {
|
||||
return NATURE_SPILT + type;
|
||||
}
|
||||
|
||||
|
||||
public static DictWordType getNatureType(String nature) {
|
||||
if (StringUtils.isEmpty(nature) || !nature.startsWith(NATURE_SPILT)) {
|
||||
return null;
|
||||
|
||||
@@ -41,12 +41,10 @@ public enum FilterOperatorEnum {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isValueCompare(FilterOperatorEnum filterOperatorEnum) {
|
||||
return EQUALS.equals(filterOperatorEnum) || GREATER_THAN.equals(filterOperatorEnum)
|
||||
|| GREATER_THAN_EQUALS.equals(filterOperatorEnum) || MINOR_THAN.equals(filterOperatorEnum)
|
||||
|| MINOR_THAN_EQUALS.equals(filterOperatorEnum) || NOT_EQUALS.equals(filterOperatorEnum);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -17,5 +17,4 @@ public enum SensitiveLevelEnum {
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -27,5 +27,4 @@ public class SysParameterController {
|
||||
return sysParameterService.getSysParameter();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -29,5 +29,4 @@ public class BeanMapper<T> {
|
||||
return (String[]) emptyNames.toArray(result);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ public class ChatGptHelper {
|
||||
@Value("${llm.chatgpt.proxyPort:}")
|
||||
private Integer proxyPort;
|
||||
|
||||
|
||||
public ChatGPT getChatGPT() {
|
||||
Proxy proxy = null;
|
||||
if (!"default".equals(proxyIp)) {
|
||||
@@ -76,7 +75,6 @@ public class ChatGptHelper {
|
||||
return res.getContent();
|
||||
}
|
||||
|
||||
|
||||
public String mockAlias(String mockType,
|
||||
String name,
|
||||
String bizName,
|
||||
@@ -124,7 +122,6 @@ public class ChatGptHelper {
|
||||
return res.getContent();
|
||||
}
|
||||
|
||||
|
||||
public String mockDimensionValueAlias(String json) {
|
||||
String msg = "Assuming you are a professional data analyst specializing in indicators,for you a json list,"
|
||||
+ "the required content to follow is as follows: "
|
||||
@@ -144,11 +141,9 @@ public class ChatGptHelper {
|
||||
return res.getContent();
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
ChatGptHelper chatGptHelper = new ChatGptHelper();
|
||||
System.out.println(chatGptHelper.mockAlias("", "", "", "", "", false));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -76,7 +76,6 @@ public class ContextUtils implements ApplicationContextAware {
|
||||
return context;
|
||||
}
|
||||
|
||||
|
||||
public static String getActiveProfile() {
|
||||
String activeProfile = context.getEnvironment().getActiveProfiles()[0];
|
||||
if (StringUtils.isEmpty(activeProfile)) {
|
||||
@@ -85,4 +84,4 @@ public class ContextUtils implements ApplicationContextAware {
|
||||
return activeProfile;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,6 @@ public class DateModeUtils {
|
||||
dateInfo.getEndDate());
|
||||
}
|
||||
|
||||
|
||||
public String generateMonthSql(LocalDate endData, Long unit, String dateFormatStr) {
|
||||
LocalDate dateMax = endData;
|
||||
List<String> months = generateMonthStr(dateMax, unit, dateFormatStr);
|
||||
@@ -227,7 +226,6 @@ public class DateModeUtils {
|
||||
return -1L;
|
||||
}
|
||||
|
||||
|
||||
public String recentDateStr(ItemDateResp dateDate, DateConf dateInfo) {
|
||||
if (Objects.isNull(dateDate)) {
|
||||
return "";
|
||||
@@ -412,4 +410,4 @@ public class DateModeUtils {
|
||||
return Arrays.asList(sysDateCol, sysDateMonthCol, sysDateWeekCol);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,5 +24,4 @@ public enum DatePeriodEnum {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -57,7 +57,6 @@ public class DateUtils {
|
||||
return DateTimeFormatter.ofPattern(formats[0]);
|
||||
}
|
||||
|
||||
|
||||
public static String getBeforeDate(int intervalDay) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(new Date());
|
||||
@@ -66,7 +65,6 @@ public class DateUtils {
|
||||
return dateFormat.format(calendar.getTime());
|
||||
}
|
||||
|
||||
|
||||
public static String getBeforeDate(int intervalDay, DatePeriodEnum datePeriodEnum) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
|
||||
String currentDate = dateFormat.format(new Date());
|
||||
@@ -107,7 +105,6 @@ public class DateUtils {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static String format(Date date) {
|
||||
DateFormat dateFormat;
|
||||
if (containsTime(date)) {
|
||||
|
||||
@@ -338,7 +338,6 @@ public class HttpClientUtils {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param headers
|
||||
* @param httpMethod
|
||||
@@ -507,7 +506,6 @@ public class HttpClientUtils {
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* for us scheduling
|
||||
*
|
||||
@@ -595,7 +593,6 @@ public class HttpClientUtils {
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* for us scheduling, send delete
|
||||
*
|
||||
@@ -659,7 +656,6 @@ public class HttpClientUtils {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static HttpClientResult doPutJson(String url, Map<String, String> headers, String req) {
|
||||
return RetryUtils.exec(() -> {
|
||||
HttpPut httpPut = null;
|
||||
|
||||
@@ -171,7 +171,6 @@ public class JsonUtil {
|
||||
return INSTANCE.asmapToObject(map, clazz);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 对象转json
|
||||
*
|
||||
@@ -418,7 +417,6 @@ public class JsonUtil {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 对象转换成Map
|
||||
*/
|
||||
@@ -445,7 +443,6 @@ public class JsonUtil {
|
||||
return objectMapper.convertValue(map, clazz);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Json转换成ListMap
|
||||
*
|
||||
@@ -627,4 +624,4 @@ public class JsonUtil {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,6 @@ public class SqlFilterUtils {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
public String getWhereClause(List<Filter> filters) {
|
||||
return getWhereClause(filters, true);
|
||||
}
|
||||
@@ -248,5 +247,4 @@ public class SqlFilterUtils {
|
||||
return PARENTHESES_START + SPACE + criterion.getValue().toString() + SPACE + PARENTHESES_END;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,6 @@ public class YamlUtils {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static String toYamlWithoutNull(Object object) {
|
||||
String jsonStr = JSONObject.toJSONString(object);
|
||||
if (object instanceof List) {
|
||||
|
||||
@@ -17,7 +17,6 @@ public class Retrieval {
|
||||
|
||||
protected Map<String, String> metadata;
|
||||
|
||||
|
||||
public static Long getLongId(String id) {
|
||||
if (StringUtils.isBlank(id)) {
|
||||
return null;
|
||||
|
||||
@@ -48,5 +48,4 @@ public class DateFunctionHelper {
|
||||
return unit.getValue();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -86,14 +86,12 @@ public class FieldAndValueAcquireVisitor extends ExpressionVisitorAdapter {
|
||||
fieldExpressions.add(fieldExpression);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void visit(MinorThanEquals expr) {
|
||||
FieldExpression fieldExpression = getFilterExpression(expr);
|
||||
fieldExpressions.add(fieldExpression);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void visit(GreaterThan expr) {
|
||||
FieldExpression fieldExpression = getFilterExpression(expr);
|
||||
|
||||
@@ -53,7 +53,6 @@ public class FiledFilterReplaceVisitor extends ExpressionVisitorAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void visit(GreaterThan expr) {
|
||||
List<Expression> expressions = parserFilter(expr, JsqlConstants.GREATER_THAN_CONSTANT);
|
||||
@@ -74,7 +73,6 @@ public class FiledFilterReplaceVisitor extends ExpressionVisitorAdapter {
|
||||
return waitingForAdds;
|
||||
}
|
||||
|
||||
|
||||
public List<Expression> parserFilter(ComparisonOperator comparisonOperator, String condExpr) {
|
||||
List<Expression> result = new ArrayList<>();
|
||||
String toString = comparisonOperator.toString();
|
||||
@@ -109,4 +107,4 @@ public class FiledFilterReplaceVisitor extends ExpressionVisitorAdapter {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,5 +70,4 @@ public class FiledNameReplaceVisitor extends ExpressionVisitorAdapter {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,6 @@ public class FilterRemoveVisitor extends ExpressionVisitorAdapter {
|
||||
expr.setLeftExpression(new LongValue(0L));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void visit(MinorThanEquals expr) {
|
||||
if (!isRemove(expr.getLeftExpression())) {
|
||||
@@ -64,7 +63,6 @@ public class FilterRemoveVisitor extends ExpressionVisitorAdapter {
|
||||
expr.setLeftExpression(new LongValue(1L));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void visit(GreaterThan expr) {
|
||||
if (!isRemove(expr.getLeftExpression())) {
|
||||
@@ -93,4 +91,4 @@ public class FilterRemoveVisitor extends ExpressionVisitorAdapter {
|
||||
expr.setLeftExpression(new LongValue(1L));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,6 @@ public class FunctionReplaceVisitor extends ExpressionVisitorAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void visit(GreaterThan expr) {
|
||||
List<Expression> expressions = reparseDate(expr, "<");
|
||||
@@ -70,7 +69,6 @@ public class FunctionReplaceVisitor extends ExpressionVisitorAdapter {
|
||||
return waitingForAdds;
|
||||
}
|
||||
|
||||
|
||||
public List<Expression> reparseDate(ComparisonOperator comparisonOperator, String startDateOperator) {
|
||||
List<Expression> result = new ArrayList<>();
|
||||
Expression leftExpression = comparisonOperator.getLeftExpression();
|
||||
|
||||
@@ -141,7 +141,6 @@ public class SqlParserAddHelper {
|
||||
return selectStatement.toString();
|
||||
}
|
||||
|
||||
|
||||
public static String addWhere(String sql, Expression expression) {
|
||||
Select selectStatement = SqlParserSelectHelper.getSelect(sql);
|
||||
SelectBody selectBody = selectStatement.getSelectBody();
|
||||
|
||||
@@ -83,6 +83,7 @@ public class SqlParserRemoveHelper {
|
||||
}
|
||||
removeWhereExpression(whereExpression, removeFieldNames);
|
||||
}
|
||||
|
||||
public static String removeNumberCondition(String sql) {
|
||||
Select selectStatement = SqlParserSelectHelper.getSelect(sql);
|
||||
if (selectStatement == null) {
|
||||
|
||||
@@ -81,7 +81,6 @@ public class SqlParserSelectHelper {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public static List<String> getSelectFields(String sql) {
|
||||
List<PlainSelect> plainSelectList = getPlainSelect(sql);
|
||||
if (CollectionUtils.isEmpty(plainSelectList)) {
|
||||
|
||||
@@ -53,7 +53,6 @@ class SqlParseUtilsTest {
|
||||
Assert.assertTrue(addFieldToSql.toLowerCase().contains("pv"));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void getSqlParseInfo() {
|
||||
|
||||
@@ -115,7 +114,6 @@ class SqlParseUtilsTest {
|
||||
Assert.assertTrue(!selectFields.contains("play_count"));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void getWhereFieldTest() {
|
||||
SqlParserInfo sqlParserInfo = SqlParseUtils.getSqlParseInfo(
|
||||
|
||||
@@ -49,7 +49,6 @@ class SqlParserAddHelperTest {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void addFunctionToSelect() {
|
||||
String sql = "SELECT user_name FROM 超音数 WHERE sys_imp_date <= '2023-09-03' AND "
|
||||
@@ -117,7 +116,6 @@ class SqlParserAddHelperTest {
|
||||
replaceSql);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void addAggregateToMetricField() {
|
||||
String sql = "select department, pv from t_1 where sys_imp_date = '2023-09-11' order by pv desc limit 10";
|
||||
@@ -217,7 +215,6 @@ class SqlParserAddHelperTest {
|
||||
replaceSql);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void addAggregateToCountDiscountMetricField() {
|
||||
String sql = "select department, uv from t_1 where sys_imp_date = '2023-09-11' order by uv desc limit 10";
|
||||
@@ -375,7 +372,6 @@ class SqlParserAddHelperTest {
|
||||
replaceSql);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void addParenthesisToWhere() {
|
||||
String sql = "select 歌曲名 from 歌曲库 where datediff('day', 发布日期, '2023-08-09') <= 1 "
|
||||
|
||||
@@ -100,7 +100,6 @@ class SqlParserReplaceHelperTest {
|
||||
+ "ORDER BY 播放量 DESC LIMIT 11", replaceSql);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void replaceFieldNameByValue() {
|
||||
|
||||
@@ -350,7 +349,6 @@ class SqlParserReplaceHelperTest {
|
||||
+ "sum(user_id) < (SELECT min(user_id) FROM CSpider WHERE user_id = '英文')", replaceSql);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void replaceTable() {
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@ class SqlParserSelectFunctionHelperTest {
|
||||
Assert.assertEquals(hasAggregateFunction, true);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void hasFunction() throws JSQLParserException {
|
||||
|
||||
|
||||
@@ -120,7 +120,6 @@ class SqlParserSelectHelperTest {
|
||||
System.out.println(fieldExpression);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void getAllFields() {
|
||||
|
||||
@@ -173,7 +172,6 @@ class SqlParserSelectHelperTest {
|
||||
Assert.assertEquals(allFields.size(), 3);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void getSelectFields() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user