Modified: kylin/site/feed.xml
URL: 
http://svn.apache.org/viewvc/kylin/site/feed.xml?rev=1899440&r1=1899439&r2=1899440&view=diff
==============================================================================
--- kylin/site/feed.xml (original)
+++ kylin/site/feed.xml Thu Mar 31 14:09:40 2022
@@ -19,11 +19,851 @@
     <description>Apache Kylin Home</description>
     <link>http://kylin.apache.org/</link>
     <atom:link href="http://kylin.apache.org/feed.xml"; rel="self" 
type="application/rss+xml"/>
-    <pubDate>Tue, 29 Mar 2022 06:59:11 -0700</pubDate>
-    <lastBuildDate>Tue, 29 Mar 2022 06:59:11 -0700</lastBuildDate>
+    <pubDate>Thu, 31 Mar 2022 06:59:26 -0700</pubDate>
+    <lastBuildDate>Thu, 31 Mar 2022 06:59:26 -0700</lastBuildDate>
     <generator>Jekyll v2.5.3</generator>
     
       <item>
+        <title>如何使用 Excel 查询 Kylin?MDX for Kylin!</title>
+        <description>&lt;h2 id=&quot;kylin--mdx&quot;&gt;Kylin 为什么需要 
MDX?&lt;/h2&gt;
+
+&lt;h3 id=&quot;section&quot;&gt;多维数据库和业务语义层&lt;/h3&gt;
+
+&lt;p&gt;多维数据库与关系型数据库的å…
³é”®åŒºåˆ«åœ¨äºŽä¸šåŠ¡è¡¨è¾¾èƒ½åŠ›ã€‚å°½ç®¡ SQL 
表达能力很强,是数据分析师的基本技能,但如果以 
“人人都是分析师” 为目标,SQL 和å…
³ç³»æ•°æ®åº“对非技术人员还是太难了。从非技术人员的视角,数据湖和数据仓库就好似一个黑暗的房间,知道å
…¶ä¸­æœ‰å¾ˆå¤šæ•°æ®ï¼Œå´å› ä¸ºä¸æ‡‚数据库理论和 SQL,无法看清
、理解、和使用这些数据。&lt;/p&gt;
+
+&lt;p&gt;如何让数据湖(和数据仓库)对非技术人员也 
“&lt;strong&gt;清澈见底&lt;/strong&gt;”?这就需要引å…
¥ä¸€ä¸ªå¯¹éžæŠ€æœ¯äººå‘˜æ›´åŠ å‹å¥½çš„â€œ&lt;strong&gt;å…
³ç³»æ•°æ®æ¨¡åž‹&lt;/strong&gt; – 
&lt;strong&gt;多维数据模型&lt;/strong&gt;”。如果说å…
³ç³»æ¨¡åž‹æè¿°äº†æ•°æ®çš„æŠ€æœ¯å½¢æ€ï¼Œé‚£ä¹ˆå¤šç»´æ¨¡åž‹åˆ™æè¿°äº†æ•°æ®çš„业务形态。在多维数据库中,度量对应了每个人都懂的业务指æ
 ‡ï¼Œç»´åº¦åˆ™æ˜¯æ¯”较、观察这些业务指æ 
‡çš„角度。要与上个月比较 KPI,要åœ
 
¨å¹³è¡Œäº‹ä¸šéƒ¨ä¹‹é—´æ¯”较绩效,这些是每个非技术人员都理解的概念。通过将å
…³ç³»æ¨¡åž‹æ˜ 
射到多维模型,本质是在技术数据之上增强了业务语义,形成业务语义层,帮助非技术人员也能看懂、探索、使用数据。&lt;/p&gt;
+
+&lt;p&gt;为了增强 Kylin 
作为多维数据库的语义层能力,支持多维查询语言是 Kylin 
Roadmap 上的重点内容,比如 MDX 和 DAX。通过 MDX 可以将 Kylin 
中的数据模型转换为业务友好的语言,赋予数据业务价值,方便对接
 &lt;strong&gt;Excel&lt;/strong&gt;、Tableau 等 BI å·¥å…
·è¿›è¡Œå¤šç»´åˆ†æžã€‚&lt;/p&gt;
+
+&lt;h3 id=&quot;mdx-&quot;&gt;基于 MDX 打造业务指标平台&lt;/h3&gt;
+
+&lt;p&gt;使用 MDX 来创建复杂的业务指标,相对 SQL 
的一些特点和优势如下:&lt;/p&gt;
+
+&lt;ol&gt;
+  
&lt;li&gt;更好的&lt;strong&gt;支持复杂分析场景&lt;/strong&gt;,如半累åŠ
 ã€å¤šå¯¹å¤šã€æ—¶é—´çª—口分析等;&lt;/li&gt;
+  &lt;li&gt;广泛支持各种 BI,“Kylin + MDX” 不仅能够通过 SQL 
接口暴露为类似于关系型数据库的表,也可以暴露为兼容 
XMLA 协议的带有语义信息的数据源,可通过 MDX 
语言进行查询,支持对接 &lt;strong&gt;Excel&lt;/strong&gt; 
等只能通过 XMLA 协议对接数据源的 BI;&lt;/li&gt;
+  &lt;li&gt;基于 Kylin 中的数据模型灵活定义 MDX 
语义模型,将底层数据结构转换为业务友好的语言,赋予数据业务价值,使得业务人员在分析时æ—
 éœ€å…³å¿ƒåº•层的技术复杂度和实现;通过 MDX 
模型向外暴露统一语义,帮助用户&lt;strong&gt;构建统一的业务语义层&lt;/strong&gt;。(详细信息可以参考链接
 1/6/7)&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h2 id=&quot;mdx--1&quot;&gt;MDX 介绍&lt;/h2&gt;
+
+&lt;h3 id=&quot;mdx&quot;&gt;什么是 MDX?&lt;/h3&gt;
+
+&lt;p&gt;MDX (Multi Dimensional eXpression) 是一种 OLAP 
多维数据集的查询语言,最初由 Microsoft 于 1997 年作为 OLEDB 
for OLAP 规范引入,随后集成在 SSAS 中。目前,MDX 在 OLAP 
数据库中被广泛采用。&lt;/p&gt;
+
+&lt;p&gt;MDX 在很多方面与结构化查询语言 (SQL) 
语法相似,但它不是 SQL 语言的扩展;事实上,MDX 
所提供的一些功能也可由 SQL 
提供,尽管不是那么有效或直观。如同 SQL 查询一样,MDX 
查询可以包括SELECT 子句)、FROM 子句和 WHERE 子句。这些å…
³é”®å­—以及其它关键字提供了各种工å…
·ï¼Œç”¨æ¥ä»Žå¤šç»´æ•°æ®é›†æžå–数据的特定部分。&lt;/p&gt;
+
+&lt;p&gt;MDX 查询语法示例如下(详细信息可以参考链接 
3):&lt;/p&gt;
+
+&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre 
class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span 
class=&quot;k&quot;&gt;select&lt;/span&gt; &lt;span 
class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
class=&quot;n&quot;&gt;axis_specification&lt;/span&gt;&lt;span 
class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span 
class=&quot;p&quot;&gt;[,&lt;/span&gt; &lt;span 
class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
class=&quot;n&quot;&gt;axis_specification&lt;/span&gt;&lt;span 
class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span 
class=&quot;p&quot;&gt;]&lt;/span&gt;
+&lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span 
class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
class=&quot;n&quot;&gt;cube_specification&lt;/span&gt;&lt;span 
class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
+&lt;span class=&quot;k&quot;&gt;where&lt;/span&gt; &lt;span 
class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
class=&quot;n&quot;&gt;slicer_specification&lt;/span&gt;&lt;span 
class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
+&lt;/code&gt;&lt;/pre&gt;
+&lt;/div&gt;
+
+&lt;h3 id=&quot;mdx--2&quot;&gt;MDX 基本概念&lt;/h3&gt;
+
+&lt;p&gt;在了解学习 MDX 之前,请至少掌握以下概念。限于相å…
³æ¦‚念在 Microsoft 的 SSAS 
官网有比较详细的介绍,不了解的同学可以通过文章
末尾的参考链接学习。(详细信息可以参考链接 2/3/4)&lt;/p&gt;
+
+&lt;ol&gt;
+  
&lt;li&gt;维度(Dimensions)、级别(Levels)、成员(Members)和度量值(Measures)&lt;/li&gt;
+  &lt;li&gt;单元(Cell)、元组(Tuple)和集合(Set)&lt;/li&gt;
+  &lt;li&gt;轴维度(Query Axis)和切片器维度(Slicer Axis)&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h3 id=&quot;mdx--sql-&quot;&gt;MDX 和 SQL 的比较&lt;/h3&gt;
+
+&lt;p&gt;&lt;strong&gt;查询对象&lt;/strong&gt;不同,MDX 
的查询对象是&lt;strong&gt;多维数据集&lt;/strong&gt;(Cube),是提前
 Join 和聚合好的数据,查询时不需要指定 Join 关系。SQL 
查询对象是&lt;strong&gt;å…
³ç³»è¡¨&lt;/strong&gt;(Table),是一条条的明细记录,查询时需要指定表之间的
 Join 关系。&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;查询结果&lt;/strong&gt;不同,SQL 
返回&lt;strong&gt;二维数据子集&lt;/strong&gt;,而 MDX 
返回&lt;strong&gt;多维数据集&lt;/strong&gt;。(详细信息可以参考链接
 5)&lt;/p&gt;
+
+&lt;h1 id=&quot;mdx-for-kylin-&quot;&gt;MDX for Kylin 介绍&lt;/h1&gt;
+
+&lt;h3 id=&quot;mdx-for-kylin--1&quot;&gt;什么是 MDX for Kylin ?&lt;/h3&gt;
+
+&lt;p&gt;&lt;strong&gt;MDX for Kylin&lt;/strong&gt; 是基于 
&lt;strong&gt;Mondrian&lt;/strong&gt; 二次开发的,由 
&lt;strong&gt;Kyligence&lt;/strong&gt; 贡献的,使用 &lt;strong&gt;Apache 
Kylin 4&lt;/strong&gt; 作为数据源的 MDX 查询引擎 。MDX for Kylin 
的使用体验比较接近 Microsoft SSAS,可以集成多种数据分析工å…
·ï¼ŒåŒ…括 Microsoft Excel、Tableau 
等,可以为大数据分析场景下提供更极致的体验。&lt;/p&gt;
+
+&lt;h3 id=&quot;mdx-for-kylin--2&quot;&gt;MDX for Kylin 创建业务指æ 
‡&lt;/h3&gt;
+
+&lt;h4 id=&quot;section-1&quot;&gt;原子指标和业务指标&lt;/h4&gt;
+
+&lt;p&gt;在 Kylin Cube 
我们创建的各种度量,是在单独的一列上的进行的聚合计算(TopN
 除外),只包含了有限的几种聚合函数,即 
