Pivot4j/Olap4j 向生成的查询的 where 子句添加条件

Pivot4j/Olap4j adding condition to where clause of generated query

我有一个 ROLAP 多维数据集 - Pivot4j 0.9,Olap4j 1.1.0,MySQL。

当我 运行 以下 MDX 时,我可以在 where 子句中看到一个附加条件,该条件导致结果语句 return 没有行。

SELECT Hierarchize({[Measures].[Unique Users]}) ON COLUMNS,  NON EMPTY Hierarchize([dimBrowserType].AllMembers) ON ROWS  FROM [Sessions]

结果 SQL...

17:28:08,536 DEBUG RolapUtil:319 - Segment.load: done executing sql [
select `meta_date`.`date_day` as `c0`, count(distinct `sessions_551d03b3e4b0dc830608a95b`.`userId`) as `m0` 
from `meta_date` as `meta_date`, `sessions_551d03b3e4b0dc830608a95b` as `sessions_551d03b3e4b0dc830608a95b` 
where `sessions_551d03b3e4b0dc830608a95b`.`daykey` = `meta_date`.`daykey` 
and `meta_date`.`date_day` = '2015-01-01' 
group by `meta_date`.`date_day`
], exec+fetch 44 ms, 0 rows, ex=7, close=7, open=[]

Olap4j 添加了这个子句...

and `meta_date`.`date_day` = '2015-01-01'

...这与初始 MDX 中的任何内容都不相关。 date_day 的这个特定值没有数据,因此查询 return 没有数据。

可能是什么原因造成的?

您可能在日期层次结构中没有 'all member'。 MDX 规范说在这种情况下,使用第一个成员。

尝试将 hasAll=true 添加到您的层次结构中。