<div dir="ltr">To implement Top, we use the JDBC method java.sql.Stetement.setMaxRows(). The LIMIT keyword is not standard ANSI SQL, so we do not use it. <div><br></div><div>If Kylin returns more rows than expected, it must be because setMaxRows is not implemented properly in the Kylin driver.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 28, 2016 at 5:40 AM, Jian Zhong <span dir="ltr">&lt;<a href="mailto:zhongjian@apache.org" target="_blank">zhongjian@apache.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi all,<div><br></div><div>I&#39;m trying to use Apache Kylin with Mondrian.</div><div><br></div><div>everything works fine before I meet TOP_N in kylin.I did some research but cannot fix that.</div><div><br></div><div>Hope someone give me a guide.</div><div><br></div><div><br></div><div>Say we have table KYLIN_SALES, and dimension SELLER_ID, measure column PRICE (sum), And I put SELLER_ID as &lt;Attribute&gt; in &lt;Dimension&gt;. the full Query SQL should be like this &quot;SELECT SUM(PRICE),SELLER_ID from KYLIN_SALES group by SELLER_ID &quot;</div><div>by default, Mondrian will generate sql like <font color="#ff0000">SQL1(attached below)</font>  get all SELLER_ID info first. it&#39;s fine before meet TOP_N in Kylin</div><div><br></div><div>If SELLER_ID is a extra highCardinality column, and user only want to know TOP 10 SUM(PRICE)  Sellers, Kylin will not store all distinct SELLER_ID in cuboid by default.</div><div>So Kylin will not support <font color="#ff0000">SQL1</font> , </div><div>But full sql <font color="#ff0000">SQL2</font> will be supported.</div><div><br></div><div>Is there any way to avoid MONDRIAN send <font color="#ff0000">SQL1</font> , but send SQL2 directly? </div><div><br></div><div><div><font color="#ff0000"><br>SQL1</font>:&quot;SELECT SELLER_ID FROM KYLIN_SALES GROUP BY SELLER_ID&quot;<br></div><div><font color="#ff0000">SQL2</font>:&quot;SELECT SUM(PRICE),SELLER_ID from KYLIN_SALES group by SELLER_ID order by SUM(PRICE) limit 10&quot;</div></div><div><br></div><div>About what&#39;s TopN in Kylin, see here</div><div><a href="http://kylin.apache.org/blog/2016/03/19/approximate-topn-measure/" target="_blank">http://kylin.apache.org/blog/<wbr>2016/03/19/approximate-topn-<wbr>measure/</a><br></div><div><br></div><div><br></div><div>Thank you!</div><div>Best Regards</div><div><br></div></div>
<br>______________________________<wbr>_________________<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" rel="noreferrer" target="_blank">http://lists.pentaho.org/<wbr>mailman/listinfo/mondrian</a><br>
<br></blockquote></div><br></div>