Sum/Max/Min/Count/Count 
Distinct,相对比较简单,我们称之为&lt;strong&gt;原子指æ 
‡&lt;/strong&gt;。&lt;/p&gt;
+
+&lt;p&gt;在实际业务场景中,基于原子指æ 
‡æˆ‘们可以对&lt;strong&gt;原子指æ 
‡&lt;/strong&gt;的各种复杂运算,来创建有业务含义的复合指æ 
‡ï¼Œè¿™æ ·çš„æŒ‡æ ‡æˆ‘们称之为&lt;strong&gt;业务指æ 
‡ã€‚&lt;/strong&gt;&lt;/p&gt;
+
+&lt;h4 
id=&quot;section-2&quot;&gt;层级结构、计算度量和命名集&lt;/h4&gt;
+
+&lt;p&gt;&lt;strong&gt;层级结构:&lt;/strong&gt;层级结构是基于维度的级别集合,可用于提高数据分析人员的分析能力。例如,ä½
 å¯ä»¥åˆ›å»ºä¸€ä¸ªæ—¶é—´å±‚级结构,包
含了年、季、月、周和日级别。这æ 
·åˆ†æžäººå‘˜åœ¨å®¢æˆ·ç«¯ä¸­å¯ä»¥å…
ˆé€å¹´åˆ†æžé”€å”®é¢ï¼Œåœ¨éœ€è¦æ—¶å¯ä»¥åˆ†åˆ«å±•开“季度 &amp;gt; 月 
&amp;gt; 周 &amp;gt; 日”来进行更细粒度的分析。&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;计算度量:&lt;/strong&gt;计算度量是对&lt;strong&gt;原子指æ
 ‡&lt;/strong&gt;使用 MDX 
表达式进行复合计算形成的新的度量/指æ 
‡ï¼Œæˆ‘们主要使用计算度量来创建&lt;strong&gt;业务指æ 
‡&lt;/strong&gt;。&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;命名集:&lt;/strong&gt;在 MDX for Kylin 
的使用中,经常会出现需要重复使用一组成员的需求,这种需求可以通过定义命名集来满足。命名集(NamedSet)
 是根据指定的表达式 
计算得到的一个成员Set,即一组成员的集合,命名集可以直接置于轴上用于展示,也可以在计算度量或å
…¶ä»–命名集的表达式中使用。&lt;/p&gt;
+
+&lt;h4 id=&quot;section-3&quot;&gt;创建语义模型&lt;/h4&gt;
+
+&lt;p&gt;在 Kylin 4 根据表与表之间的å…
³ç³»åˆ›å»ºæ•°æ®æ¨¡åž‹ï¼Œå¹¶ä¸”在 Cube 
上定义维度和度量,这些度量我们可以认为是&lt;strong&gt;原子指æ
 ‡&lt;/strong&gt;。&lt;/p&gt;
+
+&lt;p&gt;在 MDX for Kylin,将相关联的 Kylin Cube 相å…
³è”,来创建数据集;并且基于原子指æ 
‡ï¼Œæ¥åˆ›å»ºæœ‰ä¸šåŠ¡å«ä¹‰çš„&lt;strong&gt;业务指æ 
‡ã€‚&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/1_use_excel_to_query_kylin.cn.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;h4 id=&quot;section-4&quot;&gt;数据分析&lt;/h4&gt;
+
+&lt;p&gt;使用时,客户端发送 MDX 查询给 MDX for Kylin,MDX for 
Kylin 再解析 MDX 查询翻译为 SQL 并且发送给 Kylin ,然后 Kylin 
通过预计算的 Cuboid 回答 SQL 查询并把结果交还给 MDX for 
Kylin,MDX for Kylin 会再做一些衍生指æ 
‡çš„计算,最终将多维数据结果返回给客户端。&lt;/p&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/2_use_excel_to_query_kylin.cn.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;h4 id=&quot;section-5&quot;&gt;流程总结&lt;/h4&gt;
+
+&lt;p&gt;总的来说,支持 MDX 接口能够增强 Kylin 
的语义层能力,为用户带来统一的数据分析和管理体验,更好地发挥数据的价值。下图就是将从下而上,展示从原始数据åŠ
 å·¥ä¸šåŠ¡æŒ‡æ ‡çš„è¿‡ç¨‹ã€‚&lt;/p&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/3_use_excel_to_query_kylin.cn.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;h3 id=&quot;mdx-for-kylin--3&quot;&gt;MDX for Kylin 
的技术优势&lt;/h3&gt;
+
+&lt;p&gt;MDX for Kylin 相对其它开源 MDX 查询引擎,å…
·æœ‰ä»¥ä¸‹ä¼˜åŠ¿ï¼š&lt;/p&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;更好支持BI(Excel/Tableau/Power BI等) 产品,适配 XMLA 
协议;&lt;/li&gt;
+  &lt;li&gt;针对 BI 的 MDX Query 进行了特定优化重写;&lt;/li&gt;
+  &lt;li&gt;适配 Kylin 查询,通过 Kylin 的预计算能力加速 MDX 
查询;&lt;/li&gt;
+  &lt;li&gt;通过简洁易懂的操作界面,提供了统一的指æ 
‡å®šä¹‰å’Œç®¡ç†èƒ½åŠ›ã€‚&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;h1 id=&quot;docker-&quot;&gt;从 Docker 快速开始&lt;/h1&gt;
+
+&lt;h3 id=&quot;section-6&quot;&gt;测试环境&lt;/h3&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;Macbook Pro 笔记本
+    &lt;ul&gt;
+      &lt;li&gt;Docker Desktop (latest version)&lt;/li&gt;
+    &lt;/ul&gt;
+  &lt;/li&gt;
+  &lt;li&gt;Windows 10 虚拟机
+    &lt;ul&gt;
+      &lt;li&gt;Microsoft Excel (for Windows)&lt;/li&gt;
+    &lt;/ul&gt;
+  &lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;h3 id=&quot;section-7&quot;&gt;启动容器&lt;/h3&gt;
+
+&lt;p&gt;这个容器包含了 Yarn、HDFS、MySQL、Kylin、MDX for Kylin 
等进程。&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&quot;language-she&quot;&gt;docker run -d \
+    -m 8g \
+    -p 7070:7070 \
+    -p 7080:7080 \
+    -p 8088:8088 \
+    -p 50070:50070 \
+    -p 8032:8032 \
+    -p 8042:8042 \
+    -p 2181:2181 \
+    --name kylin-4.0.1 \
+    apachekylin/apache-kylin-standalone:kylin-4.0.1-mondrian
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&quot;section-8&quot;&gt;检查环境&lt;/h3&gt;
+
+&lt;p&gt;等待一段时间,请依次检查 HDFS/YARN/Kylin/MDX for Kylin 
的 Web UI 是否可以访问。&lt;/p&gt;
+
+&lt;table&gt;
+  &lt;thead&gt;
+    &lt;tr&gt;
+      &lt;th&gt;&lt;strong&gt;组件&lt;/strong&gt;&lt;/th&gt;
+      &lt;th&gt;&lt;strong&gt;Web UI 地址&lt;/strong&gt;&lt;/th&gt;
+    &lt;/tr&gt;
+  &lt;/thead&gt;
+  &lt;tbody&gt;
+    &lt;tr&gt;
+      &lt;td&gt;HDFS&lt;/td&gt;
+      &lt;td&gt;http://localhost:50070/dfshealth.html&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;YARN&lt;/td&gt;
+      &lt;td&gt;http://localhost:8088/cluster&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;Kylin&lt;/td&gt;
+      &lt;td&gt;http://localhost:7070/kylin&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;MDX for Kylin&lt;/td&gt;
+      &lt;td&gt;http://localhost:7080/overview&lt;/td&gt;
+    &lt;/tr&gt;
+  &lt;/tbody&gt;
+&lt;/table&gt;
+
+&lt;h3 id=&quot;cube&quot;&gt;构建样例 Cube&lt;/h3&gt;
+
+&lt;p&gt;请直接使用 Kylin 自带的样例 Cube:&lt;code 
class=&quot;highlighter-rouge&quot;&gt;kylin_sales_cube&lt;/code&gt;。&lt;/p&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/4_use_excel_to_query_kylin.cn.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;h3 id=&quot;mdx--3&quot;&gt;创建 MDX 数据集&lt;/h3&gt;
+
+&lt;h5 id=&quot;mdx-for-kylin&quot;&gt;登录 MDX for Kylin&lt;/h5&gt;
+
+&lt;p&gt;默认账号/密码是 ADMIN/KYLIN,MDX for Kylin 的账户与 KYLIN 
的同步。&lt;/p&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/5_use_excel_to_query_kylin.cn.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;h5 id=&quot;section-9&quot;&gt;创建数据集和定义关系&lt;/h5&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/6_use_excel_to_query_kylin.cn.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/7_use_excel_to_query_kylin.cn.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;h5 id=&quot;section-10&quot;&gt;创建时间层级&lt;/h5&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;修改&lt;code 
class=&quot;highlighter-rouge&quot;&gt;KYLIN_CAL_DT&lt;/code&gt;的表属性&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/8_use_excel_to_query_kylin.cn.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;修改 &lt;code 
class=&quot;highlighter-rouge&quot;&gt;YEAR_BEG_DT&lt;/code&gt; 
的类型为“年”&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/9_use_excel_to_query_kylin.cn.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/10_use_excel_to_query_kylin.cn.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;同理修改&lt;code 
class=&quot;highlighter-rouge&quot;&gt;MONTH_BEG_DT&lt;/code&gt;和&lt;code 
class=&quot;highlighter-rouge&quot;&gt;WEEK_BEG_DT&lt;/code&gt; 
,并且选择对应的层级&lt;/li&gt;
+  &lt;li&gt;创建时间层级&lt;code 
class=&quot;highlighter-rouge&quot;&gt;Calendar&lt;/code&gt; 
,请注意设置层级结构的前后顺序保持为“年-月-周”&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/11_use_excel_to_query_kylin.cn.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;h5 id=&quot;section-11&quot;&gt;修改原子指标名称&lt;/h5&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;修改 &lt;code 
class=&quot;highlighter-rouge&quot;&gt;GMV_SUM&lt;/code&gt; 为 
“销售额”,修改&lt;code 
class=&quot;highlighter-rouge&quot;&gt;SELLER_CNT_HLL&lt;/code&gt;为“商家数量”&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/12_use_excel_to_query_kylin.cn.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;h5 id=&quot;section-12&quot;&gt;创建业务指标(计算度量)&lt;/h5&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;创建业务指标“商户平均消费额”&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/13_use_excel_to_query_kylin.cn.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;依次创建业务指æ 
‡â€œé”€å”®é¢å¹´åŒæœŸå¢žé•¿çŽ‡â€å’Œâ€œé”€å”®é¢æœˆåŒæœŸå¢žé•¿çŽ‡â€&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;table&gt;
+  &lt;thead&gt;
+    &lt;tr&gt;
+      &lt;th&gt;&lt;strong&gt;指标名称&lt;/strong&gt;&lt;/th&gt;
+      &lt;th&gt;&lt;strong&gt;MDX 表达式&lt;/strong&gt;&lt;/th&gt;
+    &lt;/tr&gt;
+  &lt;/thead&gt;
+  &lt;tbody&gt;
+    &lt;tr&gt;
+      &lt;td&gt;商户平均消费额&lt;/td&gt;
+      &lt;td&gt;[Measures].[销售额]/[Measures].[商家数量]&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;销售额年同期增长率&lt;/td&gt;
+      &lt;td&gt;[Measures].[销售额] / SUM(  ParallelPeriod(    
[KYLIN_CAL_DT].[Calendar-Hierarchy].[YEAR_BEG_DT],    1,    
[KYLIN_CAL_DT].[Calendar-Hierarchy].CurrentMember  ),  [Measures].[销售额] ) 
- 1&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;销售额月同期增长率&lt;/td&gt;
+      &lt;td&gt;[Measures].[销售额] / SUM(  ParallelPeriod(    
[KYLIN_CAL_DT].[Calendar-Hierarchy].[MONTH_BEG_DT],    1,    
[KYLIN_CAL_DT].[Calendar-Hierarchy].CurrentMember  ),  [Measures].[销售额] ) 
- 1&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;总销售额&lt;/td&gt;
+      &lt;td&gt;Fixed([KYLIN_CAL_DT].[YEAR_BEG_DT], 
[Measures].[销售额])&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;全年销售额占比&lt;/td&gt;
+      &lt;td&gt;[Measures].[销售额]/[Measures].[总销售额]&lt;/td&gt;
+    &lt;/tr&gt;
+  &lt;/tbody&gt;
+&lt;/table&gt;
+
+&lt;h3 id=&quot;http-api--mdx-&quot;&gt;HTTP API 测试 MDX 查询&lt;/h3&gt;
+
+&lt;p&gt;如果你没有 一个 Windows 环境的 Excel,并且你想测试你
在上一步测试创建的业务指标,请通过  MDX 暴露的查询相å…
³çš„ REST API 来验证查询结果。如果想修改 MDX 
查询语句,请修改以下&lt;code 
class=&quot;highlighter-rouge&quot;&gt;&amp;lt;Statement&amp;gt;&amp;lt;/Statement&amp;gt;&lt;/code&gt;
 里面的 MDX 语句,并且请根据情况修改&lt;code 
