(improvement)(headless) Supports creating new metric by fields and metrics (#639)

Co-authored-by: jolunoluo
This commit is contained in:
LXW
2024-01-17 14:21:48 +08:00
committed by GitHub
parent b2beecb5b8
commit 07e6924cfd
40 changed files with 647 additions and 221 deletions

View File

@@ -6,6 +6,7 @@ public enum StatusEnum {
ONLINE("ONLINE", 1),
OFFLINE("OFFLINE", 2),
DELETED("DELETED", 3),
UNAVAILABLE("UNAVAILABLE", 4),
UNKNOWN("UNKNOWN", -1);

View File

@@ -1,11 +1,5 @@
package com.tencent.supersonic.common.util.jsqlparser;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import com.tencent.supersonic.common.pojo.enums.AggOperatorEnum;
import lombok.extern.slf4j.Slf4j;
import net.sf.jsqlparser.expression.Expression;
@@ -19,6 +13,12 @@ import net.sf.jsqlparser.statement.select.SelectItem;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
/**
* Sql Parser Select function Helper
*/
@@ -32,6 +32,11 @@ public class SqlParserSelectFunctionHelper {
return SqlParserSelectHelper.hasGroupBy(sql);
}
public static void main(String[] args) {
String sql = "select a from table";
System.out.println(hasAggregateFunction(sql));
}
public static boolean hasFunction(String sql, String functionName) {
Set<String> functions = getFunctions(sql);
if (!CollectionUtils.isEmpty(functions)) {