<div dir="ltr">I believe i&#39;m not violating that principle.<div><br></div><div>I&#39;ve managed to isolate the issue a bit more. Some of the cubes are not based on a single table but on a view, and the problem seems to appear after a few &quot;view cubes&quot; are added/removed. If no &quot;view cubes&quot; are ever added the problem apparently never occurs. Here is an example of a schema using a view:</div>
<div><br></div><div><br></div><div><div>&lt;Cube name=&#39;54e8009a64dd4e97bc5a15b07cacaff7&#39; visible=&#39;true&#39; cache=&#39;true&#39; enabled=&#39;true&#39;&gt;</div><div>  &lt;View alias=&#39;VIEW_CUBE_daa60922f25442e99de732f80d6fdb8c_FACT&#39;&gt;</div>
<div>    &lt;SQL dialect=&#39;generic&#39;&gt;&lt;![CDATA[select</div><div>    &quot;CUBE_daa60922f25442e99de732f80d6fdb8c_FACT&quot;.&quot;MEASURE_4a70415b1aab44ae8ff2c65d1d4ff3cc&quot;,</div><div>    &quot;CUBE_daa60922f25442e99de732f80d6fdb8c_FACT&quot;.&quot;ATTR_f71a0e19745e40c4bcbdce3d555412c5&quot;,</div>
<div>    &quot;MULTI_ATTR_2f2916deca36481ab47bd55a7bf2a197&quot;.&quot;UNIT_VALUE&quot; as &quot;UNIT_VALUE_2f2916deca36481ab47bd55a7bf2a197&quot;,</div><div>    &quot;CUBE_daa60922f25442e99de732f80d6fdb8c_FACT&quot;.&quot;ID&quot;,</div>
<div>    &quot;CUBE_daa60922f25442e99de732f80d6fdb8c_FACT&quot;.&quot;DIM_ID_4db645b51ea74582bc2295b11af6fe96&quot;,</div><div>    &quot;MULTI_ATTR_f71a0e19745e40c4bcbdce3d555412c5&quot;.&quot;UNIT_VALUE&quot; as &quot;UNIT_VALUE_f71a0e19745e40c4bcbdce3d555412c5&quot;,</div>
<div>    &quot;CUBE_daa60922f25442e99de732f80d6fdb8c_FACT&quot;.&quot;ATTR_fd0b6adf39c94ab4ba2fcc13966e49ba&quot;,</div><div>    &quot;CUBE_daa60922f25442e99de732f80d6fdb8c_FACT&quot;.&quot;ATTR_2ca930c08ae440b0a2b313186c7196f4&quot;,</div>
<div>    &quot;MULTI_ATTR_2ca930c08ae440b0a2b313186c7196f4&quot;.&quot;UNIT_VALUE&quot; as &quot;UNIT_VALUE_2ca930c08ae440b0a2b313186c7196f4&quot;,</div><div>    &quot;CUBE_daa60922f25442e99de732f80d6fdb8c_FACT&quot;.&quot;ATTR_2f2916deca36481ab47bd55a7bf2a197&quot;</div>
<div>from</div><div>    &quot;CUBE_daa60922f25442e99de732f80d6fdb8c_FACT&quot; as &quot;CUBE_daa60922f25442e99de732f80d6fdb8c_FACT&quot;</div><div>    left join</div><div>        &quot;MULTI_ATTR_2ca930c08ae440b0a2b313186c7196f4&quot; as &quot;MULTI_ATTR_2ca930c08ae440b0a2b313186c7196f4&quot;</div>
<div>    on</div><div>        &quot;CUBE_daa60922f25442e99de732f80d6fdb8c_FACT&quot;.&quot;MV_ATTR_2ca930c08ae440b0a2b313186c7196f4&quot; = &quot;MULTI_ATTR_2ca930c08ae440b0a2b313186c7196f4&quot;.&quot;ID&quot;</div><div>
    left join</div><div>        &quot;MULTI_ATTR_2f2916deca36481ab47bd55a7bf2a197&quot; as &quot;MULTI_ATTR_2f2916deca36481ab47bd55a7bf2a197&quot;</div><div>    on</div><div>        &quot;CUBE_daa60922f25442e99de732f80d6fdb8c_FACT&quot;.&quot;MV_ATTR_2f2916deca36481ab47bd55a7bf2a197&quot; = &quot;MULTI_ATTR_2f2916deca36481ab47bd55a7bf2a197&quot;.&quot;ID&quot;</div>
