You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "zoov-w (via GitHub)" <gi...@apache.org> on 2025/06/29 10:04:28 UTC

[PR] [CALCITE-7079] Mongodb Adapter unable to translate multiple $ne condition conpose of AND [calcite]

zoov-w opened a new pull request, #4450:
URL: https://github.com/apache/calcite/pull/4450

   JIRA: https://issues.apache.org/jira/browse/CALCITE-7079
   
   Mongodb adapter translate more than one $ne condition error.
   
   run sql:
   ` select city, state from zips where city <> 'ABERDEEN' and city <> 'AIKEN' `
   
   query plan:
   `{
     "$match": {
       "city": {
         "$ne": "AIKEN"
       }
     }
   }, {$project: {CITY: '$city', STATE: '$state'}}
   `
   
   The condition (city <> 'ABERDEEN') lost,actually, more than one $ne condition conpose of AND have to translate to $nin operation, such as:
   `
   {
     "$match": {
       "city": {
         "$nin": [
           "AIKEN",
           "ABERDEEN"
         ]
       }
     }
   }, {$project: {CITY: '$city', STATE: '$state'}} 
    `


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7079] Mongodb Adapter unable to translate multiple $ne condition conpose of AND [calcite]

Posted by "xiedeyantu (via GitHub)" <gi...@apache.org>.
xiedeyantu commented on PR #4450:
URL: https://github.com/apache/calcite/pull/4450#issuecomment-3016805774

   I try to run this test, but thow an error:
   ```
   Error while executing SQL "select city, state from zips where city <> 'ABERDEEN' and city <> 'AIKEN'  order by city": Unable to implement MongoToEnumerableConverter: rowcount = 25.0, cumulative cost = {18.75 rows, 108.07189562170501 cpu, 0.0 io}, id = 98
     MongoSort(sort0=[$0], dir0=[ASC]): rowcount = 25.0, cumulative cost = {16.25 rows, 105.57189562170501 cpu, 0.0 io}, id = 96
       MongoProject(CITY=[CAST(ITEM($0, 'city')):VARCHAR(20)], STATE=[CAST(ITEM($0, 'state')):VARCHAR(2)]): rowcount = 25.0, cumulative cost = {15.0 rows, 25.1 cpu, 0.0 io}, id = 94
         MongoFilter(condition=[SEARCH(CAST(ITEM($0, 'city')):VARCHAR(20), Sarg[(-∞..'ABERDEEN':VARCHAR(20)), ('ABERDEEN':VARCHAR(20)..'AIKEN':VARCHAR(20)), ('AIKEN':VARCHAR(20)..+∞)]:VARCHAR(20))]): rowcount = 25.0, cumulative cost = {12.5 rows, 20.1 cpu, 0.0 io}, id = 92
           MongoTableScan(table=[[mongo_raw, zips]]): rowcount = 100.0, cumulative cost = {10.0 rows, 10.100000000000001 cpu, 0.0 io}, id = 13
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7079] Mongodb Adapter unable to translate multiple $ne condition conpose of AND [calcite]

Posted by "zoov-w (via GitHub)" <gi...@apache.org>.
zoov-w closed pull request #4450:  [CALCITE-7079] Mongodb Adapter unable to translate multiple $ne condition conpose of AND
URL: https://github.com/apache/calcite/pull/4450


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org