mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 03:58:14 +00:00
[improvement]Use QueryWrapper in place of hard-coded SQLs (#1944)
Some checks are pending
supersonic CentOS CI / build (11) (push) Waiting to run
supersonic CentOS CI / build (21) (push) Waiting to run
supersonic CentOS CI / build (8) (push) Waiting to run
supersonic mac CI / build (11) (push) Waiting to run
supersonic mac CI / build (21) (push) Waiting to run
supersonic mac CI / build (8) (push) Waiting to run
supersonic ubuntu CI / build (11) (push) Waiting to run
supersonic ubuntu CI / build (21) (push) Waiting to run
supersonic ubuntu CI / build (8) (push) Waiting to run
supersonic windows CI / build (11) (push) Waiting to run
supersonic windows CI / build (21) (push) Waiting to run
supersonic windows CI / build (8) (push) Waiting to run
Some checks are pending
supersonic CentOS CI / build (11) (push) Waiting to run
supersonic CentOS CI / build (21) (push) Waiting to run
supersonic CentOS CI / build (8) (push) Waiting to run
supersonic mac CI / build (11) (push) Waiting to run
supersonic mac CI / build (21) (push) Waiting to run
supersonic mac CI / build (8) (push) Waiting to run
supersonic ubuntu CI / build (11) (push) Waiting to run
supersonic ubuntu CI / build (21) (push) Waiting to run
supersonic ubuntu CI / build (8) (push) Waiting to run
supersonic windows CI / build (11) (push) Waiting to run
supersonic windows CI / build (21) (push) Waiting to run
supersonic windows CI / build (8) (push) Waiting to run
* [improvement][launcher]Use API to get element ID avoiding hard-code. * [fix][launcher]Fix mysql scripts. * [improvement][launcher]Support DuckDB database and refactor translator code structure. * [improvement][headless-fe] Revamped the interaction for semantic modeling routing and successfully implemented the switching between dimension and dataset management. * [improvement][Headless] Add table ddl in Dbschema * [improvement][Headless] Add get database by type * [improvement][Headless] Supports automatic batch creation of models based on db table names. * [improvement][Headless] Supports getting domain by bizName * [improvement][launcher]Refactor unit tests and demo data. * [fix][launcher]Change default vector dimension to 512. * [improvement](Dict) add dimValueAliasMap info for KnowledgeBaseService * [improvement][headless]Use QueryWrapper to replace hard-code SQL in mapper xml. * [improvement][chat]Introduce ChatMemory to delegate ChatMemoryDO. * [fix][common]Fix embedding store sys configs. * [fix][common]Fix postgres schema, using varchar instead of char. * [improvement][launcher]Change supersonic docker deployment from mysql to postgres. * [Fix][launcher]Fix a number of issues related to semantic modeling. * [Fix][headless]Fix the evaluation logic of agg type. * [fix][assembly]Fix Dockerfile and add docker compose run script. * [fix][chat]Fix "multiple assignments to same column "similar_queries". * [improvement][headless]Use LamdaQueryWrapper to avoid hard-coded column names. * [improvement][headless]Refactor headless infra to support advanced semantic modelling. * [improvement][headless]Change class name `Dim` to `Dimension`. * [improvement][chat]Introduce `TimeFieldMapper` to always map time field. * [fix][headless]Remove unnecessary dimension existence check. * [fix][chat]Fix adjusted filters don't take effect. ---------
This commit is contained in:
@@ -15,7 +15,7 @@ public class ColumnSchema {
|
||||
|
||||
private FieldType filedType;
|
||||
|
||||
private AggOperatorEnum agg;
|
||||
private AggOperatorEnum agg = AggOperatorEnum.SUM;
|
||||
|
||||
private String name;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import lombok.NoArgsConstructor;
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Dim {
|
||||
public class Dimension {
|
||||
|
||||
private String name;
|
||||
|
||||
@@ -27,16 +27,14 @@ public class Dim {
|
||||
|
||||
private String description;
|
||||
|
||||
private int isTag;
|
||||
|
||||
public Dim(String name, String bizName, DimensionType type, Integer isCreateDimension) {
|
||||
public Dimension(String name, String bizName, DimensionType type, Integer isCreateDimension) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.isCreateDimension = isCreateDimension;
|
||||
this.bizName = bizName;
|
||||
}
|
||||
|
||||
public Dim(String name, String bizName, DimensionType type, Integer isCreateDimension,
|
||||
public Dimension(String name, String bizName, DimensionType type, Integer isCreateDimension,
|
||||
String expr, String dateFormat, DimensionTimeTypeParams typeParams) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
@@ -47,8 +45,8 @@ public class Dim {
|
||||
this.bizName = bizName;
|
||||
}
|
||||
|
||||
public static Dim getDefault() {
|
||||
return new Dim("数据日期", "imp_date", DimensionType.partition_time, 0, "imp_date",
|
||||
public static Dimension getDefault() {
|
||||
return new Dimension("数据日期", "imp_date", DimensionType.partition_time, 0, "imp_date",
|
||||
Constants.DAY_FORMAT, new DimensionTimeTypeParams("false", "day"));
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class ModelDetail {
|
||||
|
||||
private List<Identify> identifiers = Lists.newArrayList();
|
||||
|
||||
private List<Dim> dimensions = Lists.newArrayList();
|
||||
private List<Dimension> dimensions = Lists.newArrayList();
|
||||
|
||||
private List<Measure> measures = Lists.newArrayList();
|
||||
|
||||
@@ -39,7 +39,7 @@ public class ModelDetail {
|
||||
return sqlQuery;
|
||||
}
|
||||
|
||||
public List<Dim> filterTimeDims() {
|
||||
public List<Dimension> filterTimeDims() {
|
||||
if (CollectionUtils.isEmpty(dimensions)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package com.tencent.supersonic.headless.api.pojo.enums;
|
||||
|
||||
public enum FieldType {
|
||||
primary_key, foreign_key, partition_time, time, dimension, measure;
|
||||
primary_key, foreign_key, partition_time, time, categorical, measure;
|
||||
}
|
||||
|
||||
@@ -32,8 +32,6 @@ public class DimensionReq extends SchemaItem {
|
||||
|
||||
private DataTypeEnums dataType;
|
||||
|
||||
private int isTag;
|
||||
|
||||
private Map<String, Object> ext;
|
||||
|
||||
private DimensionTimeTypeParams typeParams;
|
||||
|
||||
@@ -9,6 +9,10 @@ import java.util.List;
|
||||
@Data
|
||||
public class ModelBuildReq {
|
||||
|
||||
private String name;
|
||||
|
||||
private String bizName;
|
||||
|
||||
private Long databaseId;
|
||||
|
||||
private Long domainId;
|
||||
|
||||
@@ -211,7 +211,9 @@ public class QueryStructReq extends SemanticQueryReq {
|
||||
SelectItem selectExpressionItem = new SelectItem(function);
|
||||
String alias =
|
||||
StringUtils.isNotBlank(aggregator.getAlias()) ? aggregator.getAlias() : columnName;
|
||||
selectExpressionItem.setAlias(new Alias(alias));
|
||||
if (!alias.equals(columnName)) {
|
||||
selectExpressionItem.setAlias(new Alias(alias));
|
||||
}
|
||||
return selectExpressionItem;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ public class DimensionResp extends SchemaItem {
|
||||
|
||||
private Long modelId;
|
||||
|
||||
private Long domainId;
|
||||
|
||||
private DimensionType type;
|
||||
|
||||
private String expr;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.tencent.supersonic.headless.api.pojo.response;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.tencent.supersonic.headless.api.pojo.Dim;
|
||||
import com.tencent.supersonic.headless.api.pojo.Dimension;
|
||||
import com.tencent.supersonic.headless.api.pojo.DrillDownDimension;
|
||||
import com.tencent.supersonic.headless.api.pojo.Field;
|
||||
import com.tencent.supersonic.headless.api.pojo.Identify;
|
||||
@@ -62,7 +62,7 @@ public class ModelResp extends SchemaItem {
|
||||
return isOpen != null && isOpen == 1;
|
||||
}
|
||||
|
||||
public List<Dim> getTimeDimension() {
|
||||
public List<Dimension> getTimeDimension() {
|
||||
if (modelDetail == null) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user