<div dir="ltr">Hi,<div><br></div><div>I&#39;m trying to get mondrian to execute a top count query in a native way on monetdb.</div><div><br></div><div>I have set all the properties related to native execution:</div><div><br>
</div><div><div>mondrian­.­native­.­crossjoin­.­enable=true</div><div>mondrian­.­native­.­filter­.­enable=true</div><div>mondrian­.­native­.­nonempty­.­enable=true<span class="" style="white-space:pre">                </span></div><div>
mondrian­.­native­.­topcount­.­enable=true</div><div>mondrian.native.ExpandNonNative=true</div></div><div><br></div><div>the mdx:</div><div><br></div><div><div>select {} ON COLUMNS,</div><div>  {TopCount({[cidade].[cidade].Members}, 2, [Measures].[idade_SUM])} ON ROWS</div>
<div>from [cube]</div><div>where {}</div></div><div><br></div><div><br></div><div>the generated SQL:</div><div><br></div><div><div>select</div><div>    &quot;CUBE&quot;.&quot;ATTR_0&quot; as &quot;c0&quot;</div><div>from</div>
<div>    &quot;CUBE&quot; as &quot;CUBE&quot;</div><div>group by</div><div>    &quot;CUBE&quot;.&quot;ATTR_0&quot;</div><div>order by</div><div>    CASE WHEN sum(&quot;CUBE&quot;.&quot;MEASURE_0&quot;) IS NULL THEN 1 ELSE 0 END, sum(&quot;CUBE&quot;.&quot;MEASURE_0&quot;) DESC,</div>
<div>    CASE WHEN &quot;CUBE&quot;.&quot;ATTR_0&quot; IS NULL THEN 1 ELSE 0 END, &quot;CUBE&quot;.&quot;ATTR_0&quot; ASC</div></div><div><br></div><div><br></div><div>And i get the error:</div><div><br></div><div><div>Query did not produce a result set. Stacktrace follows:</div>
<div>java.sql.SQLException: Query did not produce a result set</div><div><span class="" style="white-space:pre">        </span>at nl.cwi.monetdb.jdbc.MonetStatement.executeQuery(MonetStatement.java:526)</div><div><span class="" style="white-space:pre">        </span>at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)</div>
<div><span class="" style="white-space:pre">        </span>at mondrian.rolap.SqlStatement.execute(SqlStatement.java:201)</div><div><span class="" style="white-space:pre">        </span>at mondrian.rolap.RolapUtil.executeQuery(RolapUtil.java:335)</div>
<div><span class="" style="white-space:pre">        </span>at mondrian.rolap.SqlTupleReader.prepareTuples(SqlTupleReader.java:395)</div><div><span class="" style="white-space:pre">        </span>at mondrian.rolap.SqlTupleReader.readMembers(SqlTupleReader.java:506)</div>
<div><span class="" style="white-space:pre">        </span>at mondrian.rolap.RolapNativeSet$SetEvaluator.executeList(RolapNativeSet.java:246)</div><div><span class="" style="white-space:pre">        </span>at mondrian.rolap.RolapNativeSet$SetEvaluator.execute(RolapNativeSet.java:190)</div>
<div><span class="" style="white-space:pre">        </span>at mondrian.olap.fun.TopBottomCountFunDef$3.evaluateList(TopBottomCountFunDef.java:84)</div><div><span class="" style="white-space:pre">        </span>at mondrian.calc.impl.AbstractListCalc.evaluateIterable(AbstractListCalc.java:71)</div>
<div><span class="" style="white-space:pre">        </span>at mondrian.rolap.RolapResult.executeAxis(RolapResult.java:875)</div><div><span class="" style="white-space:pre">        </span>at mondrian.rolap.RolapResult.evalLoad(RolapResult.java:700)</div>
<div><span class="" style="white-space:pre">        </span>at mondrian.rolap.RolapResult.loadMembers(RolapResult.java:656)</div><div><span class="" style="white-space:pre">        </span>at mondrian.rolap.RolapResult.&lt;init&gt;(RolapResult.java:288)</div>
<div><span class="" style="white-space:pre">        </span>at mondrian.rolap.RolapConnection.executeInternal(RolapConnection.java:671)</div><div><span class="" style="white-space:pre">        </span>at mondrian.rolap.RolapConnection.access$000(RolapConnection.java:51)</div>
<div><span class="" style="white-space:pre">        </span>at mondrian.rolap.RolapConnection$1.call(RolapConnection.java:622)</div><div><span class="" style="white-space:pre">        </span>at mondrian.rolap.RolapConnection$1.call(RolapConnection.java:621)</div>
<div><span class="" style="white-space:pre">        </span>at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)</div><div><span class="" style="white-space:pre">        </span>at java.util.concurrent.FutureTask.run(FutureTask.java:166)</div>
<div><span class="" style="white-space:pre">        </span>at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)</div><div><span class="" style="white-space:pre">        </span>at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)</div>
<div><span class="" style="white-space:pre">        </span>at java.lang.Thread.run(Thread.java:722)</div></div><div><br></div><div><br></div><div>I&#39;ve run the query directly on the database and indeed, it does not return results. I don&#39;t get whats the use of the case expressions on the order by, and its seems to be whats causing no results do be returned. Any idea what i&#39;m doing wrong? Is there a problem with case expressions and monetdb that i&#39;m not aware?</div>
<div><br></div><div>Thanks</div></div>