mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-14 22:25:19 +00:00
[improvement][headless]Clean code logic of headless translator.
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
package com.tencent.supersonic.headless.api.pojo;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.tencent.supersonic.headless.api.pojo.enums.AggOption;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class MetricTable {
|
||||
|
||||
private String alias;
|
||||
private List<String> metrics = Lists.newArrayList();
|
||||
private List<String> dimensions = Lists.newArrayList();
|
||||
private String where;
|
||||
private AggOption aggOption = AggOption.DEFAULT;
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.tencent.supersonic.headless.api.pojo;
|
||||
|
||||
import com.tencent.supersonic.common.pojo.Aggregator;
|
||||
import com.tencent.supersonic.common.pojo.ColumnOrder;
|
||||
import com.tencent.supersonic.common.pojo.DateConf;
|
||||
import com.tencent.supersonic.common.pojo.Filter;
|
||||
import com.tencent.supersonic.common.pojo.Order;
|
||||
import com.tencent.supersonic.common.pojo.enums.QueryType;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Data
|
||||
public class QueryParam {
|
||||
// struct
|
||||
private List<String> groups = new ArrayList();
|
||||
private List<Aggregator> aggregators = new ArrayList();
|
||||
private List<Order> orders = new ArrayList();
|
||||
private List<Filter> dimensionFilters = new ArrayList();
|
||||
private List<Filter> metricFilters = new ArrayList();
|
||||
private DateConf dateInfo;
|
||||
private Long limit = 2000L;
|
||||
private QueryType queryType;
|
||||
private String s2SQL;
|
||||
private String correctS2SQL;
|
||||
private Long dataSetId;
|
||||
private String dataSetName;
|
||||
private Set<Long> modelIds = new HashSet<>();
|
||||
private List<Param> params = new ArrayList<>();
|
||||
|
||||
// metric
|
||||
private List<String> metrics = new ArrayList();
|
||||
private List<String> dimensions;
|
||||
private String where;
|
||||
private List<ColumnOrder> order;
|
||||
private boolean nativeQuery = false;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.tencent.supersonic.headless.api.pojo.request;
|
||||
|
||||
import com.tencent.supersonic.headless.api.pojo.MetricTable;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class ParseSqlReq {
|
||||
private Map<String, String> variables;
|
||||
private String sql = "";
|
||||
private List<MetricTable> tables;
|
||||
private boolean supportWith = true;
|
||||
private boolean withAlias = true;
|
||||
|
||||
public Map<String, String> getVariables() {
|
||||
if (variables == null) {
|
||||
variables = new HashMap<>();
|
||||
}
|
||||
return variables;
|
||||
}
|
||||
}
|
||||
@@ -34,12 +34,11 @@ public class QueryFilter implements Serializable {
|
||||
QueryFilter that = (QueryFilter) o;
|
||||
return Objects.equal(bizName, that.bizName) && Objects.equal(name, that.name)
|
||||
&& operator == that.operator && Objects.equal(value, that.value)
|
||||
&& Objects.equal(elementID, that.elementID)
|
||||
&& Objects.equal(function, that.function);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(bizName, name, operator, value, elementID, function);
|
||||
return Objects.hashCode(bizName, name, operator, value, function);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user