|NO.Z.00007|——————————|BigDataEnd|——|Hadoop&OLAP_Kylin.V07|——|Kylin.v07|Kylin构建Cube|4个维度构建cube|

一、创建Cube(按日期、区域、产品、渠道)
### --- Cube设计:
### --- cube执行流程

~~~     维度:日期、渠道、区域、产品
~~~     指标:销售总金额、订单总笔数
### --- SQL:

select t1.date1,
       t2.regionid,
       t2.regionname,
       t3.productid,
       t3.productname,
       sum(t1.price) as total_money,
       sum(t1.amount) as total_amount
from
       dw_sales t1
       inner join dim_region t2 on t1.regionid = t2.regionid
       inner join dim_product t3 on t1.productid = t3.productid
group by
       t1.date1,
       t2.regionid,
       t2.regionname,
       t3.productid,
       t3.productname
order by
       t1.date1,
       t2.regionname,
       t3.productname;
二、创建cube流程
### --- 创建cube流程

~~~     步骤:定义数据源 => 定义Model => 定义Cube => 构建Cube
三、日期、区域、产品、渠道创建cube
### --- 日期、区域、产品、渠道创建cube

~~~     创建Model
~~~     关联表、关联条件
~~~     选择维度
~~~     选择度量
~~~     settings:默认
四、创建cube
### --- 创建cube

~~~     创建Cube:
~~~     指定维度
~~~     定义维度指标
~~~     刷新设置:默认
~~~     高级设置:默认
~~~     覆盖设置:默认
~~~     概述:默认——Save

五、构建cube
### --- 构建cube

~~~     构建cube
~~~     cube构建完成
六、SQL查询
### --- 执行SQL查询语句
### --- 执行SQL查询,获取结果

select t1.date1,
       t2.regionid,
       t2.regionname,
       t3.productid,
       t3.productname,
       sum(t1.price) as total_money,
       sum(t1.amount) as total_amount
from
       dw_sales t1
       inner join dim_region t2 on t1.regionid = t2.regionid
       inner join dim_product t3 on t1.productid = t3.productid
group by
       t1.date1,
       t2.regionid,
       t2.regionname,
       t3.productid,
       t3.productname
order by
       t1.date1,
       t2.regionname,
       t3.productname;

 
 
 
 
 
 
 
 
 

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

 

 

posted on   yanqi_vip  阅读(14)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示