我有一个以这种方式制作的样本星型模式:
author (id, name)
book (id, name)
sample_fact_table (id, authorfk, bookfk, quantity)
其中obiouvsly authorfk是author.id的FK,bookfk是FK to book.id。
维度为:"作者","书"。措施是"数量"。
我使用Pentaho Schema Workbench工具为多维数据集进行了此配置:
<Schema name="MySchema">
<Dimension type="StandardDimension" visible="true" name="Author">
<Hierarchy visible="true" hasAll="true" allMemberName="All Authors" primaryKey="id">
<Table name="author">
</Table>
<Level name="Name" visible="true" table="author" column="id" nameColumn="name" uniqueMembers="false">
</Level>
</Hierarchy>
</Dimension>
<Dimension type="StandardDimension" visible="true" name="Book">
<Hierarchy visible="true" hasAll="true" allMemberName="All Books" primaryKey="id">
<Table name="book">
</Table>
<Level name="Name" visible="true" table="book" column="id" nameColumn="name" uniqueMembers="false">
</Level>
</Hierarchy>
</Dimension>
<Cube name="TestCube" visible="true" cache="true" enabled="true">
<Table name="sample_fact_table">
</Table>
<DimensionUsage source="Author" name="Author" visible="true" foreignKey="authorfk">
</DimensionUsage>
<DimensionUsage source="Book" name="Book" visible="true" foreignKey="bookfk">
</DimensionUsage>
<Measure name="quantity" column="quantity" aggregator="sum" visible="true">
</Measure>
</Cube>
</Schema>
如果我尝试执行MDX查询:
select
Measures.quantity ON COLUMNS,
NON EMPTY Author.Children ON ROWS
from [TestCube]
我的结果很好:
Axis #0:
{}
Axis #1:
{[Measures].[quantity]}
Axis #2:
{[author].[Al]}
{[author].[John]}
{[author].[Jack]}
Row #0: 3
Row #1: 9
Row #2: 1
但如果不是作者而是我在Book上查询,就像这样:
select
Measures.quantity ON COLUMNS,
NON EMPTY Book.Children ON ROWS
from [TestCube]
我收到此错误:
Mondrian Error:Failed to parse query 'select
Measures.quantity ON COLUMNS,
NON EMPTY Book.Children ON ROWS
from [TestCube]'
Mondrian Error:MDX object 'Book' not found in cube 'TestCube'
我做错了什么?
Author和Book都是Dimensions,两者都以相同的方式声明,都引用到Cube。
谢谢!