You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2015/05/29 23:44:18 UTC

[jira] [Commented] (CALCITE-740) mongo-calcite produces incorrect results when query contains redundant 'where' clauses

    [ https://issues.apache.org/jira/browse/CALCITE-740?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14565472#comment-14565472 ] 

Julian Hyde commented on CALCITE-740:
-------------------------------------

I tried

{code}  @Test public void testFilterPair() {
    final int expected9k = 8125;
    final int expected8k = 8707;
    asd(expected9k, "where pop > 8000 and pop > 9000");
    asd(expected9k, "where pop > 9000");
    asd(expected8k, "where pop > 8000");
    asd(expected9k, "where pop > 9000 and pop > 8000");
    asd(expected8k, "where pop > 9000 or pop > 8000");
    asd(expected8k, "where pop > 8000 or pop > 9000");
  }

  private void asd(int expected, String q) {
    CalciteAssert.that()
        .enable(enabled())
        .with(ZIPS)
        .query("select count(*) as c from zips\n" + q)
        .returns("C=" + expected + "\n");
    CalciteAssert.that()
        .enable(enabled())
        .with(ZIPS)
        .query("select * from zips\n" + q)
        .returnsCount(expected);
  }
{code}

and it gave desired results.

> mongo-calcite produces incorrect results when query contains redundant 'where' clauses
> --------------------------------------------------------------------------------------
>
>                 Key: CALCITE-740
>                 URL: https://issues.apache.org/jira/browse/CALCITE-740
>             Project: Calcite
>          Issue Type: Bug
>    Affects Versions: 1.2.0-incubating
>            Reporter: Robert Antonucci
>            Assignee: Julian Hyde
>             Fix For: next
>
>
> Running a query with the 'where' clause:
>      {{where (pop > 8000 and pop > 9000)}}
> does not produce the same result as:
>      {{where pop > 9000}}
> instead it produces the same result as:
>      {{where pop > 8000}}
> This was run using calcite-mongo's zips collection.
> The interpreter appears to treat the 'and' as an 'or'.  This despite the fact that queries like:
>      {{where (pop > 8000 and pop < 9000)}}
> work as you would expect.
> Tried this on other data stores and did not see the same problem.  Just calcite-mongo.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)