mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 12:07:42 +00:00
(improvement)(semantic) create model demo data through api instead of data-h2.sql
(improvement)(semantic) create benchmark demo data through api instead of data-h2.sql
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
package com.tencent.supersonic.semantic.api.model.enums;
|
||||
|
||||
public enum IdentifyTypeEnum {
|
||||
|
||||
primary,
|
||||
|
||||
foreign,
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.tencent.supersonic.semantic.api.model.enums;
|
||||
|
||||
public enum SemanticTypeEnum {
|
||||
|
||||
CATEGORY,
|
||||
ID,
|
||||
DATE,
|
||||
NUMBER
|
||||
|
||||
}
|
||||
@@ -25,6 +25,13 @@ public class Dim {
|
||||
|
||||
private String bizName;
|
||||
|
||||
public Dim(String name, String bizName, String type, Integer isCreateDimension) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.isCreateDimension = isCreateDimension;
|
||||
this.bizName = bizName;
|
||||
}
|
||||
|
||||
public static Dim getDefault() {
|
||||
return new Dim("日期", "time", "2023-05-28",
|
||||
Constants.DAY_FORMAT,
|
||||
|
||||
@@ -10,8 +10,8 @@ import lombok.NoArgsConstructor;
|
||||
@NoArgsConstructor
|
||||
public class DimensionTimeTypeParams {
|
||||
|
||||
private String isPrimary;
|
||||
private String isPrimary = "true";
|
||||
|
||||
private String timeGranularity;
|
||||
private String timeGranularity = "day";
|
||||
|
||||
}
|
||||
|
||||
@@ -28,5 +28,10 @@ public class Measure {
|
||||
|
||||
private Long datasourceId;
|
||||
|
||||
|
||||
public Measure(String name, String bizName, String agg, Integer isCreateMetric) {
|
||||
this.name = name;
|
||||
this.agg = agg;
|
||||
this.isCreateMetric = isCreateMetric;
|
||||
this.bizName = bizName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,8 +29,13 @@ public class H2Adaptor extends EngineAdaptor {
|
||||
|
||||
@Override
|
||||
public String getColumnMetaQueryTpl() {
|
||||
return "SELECT COLUMN_NAME AS name, DATA_TYPE AS dataType\n"
|
||||
+ "FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA ='%s' AND TABLE_NAME = '%s'";
|
||||
return "SELECT COLUMN_NAME AS name, "
|
||||
+ " case DATA_TYPE"
|
||||
+ " when '12' then 'varchar'"
|
||||
+ " when '-5' then 'integer'"
|
||||
+ " when '8' then 'double'"
|
||||
+ " end AS dataType"
|
||||
+ " FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA ='%s' AND TABLE_NAME = '%s'";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user