[Mondrian] What happenes during a query using mondrian?

魏龙星 wlxwolves at gmail.com
Fri Feb 26 03:03:31 EST 2016


---------- Forwarded message ---------
From: 魏龙星 <wlxwolves at gmail.com>
Date: 2016年2月26日周五 下午4:01
Subject: What happenes during a query using mondrian?
To: <mondrian at pentaho.org>


I know mondrian converts MDX queries into relational queries and return the
result. But is there any details about this process?

I use the sample cube HR. Here is the MDX:

> WITH
> SET [~ROWS] AS
>     TopCount({[Time].[Time].[Month].Members}, 3, [Measures].[Org Salary])
> SELECT
> NON EMPTY {[Measures].[Org Salary]} ON COLUMNS,
> NON EMPTY [~ROWS] ON ROWS
> FROM [HR]


And  this is the SQL generated by the MDX. I find it in log:

> select
>     "time_by_day"."the_year" as "c0",
>     "time_by_day"."quarter" as "c1",
>     "time_by_day"."the_month" as "c2",
>     "time_by_day"."month_of_year" as "c3",
>     sum("salary"."salary_paid") as "c4"
> from
>     "salary" as "salary",
>     "time_by_day" as "time_by_day"
> where
>     "time_by_day"."the_year" = 1997
> and
>     "salary"."pay_date" = "time_by_day"."the_date"
> group by
>     "time_by_day"."the_year",
>     "time_by_day"."quarter",
>     "time_by_day"."the_month",
>     "time_by_day"."month_of_year"
> order by
>     CASE WHEN sum("salary"."salary_paid") IS NULL THEN 1 ELSE 0 END,
> sum("salary"."salary_paid") DESC,
>     CASE WHEN "time_by_day"."the_year" IS NULL THEN 1 ELSE 0 END,
> "time_by_day"."the_year" ASC,
>     CASE WHEN "time_by_day"."quarter" IS NULL THEN 1 ELSE 0 END,
> "time_by_day"."quarter" ASC,
>     CASE WHEN "time_by_day"."the_month" IS NULL THEN 1 ELSE 0 END,
> "time_by_day"."the_month" ASC,
>     CASE WHEN "time_by_day"."month_of_year" IS NULL THEN 1 ELSE 0 END,
> "time_by_day"."month_of_year" ASC



I change top 3 to top 10 and I got the same SQL. And the SQL has nothing
like "limit". But it just returned 3 or 10 items. It works, but how?

*So I am wondering what happened during a query*? I searched and didn't get
any useful information. Can anybody help?

Thank you.

Longxing
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20160226/2455dd0b/attachment.html 


More information about the Mondrian mailing list