|NO.Z.00006|——————————|BigDataEnd|——|Hadoop&OLAP_Kylin.V06|——|Kylin.v06|Kylin构建Cube|按渠道维度构建cube|
一、创建Cube(按渠道)
### --- Cube设计:
### --- 设计结构
~~~ 维度:渠道
~~~ 指标:销售总金额、订单总笔数、最大订单金额、订单的平均金额

### --- SQL:
select t2.channelid, t2.channelname,
sum(t1.price), max(t1.price), count(t1.price), avg(t1.price)
from dw_sales t1 join dim_channel t2 on t1.channelid = t2.channelid
group by t2.channelid, t2.channelname;
二、按渠道维度构建cube流程
### --- 构建cube流程
~~~ 核心步骤:指定数据源【可省略】 => 定义model => 定义Cube => Cube Build => SQL
~~~ 创建Model:指定关联表,关联条件
~~~ 创建Cube:定义维度
~~~ # 定义度量
~~~ 执行构建、等待构建完成
### --- 执行SQL查询,获取结果
select t2.channelid,
t2.channelname, avg(t1.price)
from dw_sales t1 join dim_channel t2 on t1.channelid = t2.channelid
group by t2.channelid, t2.channelname;
三、按渠道构建cube
### --- 按渠道构建cube
~~~ 创建Model
~~~ 定义事实表
~~~ 定义维表:指定关联表、关联条件
~~~ 维度列
~~~ 定义度量——>Save





二、创建cube
### --- 创建cube
~~~ 创建cube
~~~ 定义维度Dimensions
~~~ 定义度量
~~~ 刷新设置:默认
~~~ 高级设置:默认
~~~ 覆盖设置:默认
~~~ 概述:默认








三、构建cube
### --- 构建cube
~~~ 构建cube
~~~ 查看监控状态
~~~ 查看cube是否构建成功




四、执行SQL
### --- 执行SQL语句
### --- SQL执行流程
~~~ # 执行SQL语句
select t2.channelid,
t2.channelname, avg(t1.price)
from dw_sales t1 join dim_channel t2 on t1.channelid = t2.channelid
group by t2.channelid, t2.channelname;

Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
——W.S.Landor
分类:
bdv023-kylin
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通