class=&quot;highlighter-rouge&quot;&gt;Catalog&lt;/code&gt;字段的值。&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&quot;language-she&quot;&gt;curl --location 
--request POST &#39;http://localhost:7080/mdx/xmla/learn_kylin&#39; \
+--header &#39;Authorization: Basic QURNSU46S1lMSU4=&#39; \
+--header &#39;Connection:  Keep-Alive&#39; \
+--header &#39;SOAPAction: 
&quot;urn:schemas-microsoft-com:xml-analysis:Execute&quot;&#39; \
+--header &#39;User-Agent: MSOLAP&#39; \
+--header &#39;Content-Type: text/xml&#39; \
+--header &#39;Accept: */*&#39; \
+--header &#39;Cookie: JSESSIONID=22BF2B6D889F183D7F7E898D4D769398; 
MDXAUTH=ZUt6V1VBRE1JTjoyYTk3Zjg2NTdiNjk0NTE5NzA0NjFiN2ZjYTNkYzg2OToxNjQ2NjMxNDkw&#39;
 \
+--data-raw &#39;&amp;lt;soap:Envelope 
xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&amp;gt;
+    &amp;lt;soap:Header&amp;gt;
+        &amp;lt;Session 
xmlns=&quot;urn:schemas-microsoft-com:xml-analysis&quot; 
SessionId=&quot;8nblet191q&quot;/&amp;gt;
+    &amp;lt;/soap:Header&amp;gt;
+    &amp;lt;soap:Body&amp;gt;
+        &amp;lt;Execute 
xmlns=&quot;urn:schemas-microsoft-com:xml-analysis&quot;&amp;gt;
+           &amp;lt;Command&amp;gt;
+                &amp;lt;Statement&amp;gt;
+SELECT {[Measures].[销售额],
+        [Measures].[商家数量],
+        [Measures].[商户平均消费额],
+        [Measures].[全年销售额占比],
+        [Measures].[销售额年同期增长率],
+        [Measures].[销售额月同期增长率]} 
+    DIMENSION PROPERTIES PARENT_UNIQUE_NAME ON COLUMNS , 
+NON EMPTY 
Hierarchize(AddCalculatedMembers({DrilldownLevel({[KYLIN_CAL_DT].[Calendar-Hierarchy].[All]})}))
 
+    DIMENSION PROPERTIES PARENT_UNIQUE_NAME ON ROWS  
+FROM [demo0] 
+CELL PROPERTIES VALUE, FORMAT_STRING, LANGUAGE, BACK_COLOR, FORE_COLOR, 
FONT_FLAGS
+                &amp;lt;/Statement&amp;gt;            
+            &amp;lt;/Command&amp;gt;
+            &amp;lt;Properties&amp;gt;
+                &amp;lt;PropertyList&amp;gt;
+                    &amp;lt;Catalog&amp;gt;demo0&amp;lt;/Catalog&amp;gt;
+                    &amp;lt;Timeout&amp;gt;0&amp;lt;/Timeout&amp;gt;
+                    &amp;lt;Content&amp;gt;SchemaData&amp;lt;/Content&amp;gt;
+                    
&amp;lt;Format&amp;gt;Multidimensional&amp;lt;/Format&amp;gt;
+                    
&amp;lt;AxisFormat&amp;gt;TupleFormat&amp;lt;/AxisFormat&amp;gt;
+                    
&amp;lt;DbpropMsmdFlattened2&amp;gt;false&amp;lt;/DbpropMsmdFlattened2&amp;gt;
+                    
&amp;lt;SafetyOptions&amp;gt;2&amp;lt;/SafetyOptions&amp;gt;
+                    &amp;lt;Dialect&amp;gt;MDX&amp;lt;/Dialect&amp;gt;
+                    
&amp;lt;MdxMissingMemberMode&amp;gt;Error&amp;lt;/MdxMissingMemberMode&amp;gt;
+                    
&amp;lt;DbpropMsmdOptimizeResponse&amp;gt;9&amp;lt;/DbpropMsmdOptimizeResponse&amp;gt;
+                    
&amp;lt;DbpropMsmdActivityID&amp;gt;6C94075F-65AD-4B9E-B3EB-4536A191A6AB&amp;lt;/DbpropMsmdActivityID&amp;gt;
+                    
&amp;lt;DbpropMsmdRequestID&amp;gt;9FA20B8A-ACA0-414E-98EA-14649F20CF75&amp;lt;/DbpropMsmdRequestID&amp;gt;
+                    
&amp;lt;LocaleIdentifier&amp;gt;1033&amp;lt;/LocaleIdentifier&amp;gt;
+                    
&amp;lt;DbpropMsmdMDXCompatibility&amp;gt;1&amp;lt;/DbpropMsmdMDXCompatibility&amp;gt;
+                &amp;lt;/PropertyList&amp;gt;
+            &amp;lt;/Properties&amp;gt;
+        &amp;lt;/Execute&amp;gt;
+    &amp;lt;/soap:Body&amp;gt;
+&amp;lt;/soap:Envelope&amp;gt;&#39;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&quot;excel-&quot;&gt;通过 Excel 透视表访问业务指æ 
‡&lt;/h3&gt;
+
+&lt;h5 id=&quot;mdx-for-kylin-1&quot;&gt;连接 MDX for Kylin&lt;/h5&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;打开 Microsoft Excel (for Windows)&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/14_use_excel_to_query_kylin.cn.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;配置 MDX for Kylin 地址,请替换 IP_Adress 为你
笔记本的 IP 地址,用户名和密码使用 Kylin 的账号和密ç 
ã€‚&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/15_use_excel_to_query_kylin.cn.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;h5 
id=&quot;section-13&quot;&gt;通过数据透视表分析销售额&lt;/h5&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;配置数据透视表&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/16_use_excel_to_query_kylin.cn.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;查看年同期销售额增长率&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/17_use_excel_to_query_kylin.cn.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;查看月同期销售额增长率&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/18_use_excel_to_query_kylin.cn.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;h2 id=&quot;section-14&quot;&gt;参考链接&lt;/h2&gt;
+
+&lt;table&gt;
+  &lt;thead&gt;
+    &lt;tr&gt;
+      &lt;th&gt;&lt;strong&gt;编号&lt;/strong&gt;&lt;/th&gt;
+      &lt;th&gt;&lt;strong&gt;链接&lt;/strong&gt;&lt;/th&gt;
+      &lt;th&gt;&lt;strong&gt;注释&lt;/strong&gt;&lt;/th&gt;
+      &lt;th&gt;&lt;strong&gt;产品&lt;/strong&gt;&lt;/th&gt;
+    &lt;/tr&gt;
+  &lt;/thead&gt;
+  &lt;tbody&gt;
+    &lt;tr&gt;
+      &lt;td&gt;1&lt;/td&gt;
+      
&lt;td&gt;https://lists.apache.org/thread/4fkhyw1fyf0jg5cb18v7vxyqbn6vm3zv&lt;/td&gt;
+      &lt;td&gt;Kylin 社区发起开发语义层的讨论&lt;/td&gt;
+      &lt;td&gt;Apache Kylin&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;2&lt;/td&gt;
+      &lt;td&gt;https://mondrian.pentaho.com/documentation/mdx.php&lt;/td&gt;
+      &lt;td&gt;Mondrian 的官网文档&lt;/td&gt;
+      &lt;td&gt;Mondrian&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;3&lt;/td&gt;
+      
&lt;td&gt;https://docs.microsoft.com/en-us/sql/mdx/mdx-syntax-elements-mdx&lt;/td&gt;
+      &lt;td&gt;SSAS 关于 MDX 查询的语法规范&lt;/td&gt;
+      &lt;td&gt;Microsoft SSAS&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;4&lt;/td&gt;
+      
&lt;td&gt;https://wiki.smartbi.com.cn/pages/viewpage.action?pageId=76692713&lt;/td&gt;
+      &lt;td&gt;SmartBI 关于 MDX 基本概念的介绍&lt;/td&gt;
+      &lt;td&gt;SmartBI&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;5&lt;/td&gt;
+      
&lt;td&gt;https://dba.stackexchange.com/questions/138311/good-example-of-mdx-vs-sql-for-analytical-queries&lt;/td&gt;
+      &lt;td&gt;对比 SQL 和 MDX&lt;/td&gt;
+      &lt;td&gt;N/A&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;6&lt;/td&gt;
+      
&lt;td&gt;https://kyligence.io/blog/opportunities-for-ssas-in-the-cloud/&lt;/td&gt;
+      &lt;td&gt;Kyligence MDX 技术博客&lt;/td&gt;
+      &lt;td&gt;Kyligence&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;7&lt;/td&gt;
+      
&lt;td&gt;https://kyligence.io/blog/semantic-layer-the-bi-trend-you-dont-want-to-miss-in-2020/&lt;/td&gt;
+      &lt;td&gt;Kyligence MDX 技术博客&lt;/td&gt;
+      &lt;td&gt;Kyligence&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;8&lt;/td&gt;
+      
&lt;td&gt;https://docs.kyligence.io/books/mdx/v1.3/zh-cn/index.html&lt;/td&gt;
+      &lt;td&gt;Kyligence MDX 用户手册&lt;/td&gt;
+      &lt;td&gt;Kyligence&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;9&lt;/td&gt;
+      
&lt;td&gt;https://medium.com/airbnb-engineering/how-airbnb-achieved-metric-consistency-at-scale-f23cc53dea70&lt;/td&gt;
+      &lt;td&gt;Airbnb Tech Blog&lt;/td&gt;
+      &lt;td&gt;Airbnb Minerva&lt;/td&gt;
+    &lt;/tr&gt;
+  &lt;/tbody&gt;
+&lt;/table&gt;
+
+</description>
+        <pubDate>Thu, 31 Mar 2022 04:00:00 -0700</pubDate>
+        
<link>http://kylin.apache.org/cn_blog/2022/03/31/how-to-use-excel-to-query-kylin/</link>
+        <guid 
isPermaLink="true">http://kylin.apache.org/cn_blog/2022/03/31/how-to-use-excel-to-query-kylin/</guid>
+        
+        
+        <category>cn_blog</category>
+        
+      </item>
+    
+      <item>
+        <title>How to use Excel to query Kylin? MDX for Kylin!</title>
+        <description>&lt;h2 
id=&quot;abstract&quot;&gt;&lt;strong&gt;Abstract&lt;/strong&gt;&lt;/h2&gt;
+
+&lt;p&gt;During the &lt;a 
href=&quot;https://lists.apache.org/thread/4fkhyw1fyf0jg5cb18v7vxyqbn6vm3zv&quot;&gt;Kylin
 community discussion&lt;/a&gt; at the beginning of this year, we talked about 
