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

Mongo adapter: unable to translate (A AND B) conditional case

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • mongodb-adapter
    • None

    Description

      Mongo adapter fails on query

      select state, city from zips
      where city='MANSFIELD' and state in ('AR', 'TX', 'MA')
      order by state
      

      with

      java.lang.AssertionError: cannot translate OR(=(CAST(ITEM($0, 'state')):VARCHAR(2) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary", 'AR'), =(CAST(ITEM($0, 'state')):VARCHAR(2) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary", 'TX'), =(CAST(ITEM($0, 'state')):VARCHAR(2) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary", 'MA'))
      
      	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)
      
      

      literal case like

      select state, city from zips
      where city='MANSFIELD' and 1=0
      order by state
      

      fails with

      java.lang.AssertionError: cannot translate op null call =(1, 0)
      
      	at org.apache.calcite.adapter.mongodb.MongoFilter$Translator.translateBinary(MongoFilter.java:198)
      	at org.apache.calcite.adapter.mongodb.MongoFilter$Translator.translateMatch2(MongoFilter.java:169)
      	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)
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              vladimir.dolzhenko Vladimir Dolzhenko
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: