Saiku查询结果不正确

时间:2019-12-13 03:19:48

标签: schema mondrian saiku

版本:mondrian4,saiku3.15,mysql5.7

这是在架构中定义的维度表

Dimension table

如saiku查询所示,发生了不正确的查询,导致出现重复的行。(“回访情况” =“ isNoLink”,“满意情况” =“批准”,“总数量” =“ count”)

Incorrect result(1)

Incorrect result(2)

正确的结果应该是这样的

Correct result(1)

Correct result(2)

您会看到两行不同的“ 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="&#23436;&#25104;&#26102;&#38388;" 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="&#26102;&#38388;&#36724;"
                    allMemberName="all stateTime_Hierarchy" allMemberCaption="&#25152;&#26377;&#26102;&#38388;" hasAll="true">
                    <Level attribute="year"
                        caption="&#24180;&#20221;" />
                    <Level attribute="month"
                        caption="&#26376;&#20221;" />
                    <Level attribute="day"
                        caption="&#26085;&#26399;" />
                </Hierarchy>
            </Hierarchies>
        </Dimension>

        <Dimension name="appOrg_Dimension" caption="&#25215;&#21150;&#21333;&#20301;" 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="&#21333;&#20301;&#20449;&#24687;" allMemberName="all appOrg_Hierarchy" 
                    allMemberCaption="&#25152;&#26377;&#21333;&#20301;&#20449;&#24687;" hasAll="true">
                    <Level attribute="appOrgName" caption="&#21333;&#20301;&#21517;&#23383;" />
                </Hierarchy>
            </Hierarchies>
        </Dimension>

        <Dimension name="type_Dimension" caption="&#20998;&#31867;" 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="&#35814;&#32454;&#20998;&#31867;"
                    allMemberName="all type_Hierarchy" allMemberCaption="&#25152;&#26377;&#20998;&#31867;" hasAll="true">
                    <Level attribute="type" caption="&#31867;&#22411;" />
                    <Level attribute="classify" caption="&#31867;&#21035;" />
                    <Level attribute="firstActName" caption="&#38382;&#39064;&#19968;&#32423;&#20998;&#31867;" />
                    <Level attribute="secondActName" caption="&#38382;&#39064;&#20108;&#32423;&#20998;&#31867;" />
                    <Level attribute="thirdActName" caption="&#38382;&#39064;&#19977;&#32423;&#20998;&#31867;" />
                </Hierarchy>
            </Hierarchies>          
        </Dimension>

        <Dimension name="condition_Dimension" caption="&#23436;&#25104;&#24773;&#20917;" 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="&#35814;&#32454;&#29366;&#20917;"
                    allMemberName="all condition_Hierarchy" allMemberCaption="&#25152;&#26377;&#24773;&#20917;" hasAll="true">
                    <Level attribute="isNoLink" caption="&#22238;&#35775;&#24773;&#20917;" />
                    <Level attribute="approve" caption="&#28385;&#24847;&#24773;&#20917;" />
                </Hierarchy>
            </Hierarchies>
        </Dimension>

    </Dimensions>

    <MeasureGroups>
        <MeasureGroup name="orders" table="orders">
            <Measures>
                <Measure name="count" caption="&#24635;&#25968;&#37327;" column="proWoCode" aggregator="distinct-count" datatype="Integer"/>
                <Measure name="avgDotime" caption="&#24179;&#22343;&#21150;&#29702;&#26102;&#38271;" 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>

0 个答案:

没有答案