the positioning of multidimensional databases and the idea of building a 
Kylin-based business semantic layer. After some development efforts, we are 
delighted to announce the beta release of the &lt;strong&gt;MDX&lt;/strong&gt; 
&lt;strong&gt;for Kylin&lt;/strong&gt; &lt;strong&gt;, an MDX query engine for 
Apache Kylin&lt;/strong&gt; to allow Kylin users to use 
&lt;strong&gt;Excel&lt;/strong&gt; for data analysis.&lt;/p&gt;
+
+&lt;h4 id=&quot;target-audiences&quot;&gt;&lt;strong&gt;Target 
audiences&lt;/strong&gt;&lt;/h4&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;
+    &lt;p&gt;Kylin users who are not familiar with 
&lt;strong&gt;MDX&lt;/strong&gt;&lt;/p&gt;
+  &lt;/li&gt;
+  &lt;li&gt;
+    &lt;p&gt;Data engineers who are interested in building a 
&lt;strong&gt;metrics platform&lt;/strong&gt; based on Kylin&lt;/p&gt;
+  &lt;/li&gt;
+  &lt;li&gt;
+    &lt;p&gt;Data analysts who are interested in massive data analysis with 
&lt;strong&gt;Excel&lt;/strong&gt;&lt;/p&gt;
+  &lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;h4 id=&quot;what-you-will-learn&quot;&gt;&lt;strong&gt;What you will 
learn&lt;/strong&gt;&lt;/h4&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;
+    &lt;p&gt;Basic concepts of MDX and MDX for Kylin&lt;/p&gt;
+  &lt;/li&gt;
+  &lt;li&gt;
+    &lt;p&gt;Quickstart tutorial for MDX for Kylin&lt;/p&gt;
+  &lt;/li&gt;
+  &lt;li&gt;
+    &lt;p&gt;Demonstration of how to use MDX for Kylin to define complex 
business metrics&lt;/p&gt;
+  &lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;h2 id=&quot;why-kylin-need-mdx&quot;&gt;&lt;strong&gt;Why Kylin need 
MDX?&lt;/strong&gt;&lt;/h2&gt;
+
+&lt;h3 
id=&quot;multidimensional-database-and-business-semantic-layer&quot;&gt;&lt;strong&gt;Multidimensional
 database and business semantic layer&lt;/strong&gt;&lt;/h3&gt;
+
+&lt;p&gt;The primary difference between multidimensional databases and 
relational databases lies in business semantics. As the must-have skill of data 
analysts, SQL (Structured Query Language) is extremely expressive, but if we 
are talking in the context of “every professional will be an analyst”, it 
is still too complex for non-technical users. For them, data lakes and data 
warehouses are like dark rooms that hold a huge amount of data; they cannot 
see, understand, or use the data for lack of the fundamental knowledge of 
databases and SQL syntax.&lt;/p&gt;
+
+&lt;p&gt;How to make data lakes and data warehouses 
&lt;strong&gt;“easy”&lt;/strong&gt; for a non-technical user to use? One 
solution is to introduce a more user-friendly &lt;strong&gt;“relational data 
model - multidimensional data model”&lt;/strong&gt;. If relational models are 
to provide a technique-oriented description of the data, multidimensional 
models intend to provide a business-oriented description of the data. In 
multidimensional databases, measures correspond to the business metrics that 
everyone is familiar with. Measures provide the analytic perspective to check 
and compare these business metrics. For example, it is like comparing the KPIs 
between this month and last month, or the performance of different business 
departments. By mapping the relational model to a multidimensional model, we 
add a business semantic layer on top of the technical data, thus helping 
non-technical users understand, explore, and use data.&lt;/p&gt;
+
+&lt;p&gt;In Kylin Roadmap, support to multidimensional query languages (such 
as MDX and DAX) is an important part, as we aim to enhance the business 
semantic capability of Kylin as a multi-dimensional database. Users can use MDX 
to convert the Kylin data model into business-friendly language, so they can 
perform multidimensional analysis with Excel, Tableau and other BI tools and 
understand the business values from their data.&lt;/p&gt;
+
+&lt;h3 
id=&quot;build-a-business-metrics-platform-with-mdx&quot;&gt;&lt;strong&gt;Build
 a business metrics platform with MDX&lt;/strong&gt;&lt;/h3&gt;
+
+&lt;p&gt;When building complex business metrics, MDX provides the following 
advantages if compared to SQL:&lt;/p&gt;
+
+&lt;ol&gt;
+  &lt;li&gt;&lt;strong&gt;Better support for complex analysis 
scenarios&lt;/strong&gt;, such as semi-accumulation, many-to-many, and time 
window analysis;&lt;/li&gt;
+  &lt;li&gt;&lt;strong&gt;More BI support&lt;/strong&gt;: “Kylin + MDX” 
can be exposed as relational database tables through the SQL interface, or 
XMLA-compliant data source with business semantics. It allows MDX queries and 
integration with Excel and other BI tools through the XMLA protocol;&lt;/li&gt;
+  &lt;li&gt;&lt;strong&gt;Flexible defining of MDX semantic model based on 
Kylin data model&lt;/strong&gt;, it will convert the underlying data structure 
into a business-friendly language and add business value to data. With MDX 
model, we offer users a unified business semantic layer, they no longer need to 
worry about the underlying technology or implementation complexity when 
analyzing data. For more information, see &lt;em&gt;&lt;a 
href=&quot;https://lists.apache.org/thread/4fkhyw1fyf0jg5cb18v7vxyqbn6vm3zv&quot;&gt;The
 future of Apache Kylin&lt;/a&gt;&lt;/em&gt;, &lt;em&gt;&lt;a 
href=&quot;https://kyligence.io/blog/opportunities-for-ssas-in-the-cloud/&quot;&gt;SSAS
 Disadvantages: Opportunities for SSAS in the Cloud Era&lt;/a&gt;&lt;/em&gt;, 
and &lt;em&gt;&lt;a 
href=&quot;https://kyligence.io/blog/semantic-layer-the-bi-trend-you-dont-want-to-miss-in-2020/&quot;&gt;Semantic
 Layer: The BI Trend You Don’t Want to Miss&lt;/a&gt;**.&lt;/em&gt;&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h3 id=&quot;mdx-overview&quot;&gt;&lt;strong&gt;MDX 
Overview&lt;/strong&gt;&lt;/h3&gt;
+
+&lt;h4 id=&quot;what-is-mdx&quot;&gt;&lt;strong&gt;What is 
MDX?&lt;/strong&gt;&lt;/h4&gt;
+
+&lt;p&gt;MDX (Multi Dimensional eXpression) is a query language for OLAP Cube. 
It was first introduced by Microsoft in 1997 as part of the OLEDB for OLAP 
specification and later integrated into SSAS. Since then, it has been widely 
adopted by OLAP databases.&lt;/p&gt;
+
+&lt;p&gt;MDX is similar to SQL in many ways and also offers some SQL features 
though maybe not as intuitive or effective as SQL. For example, you can include 
SELECT, FROM, or WHERE clause in your MDX queries. But it is not an extension 
of SQL. You can use these keywords to dig into specific parts of the 
Cube.&lt;/p&gt;
+
+&lt;p&gt;&lt;a 
href=&quot;https://docs.microsoft.com/en-us/sql/mdx/mdx-syntax-elements-mdx?view=sql-server-ver15&quot;&gt;MDX
 query syntax &lt;/a&gt;are as follows:&lt;/p&gt;
+
+&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre 
class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span 
class=&quot;k&quot;&gt;select&lt;/span&gt; &lt;span 
class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
class=&quot;n&quot;&gt;axis_specification&lt;/span&gt;&lt;span 
class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span 
class=&quot;p&quot;&gt;[,&lt;/span&gt; &lt;span 
class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
class=&quot;n&quot;&gt;axis_specification&lt;/span&gt;&lt;span 
class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span 
class=&quot;p&quot;&gt;]&lt;/span&gt;
+ &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span 
class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
class=&quot;n&quot;&gt;cube_specification&lt;/span&gt;&lt;span 
class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
+ &lt;span class=&quot;k&quot;&gt;where&lt;/span&gt; &lt;span 
class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
class=&quot;n&quot;&gt;slicer_specification&lt;/span&gt;&lt;span 
class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
+&lt;/code&gt;&lt;/pre&gt;
+&lt;/div&gt;
+
+&lt;h4 id=&quot;key-concepts-of-mdx&quot;&gt;&lt;strong&gt;Key concepts of 
MDX&lt;/strong&gt;&lt;/h4&gt;
+
+&lt;p&gt;Please learn some basic MDX concepts before we continue.&lt;/p&gt;
+
+&lt;ol&gt;
+  &lt;li&gt;Dimensions, Levels, Members, and Measures&lt;/li&gt;
+  &lt;li&gt;Cell, Tuple, and Set&lt;/li&gt;
+  &lt;li&gt;Query Axis and Slicer Axis&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;For detailed information about these concepts, see &lt;a 
href=&quot;https://docs.microsoft.com/en-us/sql/mdx/mdx-syntax-elements-mdx?view=sql-server-ver15&quot;&gt;MDX
 Syntax Elements (MDX)&lt;/a&gt;.&lt;/p&gt;
