Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-2331

Evaluation of predicate "(A or B) and C" fails for Elasticsearch adapter

Rank to TopRank to BottomBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersConvert to sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • None
    • 1.17.0
    • elasticsearch-adapter
    • None

    Description

      Queries that are working

      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');
      

      Queries that are failing

      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;
      

      Elastic Adapter Exception

      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)

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            mmior Michael Mior
            sereda Andrei Sereda
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment