mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 20:25:12 +00:00
(improvement)(headless) Supports creating new metric by fields and metrics (#639)
Co-authored-by: jolunoluo
This commit is contained in:
@@ -6,6 +6,7 @@ public enum StatusEnum {
|
||||
ONLINE("ONLINE", 1),
|
||||
OFFLINE("OFFLINE", 2),
|
||||
DELETED("DELETED", 3),
|
||||
UNAVAILABLE("UNAVAILABLE", 4),
|
||||
UNKNOWN("UNKNOWN", -1);
|
||||
|
||||
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user