+
+&lt;h4 id=&quot;comparison-of-mdx-and-sql&quot;&gt;&lt;strong&gt;Comparison of 
MDX and SQL&lt;/strong&gt;&lt;/h4&gt;
+
+&lt;p&gt;The query objects are different. MDX is to query the cube, with data 
already joined and aggregated, so users needn’t specify the join relation 
when querying. SQL is to query a table with detailed records. Users need to 
specify the join relation among the tables when querying.&lt;/p&gt;
+
+&lt;p&gt;&lt;a 
href=&quot;https://dba.stackexchange.com/questions/138311/good-example-of-mdx-vs-sql-for-analytical-queries&quot;&gt;Another
 difference is the query result&lt;/a&gt;. SQL returns a 2d data subset, while 
MDX returns the cubes.&lt;/p&gt;
+
+&lt;h3 id=&quot;mdx-for-kylin-overview&quot;&gt;&lt;strong&gt;MDX for 
Kylin&lt;/strong&gt; &lt;strong&gt;Overview&lt;/strong&gt;&lt;/h3&gt;
+
+&lt;h4 id=&quot;what-is-mdx-for-kylin&quot;&gt;&lt;strong&gt;What 
is&lt;/strong&gt; &lt;strong&gt;MDX for Kylin&lt;/strong&gt;?&lt;/h4&gt;
+
+&lt;p&gt;&lt;strong&gt;MDX for Kylin&lt;/strong&gt; is an MDX query engine 
which developed based on &lt;strong&gt;Mondrian&lt;/strong&gt;, contributed by 
&lt;strong&gt;Kyligence,&lt;/strong&gt; and with &lt;strong&gt;Apache 
Kylin&lt;/strong&gt; as data source. Like Microsoft SSAS, MDX for Kylin can 
also integrate many data analysis tools, including Microsoft Excel and Tableau, 
to provide a better user experience for big data analysis.&lt;/p&gt;
+
+&lt;h4 
id=&quot;how-to-create-business-metrics&quot;&gt;&lt;strong&gt;How&lt;/strong&gt;
 &lt;strong&gt;to create business metrics&lt;/strong&gt;&lt;/h4&gt;
+
+&lt;h5 
id=&quot;atomic-metrics-and-business-metrics&quot;&gt;&lt;strong&gt;Atomic 
metrics and business metrics&lt;/strong&gt;&lt;/h5&gt;
+
+&lt;p&gt;In Kylin Cube, we will perform certain aggregate calculations (such 
as Sum/Max/Min/Count/Count Distinct, exclude TopN) on a single column when 
creating measures, and the measures created are called atomic metrics.&lt;/p&gt;
+
+&lt;p&gt;In actual business scenarios, we can run complex calculations based 
on these atomic metrics to create composite metrics with business implications, 
and these metrics are called business metrics.&lt;/p&gt;
+
+&lt;h5 
id=&quot;hierarchy-calculated-measure-and-namedset&quot;&gt;&lt;strong&gt;Hierarchy,
 Calculated Measure, and NamedSet&lt;/strong&gt;&lt;/h5&gt;
+
+&lt;p&gt;&lt;strong&gt;Hierarchy:&lt;/strong&gt; Hierarchies are collections 
of dimension-based hierarchies that can empower data analysts with advanced 
analytical capabilities. For example, you can create a time hierarchy with 
year, quarter, month, week, and day as its hierarchy. Then data analysts can do 
a YOY analysis on the sales volume, or dig into the “Quarter &amp;gt; Month 
&amp;gt; Week &amp;gt; Day” hierarchy for more detailed analysis.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Calculated Measure:&lt;/strong&gt; Calculated Measure 
are metrics/indexes acquired by running composite computing on the 
&lt;strong&gt;atomic metrics&lt;/strong&gt; with MDX expressions. We mainly use 
calculated measures to create &lt;strong&gt;business 
metrics&lt;/strong&gt;.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;NamedSet:&lt;/strong&gt; Namedset is for the scenario 
when you need to reuse a set of members in MDX for Kylin. A NamedSet uses 
specified expressions to get the set members. It can be placed directly on the 
axis or used in expressions of Calculated Measure for or other 
Namedset.&lt;/p&gt;
+
+&lt;h4 id=&quot;dataset-as-semantic-model&quot;&gt;&lt;strong&gt;Dataset 
as&lt;/strong&gt; &lt;strong&gt;semantic model&lt;/strong&gt;&lt;/h4&gt;
+
+&lt;p&gt;In Kylin 4, we create a data model based on the relationship among 
tables, and define different dimensions and measures on the Cube. These 
measures are &lt;strong&gt;atomic metrics&lt;/strong&gt;.&lt;/p&gt;
+
+&lt;p&gt;In MDX for Kylin, we join related Kylin Cubes to create datasets and 
create &lt;strong&gt;business metrics&lt;/strong&gt; based on atomic 
metrics.&lt;/p&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/1_use_excel_to_query_kylin.en.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;h4 id=&quot;process-of-calculating&quot;&gt;&lt;strong&gt;Process of 
calculating&lt;/strong&gt;&lt;/h4&gt;
+
+&lt;p&gt;The client(BI/Excel) sends an MDX query to MDX for Kylin, which will 
then be parsed into SQL and sent to Kylin. After that, Kylin will answer the 
SQL query based on the pre-computed Cuboid and return the result to MDX for 
Kylin. Then, MDX for Kylin will do some derived metrics calculation, and return 
the multidimensional data results to the client.&lt;/p&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/2_use_excel_to_query_kylin.en.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;h4 
id=&quot;summary&quot;&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/h4&gt;
+
+&lt;p&gt;&lt;strong&gt;MDX for&lt;/strong&gt; 
&lt;strong&gt;Kylin&lt;/strong&gt; supports MDX interface enhancing the 
semantic capability and creates a unified data analysis and management user 
experience. Now users can better leverage the value of data. The figure below 
shows the process of how raw data is processed into business metrics.&lt;/p&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/3_use_excel_to_query_kylin.en.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;h3 
id=&quot;technical-advantages-of-mdx-for-kylin&quot;&gt;&lt;strong&gt;Technical 
advantages of&lt;/strong&gt; &lt;strong&gt;MDX for 
Kylin&lt;/strong&gt;&lt;/h3&gt;
+
+&lt;p&gt;If compared with other open-source MDX query engines, MDX for Kylin 
has the following advantages:&lt;/p&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;
+    &lt;p&gt;Better support to BIs (Excel/Tableau/Power BI, etc.)and 
compliance with XMLA protocol&lt;/p&gt;
+  &lt;/li&gt;
+  &lt;li&gt;
+    &lt;p&gt;Optimize the MDX Query for BIs&lt;/p&gt;
+  &lt;/li&gt;
+  &lt;li&gt;
+    &lt;p&gt;Accelerate MDX queries with Kylin’s pre-computing 
capability&lt;/p&gt;
+  &lt;/li&gt;
+  &lt;li&gt;
+    &lt;p&gt;Easy-to-use interface for metrics definition and 
management&lt;/p&gt;
+  &lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;h2 id=&quot;quick-start-with-docker&quot;&gt;&lt;strong&gt;Quick start 
with Docker&lt;/strong&gt;&lt;/h2&gt;
+
+&lt;h4 id=&quot;test-environment&quot;&gt;&lt;strong&gt;Test 
environment&lt;/strong&gt;&lt;/h4&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;MacBook Pro: Docker Desktop (latest version)&lt;/li&gt;
+  &lt;li&gt;Windows 10 virtual machine: Microsoft Excel (for 
Windows)&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;h4 id=&quot;start-the-container&quot;&gt;&lt;strong&gt;Start the 
container&lt;/strong&gt;&lt;/h4&gt;
+
+&lt;pre&gt;&lt;code class=&quot;language-she&quot;&gt;docker run -d \
+    -m 8g \
+    -p 7070:7070 \
+    -p 7080:7080 \
+    -p 8088:8088 \
+    -p 50070:50070 \
+    -p 8032:8032 \
+    -p 8042:8042 \
+    -p 2181:2181 \
+    --name kylin-4.0.1 \
+    apachekylin/apache-kylin-standalone:kylin-4.0.1-mondrian
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&quot;environment-check&quot;&gt;Environment Check&lt;/h4&gt;
+
+&lt;p&gt;Wait for a few minutes, then check if you can visit the web UI of 
HDFS, YARN, Kylin, and MDX for Kylin.&lt;/p&gt;
+
+&lt;table&gt;
+  &lt;thead&gt;
+    &lt;tr&gt;
+      &lt;th&gt;&lt;strong&gt;Components&lt;/strong&gt;&lt;/th&gt;
+      &lt;th&gt;&lt;strong&gt;Web UI&lt;/strong&gt;&lt;/th&gt;
+    &lt;/tr&gt;
+  &lt;/thead&gt;
+  &lt;tbody&gt;
+    &lt;tr&gt;
+      &lt;td&gt;HDFS&lt;/td&gt;
+      &lt;td&gt;http://localhost:50070/dfshealth.html&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;YARN&lt;/td&gt;
+      &lt;td&gt;http://localhost:8088/cluster&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;Kylin&lt;/td&gt;
+      &lt;td&gt;http://localhost:7070/kylin&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;MDX for Kylin&lt;/td&gt;
+      &lt;td&gt;http://localhost:7080/overview&lt;/td&gt;
+    &lt;/tr&gt;
+  &lt;/tbody&gt;
+&lt;/table&gt;
+
+&lt;h4 id=&quot;build-a-sample-cube&quot;&gt;Build a sample Cube&lt;/h4&gt;
+
+&lt;p&gt;In this tutorial, we will use Kylin’s built-in sample Cube: 
&lt;code 
class=&quot;highlighter-rouge&quot;&gt;kylin_sales_cube&lt;/code&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/4_use_excel_to_query_kylin.en.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;h4 id=&quot;create-a-mdx-dataset&quot;&gt;Create a MDX dataset&lt;/h4&gt;
+
+&lt;h5 id=&quot;log-in-to-mdx-for-kylin&quot;&gt;&lt;strong&gt;Log in 
to&lt;/strong&gt; &lt;strong&gt;MDX for Kylin&lt;/strong&gt;&lt;/h5&gt;
+
+&lt;p&gt;Log in to MDX for Kylin through the web UI: http://localhost:7080. 
The default account/password is &lt;strong&gt;ADMIN/KYLIN&lt;/strong&gt;, the 
same as Kylin.&lt;/p&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/5_use_excel_to_query_kylin.en.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;h5 id=&quot;define-the-dataset-and-relations&quot;&gt;Define the dataset 
and relations&lt;/h5&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/6_use_excel_to_query_kylin.en.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/7_use_excel_to_query_kylin.en.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;h5 id=&quot;create-a-time-hierarchy&quot;&gt;&lt;strong&gt;Create a time 
hierarchy&lt;/strong&gt;&lt;/h5&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;Configure the dimension table &lt;code 
class=&quot;highlighter-rouge&quot;&gt;KYLIN_CAL_DT&lt;/code&gt;.&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/8_use_excel_to_query_kylin.en.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;Configure the column &lt;code 
class=&quot;highlighter-rouge&quot;&gt;YEAR_BEG_DT&lt;/code&gt;, and set 
&lt;strong&gt;Type&lt;/strong&gt; to 
&lt;strong&gt;Year&lt;/strong&gt;.&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/9_use_excel_to_query_kylin.en.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/10_use_excel_to_query_kylin.en.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;Configure &lt;code 
class=&quot;highlighter-rouge&quot;&gt;MONTH_BEG_DT&lt;/code&gt;and &lt;code 
class=&quot;highlighter-rouge&quot;&gt;WEEK_BEG_DT&lt;/code&gt;, set them to 
the correspondent hierarchy.&lt;/li&gt;
+  &lt;li&gt;Create a time hierarchy &lt;code 
class=&quot;highlighter-rouge&quot;&gt;Calendar&lt;/code&gt;. Please be noted 
the time hierarchy should be in a “year-month-week” order.&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/11_use_excel_to_query_kylin.en.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;h5 id=&quot;rename-the-atomic-metrics&quot;&gt;&lt;strong&gt;Rename the 
atomic metrics&lt;/strong&gt;&lt;/h5&gt;
+
+&lt;p&gt;Rename the atomic metric &lt;code 
class=&quot;highlighter-rouge&quot;&gt;GMV_SUM&lt;/code&gt; to some names with 
business implications. In this tutorial, we named it as &lt;strong&gt;Sales 
volume&lt;/strong&gt;, and renamed &lt;code 
class=&quot;highlighter-rouge&quot;&gt;SELLER_CNT_HLL&lt;/code&gt; as 
&lt;strong&gt;Retailer numbers&lt;/strong&gt;.&lt;/p&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/12_use_excel_to_query_kylin.en.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;h5 
id=&quot;create-business-metrics-calculated-measures&quot;&gt;&lt;strong&gt;Create
 business metrics (calculated measures)&lt;/strong&gt;&lt;/h5&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;Create the business metric 