<div>    left join</div><div>        &quot;MULTI_ATTR_f71a0e19745e40c4bcbdce3d555412c5&quot; as &quot;MULTI_ATTR_f71a0e19745e40c4bcbdce3d555412c5&quot;</div><div>    on</div><div>        &quot;CUBE_daa60922f25442e99de732f80d6fdb8c_FACT&quot;.&quot;MV_ATTR_f71a0e19745e40c4bcbdce3d555412c5&quot; = &quot;MULTI_ATTR_f71a0e19745e40c4bcbdce3d555412c5&quot;.&quot;ID&quot;]]&gt;&lt;/SQL&gt;</div>
<div>  &lt;/View&gt;</div><div>  </div><div>  &lt;Dimension name=&#39;Topic&#39; caption=&#39;2c37f4b9698d4b88a8378e7e82925cc5:Topic&#39; visible=&#39;true&#39;&gt;</div><div>    &lt;Hierarchy name=&#39;Topic&#39; caption=&#39;Topic&#39; allMemberName=&#39;Total Topic&#39; visible=&#39;true&#39; hasAll=&#39;true&#39;&gt;</div>
<div>      &lt;Level name=&#39;Topic&#39; caption=&#39;Topic&#39; visible=&#39;true&#39; column=&#39;UNIT_VALUE_2c37f4b9698d4b88a8378e7e82925cc5&#39; uniqueMembers=&#39;true&#39; levelType=&#39;Regular&#39; hideMemberIf=&#39;Never&#39; type=&#39;String&#39; /&gt;</div>
<div>    &lt;/Hierarchy&gt;</div><div>  &lt;/Dimension&gt;</div><div>  &lt;Dimension name=&#39;Picture&#39; caption=&#39;52a4ec09bd0a43b0803fe38372dd727b:Picture&#39; visible=&#39;true&#39;&gt;</div><div>    &lt;Hierarchy name=&#39;Picture&#39; caption=&#39;Picture&#39; allMemberName=&#39;Total Picture&#39; visible=&#39;true&#39; hasAll=&#39;true&#39;&gt;</div>
<div>      &lt;Level name=&#39;Picture&#39; caption=&#39;Picture&#39; visible=&#39;true&#39; column=&#39;ATTR_52a4ec09bd0a43b0803fe38372dd727b&#39; uniqueMembers=&#39;true&#39; levelType=&#39;Regular&#39; hideMemberIf=&#39;Never&#39; type=&#39;String&#39; /&gt;</div>
<div>    &lt;/Hierarchy&gt;</div><div>  &lt;/Dimension&gt;</div><div>  &lt;Dimension name=&#39;Post&#39; caption=&#39;62b8abdf73fd4736bc2df933c31d7324:Post&#39; visible=&#39;true&#39;&gt;</div><div>    &lt;Hierarchy name=&#39;Post&#39; caption=&#39;Post&#39; allMemberName=&#39;Total Post&#39; visible=&#39;true&#39; hasAll=&#39;true&#39;&gt;</div>
<div>      &lt;Level name=&#39;Post&#39; caption=&#39;Post&#39; visible=&#39;true&#39; column=&#39;ATTR_62b8abdf73fd4736bc2df933c31d7324&#39; uniqueMembers=&#39;true&#39; levelType=&#39;Regular&#39; hideMemberIf=&#39;Never&#39; type=&#39;String&#39; /&gt;</div>
<div>    &lt;/Hierarchy&gt;</div><div>  &lt;/Dimension&gt;</div><div>  &lt;Dimension name=&#39;Retweet&#39; caption=&#39;2f2916deca36481ab47bd55a7bf2a197:Retweet&#39; visible=&#39;true&#39;&gt;</div><div>    &lt;Hierarchy name=&#39;Retweet&#39; caption=&#39;Retweet&#39; allMemberName=&#39;Total Retweet&#39; visible=&#39;true&#39; hasAll=&#39;true&#39;&gt;</div>
<div>      &lt;Level name=&#39;Retweet&#39; caption=&#39;Retweet&#39; visible=&#39;true&#39; column=&#39;UNIT_VALUE_2f2916deca36481ab47bd55a7bf2a197&#39; uniqueMembers=&#39;true&#39; levelType=&#39;Regular&#39; hideMemberIf=&#39;Never&#39; type=&#39;String&#39; /&gt;</div>
<div>    &lt;/Hierarchy&gt;</div><div>  &lt;/Dimension&gt;</div><div>  &lt;Dimension name=&#39;Minute&#39; caption=&#39;232ca4d9a0a047fa9e37402ad8959350:Minute&#39; visible=&#39;true&#39;&gt;</div><div>    &lt;Hierarchy name=&#39;Minute&#39; caption=&#39;Minute&#39; allMemberName=&#39;Total Minute&#39; visible=&#39;true&#39; hasAll=&#39;true&#39;&gt;</div>
<div>      &lt;Level name=&#39;Minute&#39; caption=&#39;Minute&#39; visible=&#39;true&#39; column=&#39;ATTR_232ca4d9a0a047fa9e37402ad8959350&#39; uniqueMembers=&#39;true&#39; levelType=&#39;Regular&#39; hideMemberIf=&#39;Never&#39; type=&#39;String&#39; /&gt;</div>
<div>    &lt;/Hierarchy&gt;</div><div>  &lt;/Dimension&gt;</div><div>  &lt;Dimension name=&#39;CompaniesTwitter&#39; caption=&#39;2ca930c08ae440b0a2b313186c7196f4:Companies (Twitter)&#39; visible=&#39;true&#39;&gt;</div><div>
    &lt;Hierarchy name=&#39;CompaniesTwitter&#39; caption=&#39;Companies (Twitter)&#39; allMemberName=&#39;Total Companies (Twitter)&#39; visible=&#39;true&#39; hasAll=&#39;true&#39;&gt;</div><div>      &lt;Level name=&#39;CompaniesTwitter&#39; caption=&#39;Companies (Twitter)&#39; visible=&#39;true&#39; column=&#39;UNIT_VALUE_2ca930c08ae440b0a2b313186c7196f4&#39; uniqueMembers=&#39;true&#39; levelType=&#39;Regular&#39; hideMemberIf=&#39;Never&#39; type=&#39;String&#39; /&gt;</div>
