You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Volodymyr Vysotskyi (JIRA)" <ji...@apache.org> on 2018/07/15 10:45:00 UTC

[jira] [Updated] (CALCITE-2415) Evaluation of predicate "(A or B) and C" is failing for MongoDB adapter

     [ https://issues.apache.org/jira/browse/CALCITE-2415?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Volodymyr Vysotskyi updated CALCITE-2415:
-----------------------------------------
    Description: 
h2. Queries that are working
{code:java}
select count(*) from "elastic" where _MAP['foo'] in ('1') and true;
select count(*) from "elastic" where _MAP['foo'] ='1' and true;
select count(*) from "elastic" where _MAP['foo'] in ('1', '2');
{code}
h2. Queries that are failing
{code:java}
select count(*) from "elastic" where _MAP['foo'] in ('1', '2') and true;
select count(*) from "elastic" where true and _MAP['foo'] in ('1', '2');
select count(*) from "elastic" where (_MAP['foo'] ='1' or _MAP['foo'] = '2') and true;
{code}
h2. Mongo Adapter Exception
{quote}select * from "mongo"."col"
 where _MAP['foo'] in ('1', '2') and true;

java.lang.AssertionError: cannot translate OR(=(ITEM($0, 'foo'), '1'),
 =(ITEM($0, 'foo'), '2'))
 at org.apache.calcite.adapter.mongodb.MongoFilter$
 Translator.translateMatch2(MongoFilter.java:181)
 at org.apache.calcite.adapter.mongodb.MongoFilter$
 Translator.translateAnd(MongoFilter.java:116)
 at org.apache.calcite.adapter.mongodb.MongoFilter$
 Translator.translateOr(MongoFilter.java:98)
 at org.apache.calcite.adapter.mongodb.MongoFilter$
 Translator.translateMatch(MongoFilter.java:91)
 at org.apache.calcite.adapter.mongodb.MongoFilter$
 Translator.access$000(MongoFilter.java:77)
 at org.apache.calcite.adapter.mongodb.MongoFilter.implement(
 MongoFilter.java:72)
 at org.apache.calcite.adapter.mongodb.MongoRel$Implementor.
 visitChild(MongoRel.java:51)
 at org.apache.calcite.adapter.mongodb.MongoToEnumerableConverter.
 implement(MongoToEnumerableConverter.java:84)
 at org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.
 implementRoot(EnumerableRelImplementor.java:103)
 at org.apache.calcite.adapter.enumerable.EnumerableInterpretable.
 toBindable(EnumerableInterpretable.java:92)
{quote}

  was:
h2. Queries that are working
{code}
select count(*) from "elastic" where _MAP['foo'] in ('1') and true;
select count(*) from "elastic" where _MAP['foo'] ='1' and true;
select count(*) from "elastic" where _MAP['foo'] in ('1', '2');
{code}

h2. Queries that are failing
{code}
select count(*) from "elastic" where _MAP['foo'] in ('1', '2') and true;
select count(*) from "elastic" where true and _MAP['foo'] in ('1', '2');
select count(*) from "elastic" where (_MAP['foo'] ='1' or _MAP['foo'] = '2') and true;
{code}

h2. Elastic Adapter Exception
{quote}
java.lang.AssertionError: cannot translate OR(=(ITEM($0, 'foo'), '1'),
=(ITEM($0, 'foo'), '2'))
        at org.apache.calcite.adapter.elasticsearch.ElasticsearchFilter$
Translator.translateMatch2(ElasticsearchFilter.java:234)
        at org.apache.calcite.adapter.elasticsearch.ElasticsearchFilter$
Translator.translateAnd(ElasticsearchFilter.java:158)
        at org.apache.calcite.adapter.elasticsearch.ElasticsearchFilter$
Translator.translateOr(ElasticsearchFilter.java:115)
        at org.apache.calcite.adapter.elasticsearch.ElasticsearchFilter$
Translator.translateMatch(ElasticsearchFilter.java:101)
        at org.apache.calcite.adapter.elasticsearch.ElasticsearchFilter$
Translator.access$000(ElasticsearchFilter.java:87)
        at org.apache.calcite.adapter.elasticsearch.
ElasticsearchFilter.implement(ElasticsearchFilter.java:80)
        at org.apache.calcite.adapter.elasticsearch.
ElasticsearchRel$Implementor.visitChild(ElasticsearchRel.java:53)
        at org.apache.calcite.adapter.elasticsearch.
ElasticsearchToEnumerableConverter.implement(ElasticsearchToEnumerableConve
rter.java:71)
        at org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.
visitChild(EnumerableRelImplementor.java:98)
        at org.apache.calcite.adapter.enumerable.
EnumerableAggregate.implement(EnumerableAggregate.java:106)
{quote}

h2. Mongo Adapter Exception
{quote}
select * from "mongo"."col"
where _MAP['foo'] in ('1', '2') and true;

java.lang.AssertionError: cannot translate OR(=(ITEM($0, 'foo'), '1'),
=(ITEM($0, 'foo'), '2'))
        at org.apache.calcite.adapter.mongodb.MongoFilter$
Translator.translateMatch2(MongoFilter.java:181)
        at org.apache.calcite.adapter.mongodb.MongoFilter$
Translator.translateAnd(MongoFilter.java:116)
        at org.apache.calcite.adapter.mongodb.MongoFilter$
Translator.translateOr(MongoFilter.java:98)
        at org.apache.calcite.adapter.mongodb.MongoFilter$
Translator.translateMatch(MongoFilter.java:91)
        at org.apache.calcite.adapter.mongodb.MongoFilter$
Translator.access$000(MongoFilter.java:77)
        at org.apache.calcite.adapter.mongodb.MongoFilter.implement(
MongoFilter.java:72)
        at org.apache.calcite.adapter.mongodb.MongoRel$Implementor.
visitChild(MongoRel.java:51)
        at org.apache.calcite.adapter.mongodb.MongoToEnumerableConverter.
implement(MongoToEnumerableConverter.java:84)
        at org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.
implementRoot(EnumerableRelImplementor.java:103)
        at org.apache.calcite.adapter.enumerable.EnumerableInterpretable.
toBindable(EnumerableInterpretable.java:92)
{quote}


> Evaluation of predicate "(A or B) and C" is failing for MongoDB adapter
> -----------------------------------------------------------------------
>
>                 Key: CALCITE-2415
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2415
>             Project: Calcite
>          Issue Type: Bug
>          Components: elasticsearch-adapter, geode, mongodb
>            Reporter: Andrei Sereda
>            Assignee: Michael Mior
>            Priority: Critical
>
> h2. Queries that are working
> {code:java}
> select count(*) from "elastic" where _MAP['foo'] in ('1') and true;
> select count(*) from "elastic" where _MAP['foo'] ='1' and true;
> select count(*) from "elastic" where _MAP['foo'] in ('1', '2');
> {code}
> h2. Queries that are failing
> {code:java}
> select count(*) from "elastic" where _MAP['foo'] in ('1', '2') and true;
> select count(*) from "elastic" where true and _MAP['foo'] in ('1', '2');
> select count(*) from "elastic" where (_MAP['foo'] ='1' or _MAP['foo'] = '2') and true;
> {code}
> h2. Mongo Adapter Exception
> {quote}select * from "mongo"."col"
>  where _MAP['foo'] in ('1', '2') and true;
> java.lang.AssertionError: cannot translate OR(=(ITEM($0, 'foo'), '1'),
>  =(ITEM($0, 'foo'), '2'))
>  at org.apache.calcite.adapter.mongodb.MongoFilter$
>  Translator.translateMatch2(MongoFilter.java:181)
>  at org.apache.calcite.adapter.mongodb.MongoFilter$
>  Translator.translateAnd(MongoFilter.java:116)
>  at org.apache.calcite.adapter.mongodb.MongoFilter$
>  Translator.translateOr(MongoFilter.java:98)
>  at org.apache.calcite.adapter.mongodb.MongoFilter$
>  Translator.translateMatch(MongoFilter.java:91)
>  at org.apache.calcite.adapter.mongodb.MongoFilter$
>  Translator.access$000(MongoFilter.java:77)
>  at org.apache.calcite.adapter.mongodb.MongoFilter.implement(
>  MongoFilter.java:72)
>  at org.apache.calcite.adapter.mongodb.MongoRel$Implementor.
>  visitChild(MongoRel.java:51)
>  at org.apache.calcite.adapter.mongodb.MongoToEnumerableConverter.
>  implement(MongoToEnumerableConverter.java:84)
>  at org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.
>  implementRoot(EnumerableRelImplementor.java:103)
>  at org.apache.calcite.adapter.enumerable.EnumerableInterpretable.
>  toBindable(EnumerableInterpretable.java:92)
> {quote}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)