[ https://issues.apache.org/jira/browse/CALCITE-1577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15830352#comment-15830352 ]
Jesus Camacho Rodriguez commented on CALCITE-1577: -------------------------------------------------- [~julianhyde], I have created a fix for this in https://github.com/julianhyde/calcite/pull/9/commits/66339365bd40119d7bba5fa3ba42e5bbac6835d0 . I created a PR against CALCITE-1578 too. Could you review the new code and merge it into your branch? The PR contains tests. However, one of the tests does not currently pass, as the Sort operation is not pushed into Druid. I double-checked and logic is correct, hence I think it has to do with the optimizer and the cost of the expression. For those new tests in the PR, which are transformed into timeseries queries, I do not run the query against Druid: in my environment, Druid crashes (probably not enough memory to execute timeseries + sort). > Druid adapter: Incorrect result - limit on timestamp disappears > --------------------------------------------------------------- > > Key: CALCITE-1577 > URL: https://issues.apache.org/jira/browse/CALCITE-1577 > Project: Calcite > Issue Type: Bug > Components: druid > Affects Versions: 1.11.0 > Reporter: Jesus Camacho Rodriguez > Assignee: Jesus Camacho Rodriguez > Priority: Critical > > This can be observed with the following query: > {code:sql} > SELECT DISTINCT `__time` > FROM store_sales_sold_time_subset > ORDER BY `__time` ASC > LIMIT 10; > {code} > Query is translated to Druid _timeseries_, but _limit_ operator disappears. -- This message was sent by Atlassian JIRA (v6.3.4#6332)