&lt;strong&gt;Av&lt;/strong&gt;&lt;strong&gt;erage sales volume 
of&lt;/strong&gt; &lt;strong&gt;retailers&lt;/strong&gt;.&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/13_use_excel_to_query_kylin.en.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;Build “YoY growth rate of sales volume” and “MoM growth rate 
of sales volume” sequentially.&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;table&gt;
+  &lt;thead&gt;
+    &lt;tr&gt;
+      &lt;th&gt;Metrics&lt;/th&gt;
+      &lt;th&gt;&lt;strong&gt;MDX Expression&lt;/strong&gt;&lt;/th&gt;
+    &lt;/tr&gt;
+  &lt;/thead&gt;
+  &lt;tbody&gt;
+    &lt;tr&gt;
+      &lt;td&gt;Average sales volume of retailers&lt;/td&gt;
+      &lt;td&gt;[Measures].[Sales volume]/[Measures].[Retailer 
number]&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;YoY growth rate of sales volume&lt;/td&gt;
+      &lt;td&gt;[Measures].[Sales volume] / SUM(  ParallelPeriod(    
[KYLIN_CAL_DT].[Calendar-Hierarchy].[YEAR_BEG_DT],    1,    
[KYLIN_CAL_DT].[Calendar-Hierarchy].CurrentMember  ),  [Measures].[Sales 
volume] ) - 1&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;MoM growth rate of sales volume&lt;/td&gt;
+      &lt;td&gt;[Measures].[Sales volume] / SUM(  ParallelPeriod(    
[KYLIN_CAL_DT].[Calendar-Hierarchy].[MONTH_BEG_DT],    1,    
[KYLIN_CAL_DT].[Calendar-Hierarchy].CurrentMember  ),  [Measures].[Sales 
volume] ) - 1&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;Total sales volume&lt;/td&gt;
+      &lt;td&gt;Fixed([KYLIN_CAL_DT].[YEAR_BEG_DT], [Measures].[Sales 
volume])&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;Proportion in total annual sales volume&lt;/td&gt;
+      &lt;td&gt;[Measures].[Sales volume]/[Measures].[Total sales 
volume]&lt;/td&gt;
+    &lt;/tr&gt;
+  &lt;/tbody&gt;
+&lt;/table&gt;
+
+&lt;h4 
id=&quot;access-business-metrics-through-excel-pivot-tables&quot;&gt;&lt;strong&gt;Access
 business metrics through Excel pivot tables&lt;/strong&gt;&lt;/h4&gt;
+
+&lt;h5 
id=&quot;connect-mdx-for-kylin&quot;&gt;&lt;strong&gt;Connect&lt;/strong&gt; 
&lt;strong&gt;MDX for 
Kylin&lt;/strong&gt;&lt;strong&gt;!&lt;/strong&gt;&lt;/h5&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;Open Microsoft Excel (for Windows)&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/14_use_excel_to_query_kylin.en.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;Configure the MDX for Kylin server address. Please update the 
IP_Adress with your IP address, and use Kylin’s account and 
password(ADMIN/KYLIN in this case).&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/15_use_excel_to_query_kylin.en.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;h5 id=&quot;check-sales-volume-with-pivot-tables&quot;&gt;Check sales 
volume with pivot tables&lt;/h5&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;Configure pivot table&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/16_use_excel_to_query_kylin.en.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;Check YoY growth rate of sales volume&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/17_use_excel_to_query_kylin.en.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;Check MoM growth rate of sales volume&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/how_to_use_excel_to_query_kylin/18_use_excel_to_query_kylin.en.png&quot;
 alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;h4 id=&quot;call-api-to-query-mdx-for-kylin&quot;&gt;Call API to query MDX 
for Kylin&lt;/h4&gt;
+
+&lt;p&gt;If you do NOT have a windows version Excel, you can also use REST API 
to test the business metrics just created.  Note: please change the variables 
in the &lt;code 
class=&quot;highlighter-rouge&quot;&gt;&amp;lt;Statement&amp;gt;&lt;/code&gt; 
&lt;code 
class=&quot;highlighter-rouge&quot;&gt;&amp;lt;/Statement&amp;gt;&lt;/code&gt; 
section based on your setting and update the value of &lt;code 
class=&quot;highlighter-rouge&quot;&gt;Catalog&lt;/code&gt; if needed.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&quot;language-she&quot;&gt;curl --location 
--request POST &#39;http://localhost:7080/mdx/xmla/learn_kylin&#39; \
+--header &#39;Authorization: Basic QURNSU46S1lMSU4=&#39; \
+--header &#39;Connection:  Keep-Alive&#39; \
+--header &#39;SOAPAction: 
&quot;urn:schemas-microsoft-com:xml-analysis:Execute&quot;&#39; \
+--header &#39;User-Agent: MSOLAP&#39; \
+--header &#39;Content-Type: text/xml&#39; \
+--header &#39;Accept: */*&#39; \
+--header &#39;Cookie: JSESSIONID=22BF2B6D889F183D7F7E898D4D769398; 
MDXAUTH=ZUt6V1VBRE1JTjoyYTk3Zjg2NTdiNjk0NTE5NzA0NjFiN2ZjYTNkYzg2OToxNjQ2NjMxNDkw&#39;
 \
+--data-raw &#39;&amp;lt;soap:Envelope 
xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&amp;gt;
+    &amp;lt;soap:Header&amp;gt;
+        &amp;lt;Session 
xmlns=&quot;urn:schemas-microsoft-com:xml-analysis&quot; 
SessionId=&quot;8nblet191q&quot;/&amp;gt;
+    &amp;lt;/soap:Header&amp;gt;
+    &amp;lt;soap:Body&amp;gt;
+        &amp;lt;Execute 
xmlns=&quot;urn:schemas-microsoft-com:xml-analysis&quot;&amp;gt;
+           &amp;lt;Command&amp;gt;
+                &amp;lt;Statement&amp;gt;
+SELECT {[Measures].[Sales volume],
+        [Measures].[Retailer number],
+        [Measures].[Average sales volume of retailers],
+        [Measures].[Proportion in total annual sales volume],
+        [Measures].[YoY growth rate of sales volume],
+        [Measures].[MoM growth rate of sales volume]} 
+    DIMENSION PROPERTIES PARENT_UNIQUE_NAME ON COLUMNS , 
+NON EMPTY 
Hierarchize(AddCalculatedMembers({DrilldownLevel({[KYLIN_CAL_DT].[Calendar-Hierarchy].[All]})}))
 
+    DIMENSION PROPERTIES PARENT_UNIQUE_NAME ON ROWS  
+FROM [demo0] 
+CELL PROPERTIES VALUE, FORMAT_STRING, LANGUAGE, BACK_COLOR, FORE_COLOR, 
FONT_FLAGS
+                &amp;lt;/Statement&amp;gt;            
+            &amp;lt;/Command&amp;gt;
+            &amp;lt;Properties&amp;gt;
+                &amp;lt;PropertyList&amp;gt;
+                    &amp;lt;Catalog&amp;gt;demo0&amp;lt;/Catalog&amp;gt;
+                    &amp;lt;Timeout&amp;gt;0&amp;lt;/Timeout&amp;gt;
+                    &amp;lt;Content&amp;gt;SchemaData&amp;lt;/Content&amp;gt;
+                    
&amp;lt;Format&amp;gt;Multidimensional&amp;lt;/Format&amp;gt;
+                    
&amp;lt;AxisFormat&amp;gt;TupleFormat&amp;lt;/AxisFormat&amp;gt;
+                    
&amp;lt;DbpropMsmdFlattened2&amp;gt;false&amp;lt;/DbpropMsmdFlattened2&amp;gt;
+                    
&amp;lt;SafetyOptions&amp;gt;2&amp;lt;/SafetyOptions&amp;gt;
+                    &amp;lt;Dialect&amp;gt;MDX&amp;lt;/Dialect&amp;gt;
+                    
&amp;lt;MdxMissingMemberMode&amp;gt;Error&amp;lt;/MdxMissingMemberMode&amp;gt;
+                    
&amp;lt;DbpropMsmdOptimizeResponse&amp;gt;9&amp;lt;/DbpropMsmdOptimizeResponse&amp;gt;
+                    
&amp;lt;DbpropMsmdActivityID&amp;gt;6C94075F-65AD-4B9E-B3EB-4536A191A6AB&amp;lt;/DbpropMsmdActivityID&amp;gt;
+                    
&amp;lt;DbpropMsmdRequestID&amp;gt;9FA20B8A-ACA0-414E-98EA-14649F20CF75&amp;lt;/DbpropMsmdRequestID&amp;gt;
+                    
&amp;lt;LocaleIdentifier&amp;gt;1033&amp;lt;/LocaleIdentifier&amp;gt;
+                    
&amp;lt;DbpropMsmdMDXCompatibility&amp;gt;1&amp;lt;/DbpropMsmdMDXCompatibility&amp;gt;
+                &amp;lt;/PropertyList&amp;gt;
+            &amp;lt;/Properties&amp;gt;
+        &amp;lt;/Execute&amp;gt;
+    &amp;lt;/soap:Body&amp;gt;
+&amp;lt;/soap:Envelope&amp;gt;&#39;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&quot;contact-us&quot;&gt;Contact us&lt;/h2&gt;
+
+&lt;p&gt;If you want to check the official documentation, please check the 
manual : https://kyligence.github.io/mdx-kylin/en. For developers who want to 
contribute, please check our Github page : 
https://github.com/Kyligence/mdx-kylin .&lt;/p&gt;
+
+&lt;p&gt;Feel free to leave your suggestion, ask a question or report a bug by 
referring https://kyligence.github.io/mdx-kylin/en/contact/ .&lt;/p&gt;
+</description>
+        <pubDate>Thu, 31 Mar 2022 04:00:00 -0700</pubDate>
+        
<link>http://kylin.apache.org/blog/2022/03/31/how-to-use-excel-to-query-kylin/</link>
+        <guid 
isPermaLink="true">http://kylin.apache.org/blog/2022/03/31/how-to-use-excel-to-query-kylin/</guid>
+        
+        
+        <category>blog</category>
+        
+      </item>
+    
+      <item>
         <title>安排!Kylin 4 现已支持 AWS Glue Catalog</title>
         <description>&lt;h2 id=&quot;emr--kylin--glue-&quot;&gt;为什么在 
