我一直在努力让聚合表工作。这是我的事实表的样子:
employment_date_id
dimension1_id
dimension2_id
dimension3_id
dimension4
dimension5
measure1
measure2
measure3
我将折叠employment_date_id
年份、季度和月份以仅包括年份,但包括所有其他列。这是我的聚合表的样子:
yearquartermonth_year
dimension1_id
dimension2_id
dimension3_id
dimension4
dimension5
measure1
measure2
measure3
fact_count
我只是折叠日期的年份部分。其余字段保持原样。这是我的配置:
<AggFactCount column="FACT_COUNT"/>
<AggForeignKey factColumn="dimension1_id" aggColumn="dimension1_id"/>
<AggForeignKey factColumn="dimension2_id" aggColumn="dimension2_id"/>
<AggForeignKey factColumn="dimension3_id" aggColumn="dimension3_id"/>
<AggMeasure name="[Measures].[measure1]" column="measure1"/>
<AggMeasure name="[Measures].[measure2]" column="measure2"/>
<AggMeasure name="[Measures].[measure3]" column="measure3"/>
<AggLevel name="[dimension4].[dimension4]" column="dimension4"/>
<AggLevel name="[dimension5].[dimension5]" column="dimension5"/>
<AggLevel name="[EmploymentDate.yearQuarterMonth].[Year]" column="yearquartermonth_year"/>
我大部分是从文档中复制聚合表的第二个示例。我的大多数列都没有折叠到表中,并且是维度表的外键。
我试图执行的查询类似于:
select {[Measures].[measure1]} on COLUMNS, {[EmploymentDate.yearQuarterMonth].[Year]} on ROWS from Cube1
问题是,当我调试它并打开日志记录时,我会看到如下所示的位键:
AggStar:agg_year_employment
bk=0x00000000000000000000000000000000000000000000000111111111101111100000000000000000000000000000000000000000000000000000000000000000
fbk=0x00000000000000000000000000000000000000000000000000000001101111100000000000000000000000000000000000000000000000000000000000000000
mbk=0x00000000000000000000000000000000000000000000000111111110000000000000000000000000000000000000000000000000000000000000000000000000
我的查询的位模式是:
Foreign columns bit key=0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
Measure bit key= 0x00000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000
所以我的聚合表被跳过了。但是,这些是折叠到表中的确切列。但是查询和聚合表之间的位位置是关闭的。我觉得奇怪的另一件事是,一部分列被折叠到表中,但所有列AggForeignKeys
都没有包含在位中,所以如果我用这些列进行查询,这个聚合表会被跳过吗?这与我的计划相反。我的计划是,只要您对年份边界进行查询,就使用此聚合表。
我不明白为什么这不起作用以及为什么无法正确构建位密钥。我试过调试蒙德里安代码,但弄清楚哪一列映射到位键中的哪个位置并不明显。我觉得这不应该这么难,但那里的一切并不能很好地解释这一点。而且这种聚合表架构真的要打破了。
我究竟做错了什么?为什么我的解决方案不起作用?
更新这是我的 mondrian.properties 文件:
mondrian.jdbcDrivers=com.mysql.jdbc.Driver,oracle.jdbc.driver.OracleDriver
mondrian.rolap.generate.formatted.sql=true
mondrian.rolap.localePropFile=locale.properties
mondrian.rolap.aggregates.Use=true
mondrian.rolap.aggregates.Read=true
mondrian.trace.level=2
mondrian.drillthrough.enable=true