|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
浙公网安备 33010602011771号