EMR 部署 Kylin 需要支持 Glue ?&lt;/h2&gt;
 
@@ -864,75 +1704,6 @@ Kylin 4.0 对构建和查
       </item>
     
       <item>
-        <title>Kylin4 
云上性能优化:本地缓存和软亲和性调度</title>
-        <description>&lt;h2 id=&quot;section&quot;&gt;01 
背景介绍&lt;/h2&gt;
-&lt;p&gt;日前,Apache Kylin 社区发布了全新架构的 Kylin 
4.0。Kylin 4.0 的架构支持存储和计算分离,这使得 kylin 
用户可以采取更加
灵活、计算资源可以弹性伸缩的云上部署方式来运行 Kylin 
4.0。借助云上的基础设施,用户可以选择使用便宜且可靠
的对象存储来储存 cube 数据,比如 S3 
等。不过在存储与计算分离的架构下,我们需要考虑到,计算节点通过网络从远端存储读取数据仍然是一个代价较大的操作,往å¾
 €ä¼šå¸¦æ¥æ€§èƒ½çš„æŸè€—。&lt;br /&gt;
-为了提高 Kylin 4.0 
在使用云上对象存储作为存储时的查询性能,我们尝试在 
Kylin 4.0 的查询引擎中引入本地缓存(Local 
Cache)机制,在执行查询时,将经常使用的数据缓存在本地磁盘,减小从远程对象存储中拉取数据带来的延迟,实现更快的查询响应;除此之外,为了避å
…åŒæ ·çš„æ•°æ®åœ¨å¤§é‡ spark executor 
上同时缓存浪费磁盘空间,并且计算节点可以更多的从本地缓存读取所需数据,我们引å
…¥äº† 软äº�
 �和性(Soft Affinity 
)的调度策略,所谓软亲和性策略,就是通过某种方法在 
spark executor 和数据文件之间建立对应关系,使得同æ 
·çš„æ•°æ®åœ¨å¤§éƒ¨åˆ†æƒ…况下能够总是在同一个 executor 
上面读取,从而提高缓存的命中率。&lt;/p&gt;
-
-&lt;h2 id=&quot;section-1&quot;&gt;02 实现原理&lt;/h2&gt;
-
-&lt;h4 id=&quot;section-2&quot;&gt;1.本地缓存&lt;/h4&gt;
-&lt;p&gt;在 Kylin 4.0 执行查询时,主要经过以下几个阶段,å…
¶ä¸­ç”¨è™šçº¿æ 
‡æ³¨å‡ºäº†å¯ä»¥ä½¿ç”¨æœ¬åœ°ç¼“存来提升性能的阶段:&lt;/p&gt;
-
-&lt;p&gt;&lt;img 
src=&quot;/images/blog/local-cache/Local_cache_stage.png&quot; alt=&quot;&quot; 
/&gt;&lt;/p&gt;
-
-&lt;ul&gt;
-  &lt;li&gt;File list cache:在 spark driver 端对 file status 
进行缓存。在执行查询时,spark driver 
需要读取文件列表,获取一些文件信息进行后续的调度执行,这里会将
 file status 信息缓存到本地避å…
é¢‘繁读取远程文件目录。&lt;/li&gt;
-  &lt;li&gt;Data cache:在 spark executor 
端对数据进行缓存。用户可以设置将数据缓存到内
存或是磁盘,若设置为缓存到内存,则需要适当调大 executor 
memory,保证 executor 有足够的内
存可以进行数据缓存;若是缓存到磁盘,需要用户设置数据缓存目录,最好设置为
 SSD 
磁盘目录。除此之外,缓存数据的最大容量、备份数量等均可由用户é
…ç½®è°ƒæ•´ã€‚&lt;/li&gt;
-&lt;/ul&gt;
-
-&lt;p&gt;基于以上设计,在 Kylin 4.0 的查询引擎 sparder 的 driver 
端和 executor 
端分别做不同类型的缓存,基本架构如下:&lt;/p&gt;
-
-&lt;p&gt;&lt;img 
src=&quot;/images/blog/local-cache/kylin4_local_cache.png&quot; 
alt=&quot;&quot; /&gt;&lt;/p&gt;
-
-&lt;h4 id=&quot;section-3&quot;&gt;2.软亲和性调度&lt;/h4&gt;
-&lt;p&gt;在 executor 端做 data cache 时,如果在所有的 executor 
上都缓存å…
¨éƒ¨çš„æ•°æ®ï¼Œé‚£ä¹ˆç¼“存数据的大小将会非常可观,极大的浪费磁盘空间,同时也容易导致缓存数据被频繁æ¸
…理。为了最大化 spark executor 的缓存命中率,spark driver 
需要将同一文件的 task 在资源条件满足的情
况下尽可能调度到同样的 executor,这æ 
·å¯ä»¥ä¿è¯ç›¸åŒæ–‡ä»¶çš„æ•°æ®èƒ½å¤Ÿç¼“存在特定的某个或者某几个 
executor 上,再次读取时便可以通过缓存读取数æ
 ®ã€‚&lt;br /&gt;
-为此,我们采取根据文件名计算 hash 之后再与 executors num 
取模的结果来计算目标 executor 列表,在多少个 executor 
上面做缓存由用户配置的缓存备份数量决定,一般情
况下,缓存备份数量越大,击中缓存的概率越高。当目标 
executor 均不可达或者没有资源供调度时,调度程序将回退到 
spark 
的随机调度机制上。这种调度方式便称为软亲和性调度策略,它虽然不能保证
 100% 击中缓存,但能够有效提高缓存命ä�
 �­çŽ‡ï¼Œåœ¨å°½é‡ä¸æŸå¤±æ€§èƒ½çš„å‰æä¸‹é¿å… full cache 
浪费大量磁盘空间。&lt;/p&gt;
-
-&lt;h2 id=&quot;section-4&quot;&gt;03 相关配置&lt;/h2&gt;
-&lt;p&gt;根据以上原理,我们在 Kylin 4.0 
中实现了本地缓存+软亲和性调度的基础功能,并分别基于 
ssb 数据集和 tpch 数据集做了查询性能测试。&lt;br /&gt;
-这里列出几个比较重要的配置项供用户了解,实际使用的é…
ç½®å°†åœ¨ç»“尾链接中给出:&lt;br /&gt;
-- 
是否开启软亲和性调度策略:kylin.query.spark-conf.spark.kylin.soft-affinity.enabled&lt;br
 /&gt;
-- 
是否开启本地缓存:kylin.query.spark-conf.spark.hadoop.spark.kylin.local-cache.enabled&lt;br
 /&gt;
-- Data cache 的备份数量,即在多少个 executor 
上对同一数据文件进行缓存:kylin.query.spark-conf.spark.kylin.soft-affinity.replications.num&lt;br
 /&gt;
-- 缓存到内存中还是本地目录,缓存到内存设置为 
BUFF,缓存到本地设置为 
LOCAL:kylin.query.spark-conf.spark.hadoop.alluxio.user.client.cache.store.type&lt;br
 /&gt;
-- 
最大缓存容量:kylin.query.spark-conf.spark.hadoop.alluxio.user.client.cache.size&lt;/p&gt;
-
-&lt;h2 id=&quot;section-5&quot;&gt;04 性能对比&lt;/h2&gt;
-&lt;p&gt;我们在 AWS EMR 环境下进行了 3 种场景的性能测试,在 
scale factor = 10的情况下,对 ssb 
数据集进行单并发查询测试、tpch 
数据集进行单并发查询以及 4 并发查询测试,实验组和对ç…
§ç»„均配置 s3 
作为存储,在实验组中开启本地缓存和软亲和性调度,对ç…
§ç»„则不开启。除此之外,我们还将实验组结果与相同环境下 
hdfs 
作为存储时的结果进行对比,以便用户可以直观的感受到 
本地缓存+软亲和性调度 对ä
 º‘上部署 Kylin 4.0 
使用对象存储作为存储场景下的优化效果。&lt;/p&gt;
-
-&lt;p&gt;&lt;img 
src=&quot;/images/blog/local-cache/local_cache_benchmark_result_ssb.png&quot; 
alt=&quot;&quot; /&gt;&lt;/p&gt;
-
-&lt;p&gt;&lt;img 
src=&quot;/images/blog/local-cache/local_cache_benchmark_result_tpch1.png&quot; 
alt=&quot;&quot; /&gt;&lt;/p&gt;
-
-&lt;p&gt;&lt;img 
src=&quot;/images/blog/local-cache/local_cache_benchmark_result_tpch4.png&quot; 
alt=&quot;&quot; /&gt;&lt;/p&gt;
-
-&lt;p&gt;从以上结果可以看出:&lt;br /&gt;
-1. 在 ssb 10 数据集单并发场景下,使用 s3 
作为存储时,开启本地缓存和软亲和性调度能够获得3倍左右的性能提升,可以达到与
 hdfs 作为存储时的相同性能甚至还有 5% 左右的提升。&lt;br 
/&gt;
-2. 在 tpch 10 数据集下,使用 s3 作为存储时,无
论是单并发查询还是多并发查询,开启本地缓存和软亲和性调度后,基本在所有查询中都能够获得大å¹
…度的性能提升。&lt;/p&gt;
-
-&lt;p&gt;不过在 tpch 10 数据集的 4 并发测试下的 Q21 
的对比结果中,我们观察到,开启本地缓存和软亲和性调度的结果反而比单独使用
 s3 作为存储时有所下降,这里可能是由于某种原因
