<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">LIMIT isn’t in the SQL standard, but the standard has a FETCH clause. Every database I know supports either LIMIT or FETCH. So, for practical purposes, LIMIT is in the standard, but in some dialects it is called FETCH.<div class=""><br class=""></div><div class="">E.g. Postgres supports both:&nbsp;<a href="https://www.postgresql.org/docs/8.4/static/sql-select.html#SQL-LIMIT" class="">https://www.postgresql.org/docs/8.4/static/sql-select.html#SQL-LIMIT</a>&nbsp;</div><div class=""><br class=""></div><div class="">Julian</div><div class=""><br class=""><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 28, 2016, at 7:31 AM, Luc Boudreau &lt;<a href="mailto:lucboudreau@gmail.com" class="">lucboudreau@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">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.&nbsp;<div class=""><br class=""></div><div class="">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 class=""><div class="gmail_quote">On Wed, Sep 28, 2016 at 5:40 AM, Jian Zhong <span dir="ltr" class="">&lt;<a href="mailto:zhongjian@apache.org" target="_blank" class="">zhongjian@apache.org</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">Hi all,<div class=""><br class=""></div><div class="">I'm trying to use Apache Kylin with Mondrian.</div><div class=""><br class=""></div><div class="">everything works fine before I meet TOP_N in kylin.I did some research but cannot fix that.</div><div class=""><br class=""></div><div class="">Hope someone give me a guide.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">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 "SELECT SUM(PRICE),SELLER_ID from KYLIN_SALES group by SELLER_ID "</div><div class="">by default, Mondrian will generate sql like <font color="#ff0000" class="">SQL1(attached below)</font> &nbsp;get all SELLER_ID info first. it's fine before meet TOP_N in Kylin</div><div class=""><br class=""></div><div class="">If SELLER_ID is a extra highCardinality column, and user only want to know TOP 10 SUM(PRICE) &nbsp;Sellers, Kylin will not store all distinct SELLER_ID in cuboid by default.</div><div class="">So Kylin will not support&nbsp;<font color="#ff0000" class="">SQL1</font> ,&nbsp;</div><div class="">But full sql <font color="#ff0000" class="">SQL2</font> will be supported.</div><div class=""><br class=""></div><div class="">Is there any way to avoid MONDRIAN send <font color="#ff0000" class="">SQL1</font>&nbsp;, but send SQL2 directly?&nbsp;</div><div class=""><br class=""></div><div class=""><div class=""><font color="#ff0000" class=""><br class="">SQL1</font>:"SELECT SELLER_ID FROM KYLIN_SALES GROUP BY SELLER_ID"<br class=""></div><div class=""><font color="#ff0000" class="">SQL2</font>:"SELECT SUM(PRICE),SELLER_ID from KYLIN_SALES group by SELLER_ID order by SUM(PRICE) limit 10"</div></div><div class=""><br class=""></div><div class="">About what's TopN in Kylin, see here</div><div class=""><a href="http://kylin.apache.org/blog/2016/03/19/approximate-topn-measure/" target="_blank" class="">http://kylin.apache.org/blog/<wbr class="">2016/03/19/approximate-topn-<wbr class="">measure/</a><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Thank you!</div><div class="">Best Regards</div><div class=""><br class=""></div></div>
<br class="">______________________________<wbr class="">_________________<br class="">
Mondrian mailing list<br class="">
<a href="mailto:Mondrian@pentaho.org" class="">Mondrian@pentaho.org</a><br class="">
<a href="http://lists.pentaho.org/mailman/listinfo/mondrian" rel="noreferrer" target="_blank" class="">http://lists.pentaho.org/<wbr class="">mailman/listinfo/mondrian</a><br class="">
<br class=""></blockquote></div><br class=""></div>
_______________________________________________<br class="">Mondrian mailing list<br class=""><a href="mailto:Mondrian@pentaho.org" class="">Mondrian@pentaho.org</a><br class="">http://lists.pentaho.org/mailman/listinfo/mondrian<br class=""></div></blockquote></div><br class=""></div></div></body></html>