// 物理表上涉及某列的聚合
public class Aggregation {
private Tag tag; // 物理列类标签
private AggOperateTypeEnum aggType; // 聚合函数
}
// 业务上的指标
public class Indicate {
private IndicateTypeEnum indicateType; // 指标类型
private CombineIndicate combineIndicate; // 复合指标
private Aggregation aggregation; // 原子指标
private Double constant; // 常数
}
// 复合指标
public class CombineIndicate {
private MathOperateTypeEnum mathOperateType;
private List<Indicate> indicates;
}
public class SightService {
// 预览
public Long preview(
StandardSightCondition condition, /人群条件*/
boolean useCache /*是否使用缓存*/);
// 重合度
public Double previewCoincidence(
StandardSightCondition condition1, /人群条件1*/
StandardSightCondition condition2, /人群条件2*/
boolean useCache /*是否使用缓存*/);
// 洞察
public Map<String, Double> insight(
StandardSightCondition condition, /人群条件*/
Tag groupBy, /洞察标签*/
StandardTagCondition insightTagCondition, /洞察标签维度*/
boolean useCache /*是否使用缓存*/);
// 分区
public String dataPartition(
List<String> tableCode /*数据表*/,
boolean useCache /*是否使用缓存*/);
// 榜单
public List<Map<String, Object>> rank(
StandardSightCondition userCondition /*人群条件*/,
StandardConditionNode analizeCondition /*指标表条件*/,
Tag groupBy /*分组字段*/,
List<Indicate> indicates /*指标*/,
SortCondition<Indicate> order /*排序*/,
Page page /*分页*/,
DataPartitionRange dataPartitionRange /*数据分区*/,
boolean useCache /*是否使用缓存*/);
// 总览
public Map<String, Double> overview(
StandardSightCondition userCondition /*人群条件*/,
StandardConditionNode analizeCondition /*指标表条件*/,
List<Indicate> indicates /*指标*/,
DataPartitionRange dataPartitionRange /*数据分区*/,
boolean useCache /*是否使用缓存*/);
}
文件
public enum FileManagerTypeEnum {
TOS, // TOS
LARK_EXCEL; // 飞书表格
}
public interface FileManager {
// 上传文件
String upload(InputStream inputStream);
FileManagerTypeEnum belong();
}
查询
指标表
列名
类型
查询
描述
object_id
string
条件
用户id
shop_id
int
分组
店铺id
click_cnt
int
指标
点击次数
pay_amt
double
指标
用户GMV
指标表列
标签宽表
列名
类型
查询
描述
object_id
string
条件
用户id
gender
string
条件
性别
…
…
条件
…
标签宽表列
人群表
列名
类型
查询
描述
object_id
string
条件
用户id
object_set_id
string
条件
人群包id
date
string
分区
数据日期
人群表列
A: 指标表
B: 标签宽表
C: 分群表
select A.shop_id, SUM(A.pay_amt), COUNT(A.click_cnt)
from A
where A.date between '20221120' and '20221127'
and A.cate_id = 101
and A.object_id golobal in (
select B.object_id
from B
where B.gender = 'male'
and B.object_id global in (
select C.object_id
from C
where C.date = ''
C.object_set_id = 'cond_cr10110026'
)
)
group by A.shop_id