导致没有通过缓存读取数据,深层原因
在此次测试中没有进行进一步的分析,在后续的优化过程中我们会逐步改进。由于
 tpch 的查询比较复杂且 SQL 类型各异,与 hdfs 
作为存储时的结果相比,仍然有部分 sql 的性能略æ�
 �‰ä¸è¶³ï¼Œä¸è¿‡æ€»ä½“来说已经与 hdfs 的结果比较接近。&lt;br 
/&gt;
-本次性能测试的结果是一次对 本地缓存+软亲和性调度 
性能提升效果的初步验证,从总体上来看,本地缓存+软亲和性调度
 无
论对于简单查询还是复杂查询都能够获得明显的性能提升,但是在高并发查询场景下存在一定的性能损失。&lt;br
 /&gt;
-如果用户使用云上对象存储作为 Kylin 4.0 的存储,在开启 
本地缓存+ 软亲和性调度的情
况下,是可以获得很好的性能体验的,这为 Kylin 4.0 
在云上使用计算和存储分离架构提供了性能保障。&lt;/p&gt;
-
-&lt;h2 id=&quot;section-6&quot;&gt;05 代码实现&lt;/h2&gt;
-&lt;p&gt;由于目前的代ç 
å®žçŽ°è¿˜å¤„äºŽæ¯”è¾ƒåŸºç¡€çš„é˜¶æ®µï¼Œè¿˜æœ‰è®¸å¤šç»†èŠ‚éœ€è¦å®Œå–„ï¼Œæ¯”å¦‚å®žçŽ°ä¸€è‡´æ€§å“ˆå¸Œã€å½“
 executor 数量发生变化时如何处理已有 cache 等,所以作者
还未向社区代码库提交 PR,想要提前预览的开发者
可以通过下面的链接查看源码:&lt;br /&gt;
-&lt;a 
href=&quot;https://github.com/zzcclp/kylin/commit/4e75b7fa4059dd2eaed24061fda7797fecaf2e35&quot;&gt;Kylin4.0
 本地缓存+软亲和性调度代码实现&lt;/a&gt;&lt;/p&gt;
-
-&lt;h2 id=&quot;section-7&quot;&gt;06 相关链接&lt;/h2&gt;
-&lt;p&gt;通过链接可查阅性能测试结果数据和具体配置:&lt;br 
/&gt;
-&lt;a 
href=&quot;https://github.com/Kyligence/kylin-tpch/issues/9&quot;&gt;Kylin4.0 
本地缓存+软亲和性调度测试&lt;/a&gt;&lt;/p&gt;
-</description>
-        <pubDate>Thu, 21 Oct 2021 04:00:00 -0700</pubDate>
-        
<link>http://kylin.apache.org/cn_blog/2021/10/21/Local-Cache-and-Soft-Affinity-Scheduling/</link>
-        <guid 
isPermaLink="true">http://kylin.apache.org/cn_blog/2021/10/21/Local-Cache-and-Soft-Affinity-Scheduling/</guid>
-        
-        
-        <category>cn_blog</category>
-        
-      </item>
-    
-      <item>
         <title>Performance optimization of Kylin 4.0 in cloud -- local cache 
and soft affinity scheduling</title>
         <description>&lt;h2 id=&quot;background-introduction&quot;&gt;01 
Background Introduction&lt;/h2&gt;
 &lt;p&gt;Recently, the Apache Kylin community released Kylin 4.0.0 with a new 
architecture. The architecture of Kylin 4.0 supports the separation of storage 
and computing, which enables kylin users to run Kylin 4.0 in a more flexible 
cloud deployment mode with flexible computing resources. With the cloud 
infrastructure, users can choose to use cheap and reliable object storage to 
store cube data, such as S3. However, in the architecture of separation of 
storage and computing, we need to consider that reading data from remote 
storage by computing nodes through the network is still a costly operation, 
which often leads to performance loss.&lt;br /&gt;
@@ -1015,6 +1786,75 @@ If users use cloud object storage as Kyl
       </item>
     
       <item>
+        <title>Kylin4 
云上性能优化:本地缓存和软亲和性调度</title>
+        <description>&lt;h2 id=&quot;section&quot;&gt;01 
背景介绍&lt;/h2&gt;
+&lt;p&gt;日前,Apache Kylin 社区发布了全新架构的 Kylin 
4.0。Kylin 4.0 的架构支持存储和计算分离,这使得 kylin 
用户可以采取更加
灵活、计算资源可以弹性伸缩的云上部署方式来运行 Kylin 
4.0。借助云上的基础设施,用户可以选择使用便宜且可靠
的对象存储来储存 cube 数据,比如 S3 
等。不过在存储与计算分离的架构下,我们需要考虑到,计算节点通过网络从远端存储读取数据仍然是一个代价较大的操作,往å¾
 €ä¼šå¸¦æ¥æ€§èƒ½çš„æŸè€—。&lt;br /&gt;
+为了提高 Kylin 4.0 
在使用云上对象存储作为存储时的查询性能,我们尝试在 
Kylin 4.0 的查询引擎中引入本地缓存(Local 
Cache)机制,在执行查询时,将经常使用的数据缓存在本地磁盘,减小从远程对象存储中拉取数据带来的延迟,实现更快的查询响应;除此之外,为了避å
…åŒæ ·çš„æ•°æ®åœ¨å¤§é‡ spark executor 
上同时缓存浪费磁盘空间,并且计算节点可以更多的从本地缓存读取所需数据,我们引å
…¥äº† 软äº�
 �和性(Soft Affinity 
)的调度策略,所谓软亲和性策略,就是通过某种方法在 
spark executor 和数据文件之间建立对应关系,使得同æ 
·çš„æ•°æ®åœ¨å¤§éƒ¨åˆ†æƒ…况下能够总是在同一个 executor 
上面读取,从而提高缓存的命中率。&lt;/p&gt;
+
+&lt;h2 id=&quot;section-1&quot;&gt;02 实现原理&lt;/h2&gt;
+
+&lt;h4 id=&quot;section-2&quot;&gt;1.本地缓存&lt;/h4&gt;
+&lt;p&gt;在 Kylin 4.0 执行查询时,主要经过以下几个阶段,å…
¶ä¸­ç”¨è™šçº¿æ 
‡æ³¨å‡ºäº†å¯ä»¥ä½¿ç”¨æœ¬åœ°ç¼“存来提升性能的阶段:&lt;/p&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/local-cache/Local_cache_stage.png&quot; alt=&quot;&quot; 
/&gt;&lt;/p&gt;
+
+&lt;ul&gt;
+  &lt;li&gt;File list cache:在 spark driver 端对 file status 
进行缓存。在执行查询时,spark driver 
需要读取文件列表,获取一些文件信息进行后续的调度执行,这里会将
 file status 信息缓存到本地避å…
é¢‘繁读取远程文件目录。&lt;/li&gt;
+  &lt;li&gt;Data cache:在 spark executor 
端对数据进行缓存。用户可以设置将数据缓存到内
存或是磁盘,若设置为缓存到内存,则需要适当调大 executor 
memory,保证 executor 有足够的内
存可以进行数据缓存;若是缓存到磁盘,需要用户设置数据缓存目录,最好设置为
 SSD 
磁盘目录。除此之外,缓存数据的最大容量、备份数量等均可由用户é
…ç½®è°ƒæ•´ã€‚&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;基于以上设计,在 Kylin 4.0 的查询引擎 sparder 的 driver 
端和 executor 
端分别做不同类型的缓存,基本架构如下:&lt;/p&gt;
+
+&lt;p&gt;&lt;img 
src=&quot;/images/blog/local-cache/kylin4_local_cache.png&quot; 
alt=&quot;&quot; /&gt;&lt;/p&gt;
+
+&lt;h4 id=&quot;section-3&quot;&gt;2.软亲和性调度&lt;/h4&gt;
+&lt;p&gt;在 executor 端做 data cache 时,如果在所有的 executor 
上都缓存å…
¨éƒ¨çš„æ•°æ®ï¼Œé‚£ä¹ˆç¼“存数据的大小将会非常可观,极大的浪费磁盘空间,同时也容易导致缓存数据被频繁æ¸
…理。为了最大化 spark executor 的缓存命中率,spark driver 
需要将同一文件的 task 在资源条件满足的情
况下尽可能调度到同样的 executor,这æ 
·å¯ä»¥ä¿è¯ç›¸åŒæ–‡ä»¶çš„æ•°æ®èƒ½å¤Ÿç¼“存在特定的某个或者某几个 
executor 上,再次读取时便可以通过缓存读取数æ
 ®ã€‚&lt;br /&gt;
+为此,我们采取根据文件名计算 hash 之后再与 executors num 
取模的结果来计算目标 executor 列表,在多少个 executor 
上面做缓存由用户配置的缓存备份数量决定,一般情
况下,缓存备份数量越大,击中缓存的概率越高。当目标 
executor 均不可达或者没有资源供调度时,调度程序将回退到 
spark 
的随机调度机制上。这种调度方式便称为软亲和性调度策略,它虽然不能保证
 100% 击中缓存,但能够有效提高缓存命ä�
 �­çŽ‡ï¼Œåœ¨å°½é‡ä¸æŸå¤±æ€§èƒ½çš„å‰æä¸‹é¿å… full cache 
浪费大量磁盘空间。&lt;/p&gt;
+
+&lt;h2 id=&quot;section-4&quot;&gt;03 相关配置&lt;/h2&gt;
+&lt;p&gt;根据以上原理,我们在 Kylin 4.0 
中实现了本地缓存+软亲和性调度的基础功能,并分别基于 
ssb 数据集和 tpch 数据集做了查询性能测试。&lt;br /&gt;
+这里列出几个比较重要的配置项供用户了解,实际使用的é…
ç½®å°†åœ¨ç»“尾链接中给出:&lt;br /&gt;
+- 
是否开启软亲和性调度策略:kylin.query.spark-conf.spark.kylin.soft-affinity.enabled&lt;br
 /&gt;
+- 
是否开启本地缓存:kylin.query.spark-conf.spark.hadoop.spark.kylin.local-cache.enabled&lt;br
 /&gt;
+- Data cache 的备份数量,即在多少个 executor 
上对同一数据文件进行缓存:kylin.query.spark-conf.spark.kylin.soft-affinity.replications.num&lt;br
 /&gt;
+- 缓存到内存中还是本地目录,缓存到内存设置为 
BUFF,缓存到本地设置为 
LOCAL:kylin.query.spark-conf.spark.hadoop.alluxio.user.client.cache.store.type&lt;br
 /&gt;
+- 
最大缓存容量:kylin.query.spark-conf.spark.hadoop.alluxio.user.client.cache.size&lt;/p&gt;
+

[... 238 lines stripped ...]

Reply via email to