<div>    &lt;/Hierarchy&gt;</div><div>  &lt;/Dimension&gt;</div><div>  &lt;Dimension name=&#39;Url&#39; caption=&#39;40bd4ef5fa1740c39b09031beabe923d:Url&#39; visible=&#39;true&#39;&gt;</div><div>    &lt;Hierarchy name=&#39;Url&#39; caption=&#39;Url&#39; allMemberName=&#39;Total Url&#39; visible=&#39;true&#39; hasAll=&#39;true&#39;&gt;</div>
<div>      &lt;Level name=&#39;Url&#39; caption=&#39;Url&#39; visible=&#39;true&#39; column=&#39;ATTR_40bd4ef5fa1740c39b09031beabe923d&#39; uniqueMembers=&#39;true&#39; levelType=&#39;Regular&#39; hideMemberIf=&#39;Never&#39; type=&#39;String&#39; /&gt;</div>
<div>    &lt;/Hierarchy&gt;</div><div>  &lt;/Dimension&gt;</div><div>  &lt;Dimension name=&#39;Sentiment&#39; caption=&#39;f71a0e19745e40c4bcbdce3d555412c5:Sentiment&#39; visible=&#39;true&#39;&gt;</div><div>    &lt;Hierarchy name=&#39;Sentiment&#39; caption=&#39;Sentiment&#39; allMemberName=&#39;Total Sentiment&#39; visible=&#39;true&#39; hasAll=&#39;true&#39;&gt;</div>
<div>      &lt;Level name=&#39;Sentiment&#39; caption=&#39;Sentiment&#39; visible=&#39;true&#39; column=&#39;UNIT_VALUE_f71a0e19745e40c4bcbdce3d555412c5&#39; uniqueMembers=&#39;true&#39; levelType=&#39;Regular&#39; hideMemberIf=&#39;Never&#39; type=&#39;String&#39; /&gt;</div>
<div>    &lt;/Hierarchy&gt;</div><div>  &lt;/Dimension&gt;</div><div>  &lt;Dimension name=&#39;Weekday&#39; caption=&#39;14796f51f80643f3ad48cc8172dd9ac9:Weekday&#39; visible=&#39;true&#39;&gt;</div><div>    &lt;Hierarchy name=&#39;Weekday&#39; caption=&#39;Weekday&#39; allMemberName=&#39;Total Weekday&#39; visible=&#39;true&#39; hasAll=&#39;true&#39;&gt;</div>
<div>      &lt;Level name=&#39;Weekday&#39; caption=&#39;Weekday&#39; visible=&#39;true&#39; column=&#39;ATTR_14796f51f80643f3ad48cc8172dd9ac9&#39; uniqueMembers=&#39;true&#39; levelType=&#39;Regular&#39; hideMemberIf=&#39;Never&#39; type=&#39;String&#39; /&gt;</div>
<div>    &lt;/Hierarchy&gt;</div><div>  &lt;/Dimension&gt;</div><div>  &lt;Measure name=&#39;Fact Count&#39; column=&#39;ID&#39; formatString=&#39;Standard&#39; aggregator=&#39;count&#39; /&gt;</div><div>  &lt;Measure caption=&#39;SUM:4a70415b1aab44ae8ff2c65d1d4ff3cc:Contagem&#39; name=&#39;Contagem_SUM&#39; column=&#39;MEASURE_4a70415b1aab44ae8ff2c65d1d4ff3cc&#39; formatString=&#39;Standard&#39; aggregator=&#39;sum&#39; /&gt;</div>
<div>  &lt;Measure caption=&#39;AVG:4a70415b1aab44ae8ff2c65d1d4ff3cc:Contagem&#39; name=&#39;Contagem_AVG&#39; column=&#39;MEASURE_4a70415b1aab44ae8ff2c65d1d4ff3cc&#39; formatString=&#39;Standard&#39; aggregator=&#39;avg&#39; /&gt;</div>
<div>&lt;/Cube&gt;</div></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 16, 2014 at 1:39 PM, Matt Campbell <span dir="ltr">&lt;<a href="mailto:mcampbell@pentaho.com" target="_blank">mcampbell@pentaho.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">The rule is that a hierarchy must either specify a foreign key, or use the same table as the fact table (i.e. it must be degenerate).  Is your schema violating that rule?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">It is curous that you&#39;re seeing that error with newer versions of Mondrian but not pre-3.6.6, the logic around that check hasn&#39;t changed in quite awhile.  Can you post a snippet of your schema?  <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> <a href="mailto:mondrian-bounces@pentaho.org" target="_blank">mondrian-bounces@pentaho.org</a> [mailto:<a href="mailto:mondrian-bounces@pentaho.org" target="_blank">mondrian-bounces@pentaho.org</a>] <b>On Behalf Of </b>Hilario Fernandes<br>
<b>Sent:</b> Friday, May 16, 2014 7:57 AM<br><b>To:</b> Mondrian mailing list<br><b>Subject:</b> [Mondrian] Hierarchy must have a foreign key error<u></u><u></u></span></p><div><div class="h5"><p class="MsoNormal"><u></u> <u></u></p>
<div><p class="MsoNormal">Hi,<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Since mondrian 3.6.6 build and above i&#39;m getting a strange error in my project:<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><div><p class="MsoNormal">mondrian.olap.MondrianException: Mondrian Error:Hierarchy &#39;hier_name&#39; in cube &#39;cube_name&#39; must have a foreign key, since it is not based on the cube&#39;s fact table.<u></u><u></u></p>
</div><div><p class="MsoNormal">            at mondrian.resource.MondrianResource$_Def1.ex(MondrianResource.java:989)<u></u><u></u></p></div><div><p class="MsoNormal">            at mondrian.rolap.RolapCube.registerDimension(RolapCube.java:1770)<u></u><u></u></p>
</div><div><p class="MsoNormal">            at mondrian.rolap.RolapCube.&lt;init&gt;(RolapCube.java:203)<u></u><u></u></p></div><div><p class="MsoNormal">            at mondrian.rolap.RolapCube.&lt;init&gt;(RolapCube.java:227)<u></u><u></u></p>
</div><div><p class="MsoNormal">            at mondrian.rolap.RolapSchema.createCube(RolapSchema.java:917)<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">It seems like it&#39;s related to degenerate dimensions and the usage of alias in the fact table. In version 3.6.5 and bellow this error only occurred when the alias was specified, but now there seem to have been some changes on the class RolapSchema that enforces the usage of the alias.<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">In my project i&#39;m adding and removing cubes from the schema, and this seems to mask the problem, since it only occurs after some time so i&#39;m unable to blame any specific query or cube.<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Anyone has ideas on this, or is getting the same error?<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">
Thank you<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal">-- <u></u><u></u></p><div><div><p class="MsoNormal">Hilario Fernandes<u></u><u></u></p></div></div></div></div></div>
</div></div></div><br>_______________________________________________<br>
Mondrian mailing list<br>
<a href="mailto:Mondrian@pentaho.org">Mondrian@pentaho.org</a><br>
<a href="http://lists.pentaho.org/mailman/listinfo/mondrian" target="_blank">http://lists.pentaho.org/mailman/listinfo/mondrian</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><div>Hilario Fernandes</div></div>
</div>