选中
Configuration
,进入页面configuration.html.
再选中
MDX and SQL Statement Logging
,
进去,里面介绍了详细步骤!以及
log4j.properties
文件的内容。)
现在运行项目,在你的控制台就会输出相应的
sql
语句了。
下面就是
Mondrian
解析的过程:
解析过程
:
从控制台输出的信息可以分析出:
mondrian
到底执行了那些
sql
语句
.
比如,我想做一个商品向下钻取的例子:
在当前页面点击“
All Products
”
则控制台输出为:
1.>
22157 [http-8080-1] DEBUG mondrian.sql
- 1: SqlMemberSource.getMemberChildren: executing sql [
select
`producttype`.`proTypeId` as `c0`,
`producttype`.`proTypeName` as `c1`
from
`product` as `product`,
`producttype` as `producttype`
where
`product`.`proTypeId` = `producttype`.`proTypeId`
group by
`producttype`.`proTypeId`,
`producttype`.`proTypeName`
order by
ISNULL(`producttype`.`proTypeId`), `producttype`.`proTypeId` ASC
]
22203 [http-8080-1] DEBUG mondrian.sql
- 1: , exec 46 ms
22219 [http-8080-1] DEBUG mondrian.sql
- , exec+fetch 62 ms, 4 rows
*********************************************************************
2.>
22219 [http-8080-1] DEBUG mondrian.sql
- 2: RolapStar.Column.getCardinality: executing sql [
select
count(distinct `producttype`.`proTypeId`) as `c0`
from
`producttype` as `producttype`
]
22235 [http-8080-1] DEBUG mondrian.sql
- 2: , exec 16 ms
22235 [http-8080-1] DEBUG mondrian.sql
- , exec+fetch 16 ms, 1 rows
*********************************************************************
3.>
22235 [http-8080-1] DEBUG mondrian.sql
- 3: Segment.load: executing sql [
select
`producttype`.`proTypeId` as `c0`,
sum(`sale`.`number`) as `m0`,
sum((unitPrice*number)) as `m1`
from
`producttype` as `producttype`,
`product` as `product`,
`sale` as `sale`
where
`sale`.`proId` = `product`.`proId` and
`product`.`proTypeId` = `producttype`.`proTypeId`
group by
`producttype`.`proTypeId`
]
22250 [http-8080-1] DEBUG mondrian.sql
- 3: , exec 15 ms
22250 [http-8080-1] DEBUG mondrian.sql
- , exec+fetch 15 ms, 4 rows
如果在上个页面的基础上再点击“
All Products
”下的子集“
Electrical Equipments
”,
如下图片所示:
则控制台打印出的结果是:
4.>
2840907 [http-8080-2] DEBUG mondrian.sql
- 4: SqlMemberSource.getMemberChildren: executing sql [
select
`product`.`proId` as `c0`,
`product`.`proName` as `c1`
from
`product` as `product`,
`producttype` as `producttype`
where
`product`.`proTypeId` = `producttype`.`proTypeId` and
(`producttype`.`proTypeId` = '1')
group by
`product`.`proId`,
`product`.`proName`
order by
ISNULL(`product`.`proId`), `product`.`proId` ASC
]
2840907 [http-8080-2] DEBUG mondrian.sql
- 4: , exec 0 ms
2840907 [http-8080-2] DEBUG mondrian.sql
- , exec+fetch 0 ms, 3 rows
*********************************************************************
5.>
2840907 [http-8080-2] DEBUG mondrian.sql
- 5: RolapStar.Column.getCardinality: executing sql [
select
count(distinct `product`.`proId`) as `c0`
from
`product` as `product`
]
2840907 [http-8080-2] DEBUG mondrian.sql
- 5: , exec 0 ms
2840907 [http-8080-2] DEBUG mondrian.sql
- , exec+fetch 0 ms, 1 rows
*********************************************************************
6.>
2840907 [http-8080-2] DEBUG mondrian.sql
- 6: Segment.load: executing sql [
select
`product`.`proId` as `c0`,
sum(`sale`.`number`) as `m0`,
sum((unitPrice*number)) as `m1`
from
`product` as `product`,
`sale` as `sale`
where
`sale`.`proId` = `product`.`proId` and
`product`.`proId` in ('1', '2', '9')
group by
`product`.`proId`
]
2840922 [http-8080-2] DEBUG mondrian.sql
- 6: , exec 15 ms
2840922 [http-8080-2] DEBUG mondrian.sql
- , exec+fetch 15 ms, 3 rows
由上面的步骤
1>,2>,3>;
以及后面
的
4>,5>,6>
我们就可以得出:
mondrian
做
drill down
(向下钻取)的时候一般执行
3
个
sql .
而每个
sql
的语法格式大概如下
:
*****: executing sql [
执行的
sql ]
,
***** : exec
时间
,
*****: exec + fetch
时间
,
取得的数据行数
.
其中前面的
*****
部分是看你执行的那些操作,
第一个
sql
:
取得
dimension
子元素的名称
:
一般通过如下
sql
取得(即我上面所说的第
1>
,第
4>
步)
:
SqlMemberSource.getMemberChildren: executing sql [
select
`producttype`.`proTypeId` as `c0`,
`producttype`.`proTypeName` as `c1`
from
`product` as `product`,
`producttype` as `producttype`
where
`product`.`proTypeId` = `producttype`.`proTypeId`
group by
`producttype`.`proTypeId`,
`producttype`.`proTypeName`
order by
ISNULL(`producttype`.`proTypeId`), `producttype`.`proTypeId` ASC
]
第二个
sql
:
取得左边的
dimension
的一个层次结构下的子元素的数目
.
比如
All Products
下就有四个
.
其
sql
语句就如我上面所列出的第
2>,
第
5>
步格式,在此就不再再拷贝下来了。
第三个
sql
:
取得对应
dimension
的实际数据
,
其
sql
语句就像我上面所列出的第
3>,
第
6>
步格式,在此也不再拷贝下来了。
假如你想
mdx
和
sql
一起对比着看,可以在
log4j.properties
里面写入:
log4j.category.mondrian.mdx=
MONDRIAN
log4j.category.mondrian.sql=
DEBUG
这样控制台输出的结果就如下面的这种格式:
6297 [http-8080-1] DEBUG mondrian.mdx
- 0: select {[Measures].[Number], [Measures].[Total Sale]} ON COLUMNS,
{[Product Category].[All Products]} ON ROWS
from [Sales]
6562 [http-8080-1] DEBUG mondrian.sql
- 0: Segment.load: executing sql [
select
sum(`sale`.`number`) as `m0`,
sum((unitPrice*number)) as `m1`
from
`sale` as `sale`
]
6578 [http-8080-1] DEBUG mondrian.sql
- 0: , exec 16 ms
相关推荐
mondrian ROLAP MDX 经典资料打包。 MDX的基本语法及概念.ppt ROLAP的概念.ppt 如何将Mondrian用于web项目.ppt MDX的基本语法及概念.ppt doc_cn jpivot
mondrian foodmart SQL SERVER 数据库
mondrian源码分析与说明.pdf
FlexOlapView构件是一个用于多维分析的FLASH控件,可通过XMLA标准协议连接至OLAP服务器,如:微软的SQL Server分析服务器(MS SSAS 2005,008)和Pentaho分析服务(Mondrian)等,它可以用数据透视表和多种图表展示...
本教程包含mondrian部分中文文档 mondrian如何创建Cube,维度,度量及其他属性 mdx语法介绍
包含开发所需的mondrian-3.0.4.11371,编写xml的schema-workbench工具,sql文件,以及开发文档。
Mondrian_Schema(多维分析)属性详解
本文档介绍 OLAP、MDX 基本概念和原理、Mondrian 的使用和一些前端工具的使用。其中 “基本概念”和“MDX”这两章基本都是通用的内容,并不仅限于 Mondrian。 本文档主要用做简略的指南,更深入、更详细的内容请参考...
mondrian源码分析与说明.doc
mondrian源码分析和改造设计.doc,详细介绍mondrian源码框架,各个文件夹的作用等等!!
mdx详解。 mondrian.. mdx
它实现了xmla和jolap规范,而且自定义了一种使用mdx语言的客户端接口。Mondrian是olap服务器,而不是数据仓库服务器,因此Mondrian的元数据主要包括olap建模的元数据,不包括从外部数据源到数据库转换的元数据。也...
Mondrian_Schema(多维分析)属性详解[定义].pdf
Mondrian - 使用图论的php代码静态分析工具
[Manning Publications] Mondrian 实战 英文版 [Manning Publications] Mondrian in Action E Book ☆ 出版信息:☆ [作者信息] William Back D Nicholas Goodman Julian Hyde [出版机构] Manning ...
如何创建交互式的OLAP分析,与mysql和mondrian打通 Pentaho Introduction Mondrian features and architecture Schemas and queries olap4j Roadmap Case Studies Business Intelligence suite Q & A
mondrian做分析用到的初始化数据foodmarket.sql。 做模拟数据初始化必备
这个Java实例将利用Mondrian提供的OLAP引擎对已建立好的数据立方体XML进行MDX查询。不是网上到处都有的jPivot,而是一个更基础更轻量的例子。