版本:mondrian4,saiku3.15,mysql5.7
这是在架构中定义的维度表
如saiku查询所示,发生了不正确的查询,导致出现重复的行。(“回访情况” =“ isNoLink”,“满意情况” =“批准”,“总数量” =“ count”)
正确的结果应该是这样的
您会看到两行不同的“ isNoLink”和相同的“ approve”被错误合并
由我自己进行调试之后,除了时间维度外,其他维度只有层次结构的第一级(按Schema文件定义的级别顺序)才能产生正确的结果,作为行查询。
无论查询中有多少行或多少列,如果至少一个级别(不是第一级)添加到查询中,势必会导致重复的行和数据出错。
我不知道此问题的根源是什么,也许是架构文件错误或saiku机制。
这是我的模式
<PhysicalSchema>
<Table name="orders" keyColumn="proWoCode" />
<Table name="appOrg" keyColumn="proWoCode" />
<Table name="time" keyColumn="proWoCode" />
<Table name="type" keyColumn="proWoCode" />
<Table name="condition" keyColumn="proWoCode" />
<Link source="appOrg" foreignKeyColumn="proWoCode" target="orders" />
<Link source="time" foreignKeyColumn="proWoCode" target="orders" />
<Link source="type" foreignKeyColumn="proWoCode" target="orders" />
<Link source="condition" foreignKeyColumn="proWoCode" target="orders" />
</PhysicalSchema>
<Cube name="zctag_cube">
<Dimensions>
<Dimension name="stateTime_Dimension" caption="完成时间" table="time" key="proWoCode" type="TIME">
<Attributes>
<Attribute name="proWoCode" table="time" keyColumn="proWoCode" hasHierarchy="false" />
<Attribute name="year" table="time" keyColumn="year" hasHierarchy="false" />
<Attribute name="month" table="time" keyColumn="month" hasHierarchy="false" />
<Attribute name="day" table="time" keyColumn="day" hasHierarchy="false" />
</Attributes>
<Hierarchies>
<Hierarchy name="stateTime_Hierarchy"
caption="时间轴"
allMemberName="all stateTime_Hierarchy" allMemberCaption="所有时间" hasAll="true">
<Level attribute="year"
caption="年份" />
<Level attribute="month"
caption="月份" />
<Level attribute="day"
caption="日期" />
</Hierarchy>
</Hierarchies>
</Dimension>
<Dimension name="appOrg_Dimension" caption="承办单位" table="appOrg" key="proWoCode">
<Attributes>
<Attribute name="proWoCode" table="appOrg" keyColumn="proWoCode" hasHierarchy="false" />
<Attribute name="appOrgName" table="appOrg" keyColumn="appOrgName" hasHierarchy="false" />
</Attributes>
<Hierarchies>
<Hierarchy name="appOrg_Hierarachy"
caption="单位信息" allMemberName="all appOrg_Hierarchy"
allMemberCaption="所有单位信息" hasAll="true">
<Level attribute="appOrgName" caption="单位名字" />
</Hierarchy>
</Hierarchies>
</Dimension>
<Dimension name="type_Dimension" caption="分类" table="type" key="proWoCode">
<Attributes>
<Attribute name="proWoCode" table="type" keyColumn="proWoCode" hasHierarchy="false" />
<Attribute name="type" table="type" keyColumn="type" hasHierarchy="false" />
<Attribute name="classify" table="type" keyColumn="classify" hasHierarchy="false" />
<Attribute name="firstActName" table="type" keyColumn="firstActName" hasHierarchy="false" />
<Attribute name="secondActName" table="type" keyColumn="secondActName" hasHierarchy="false" />
<Attribute name="thirdActName" table="type" keyColumn="thirdActName" hasHierarchy="false" />
</Attributes>
<Hierarchies>
<Hierarchy name="type_Hierarchy" caption="详细分类"
allMemberName="all type_Hierarchy" allMemberCaption="所有分类" hasAll="true">
<Level attribute="type" caption="类型" />
<Level attribute="classify" caption="类别" />
<Level attribute="firstActName" caption="问题一级分类" />
<Level attribute="secondActName" caption="问题二级分类" />
<Level attribute="thirdActName" caption="问题三级分类" />
</Hierarchy>
</Hierarchies>
</Dimension>
<Dimension name="condition_Dimension" caption="完成情况" table="condition" key="proWoCode">
<Attributes>
<Attribute name="proWoCode" table="condition" keyColumn="proWoCode" hasHierarchy="false" />
<Attribute name="isNoLink" table="condition" keyColumn="isNoLink" hasHierarchy="false" />
<Attribute name="approve" table="condition" keyColumn="approve" hasHierarchy="false" />
</Attributes>
<Hierarchies>
<Hierarchy name="condition_Hierarchy" caption="详细状况"
allMemberName="all condition_Hierarchy" allMemberCaption="所有情况" hasAll="true">
<Level attribute="isNoLink" caption="回访情况" />
<Level attribute="approve" caption="满意情况" />
</Hierarchy>
</Hierarchies>
</Dimension>
</Dimensions>
<MeasureGroups>
<MeasureGroup name="orders" table="orders">
<Measures>
<Measure name="count" caption="总数量" column="proWoCode" aggregator="distinct-count" datatype="Integer"/>
<Measure name="avgDotime" caption="平均办理时长" column="dotime" aggregator="avg" datatype="String" />
</Measures>
<DimensionLinks>
<ForeignKeyLink dimension="stateTime_Dimension" foreignKeyColumn="proWoCode" />
<ForeignKeyLink dimension="appOrg_Dimension" foreignKeyColumn="proWoCode" />
<ForeignKeyLink dimension="type_Dimension" foreignKeyColumn="proWoCode" />
<ForeignKeyLink dimension="condition_Dimension" foreignKeyColumn="proWoCode" />
</DimensionLinks>
</MeasureGroup>
</MeasureGroups>
</Cube>