terran2010 created CALCITE-7404:
-----------------------------------

             Summary: Mongodb aggfuntion not support condition filter
                 Key: CALCITE-7404
                 URL: https://issues.apache.org/jira/browse/CALCITE-7404
             Project: Calcite
          Issue Type: Bug
          Components: mongodb-adapter
    Affects Versions: 1.41.0
            Reporter: terran2010


The SQL:
{code:java}
select min(pop>5000) as pop_result from zips
{code}
The currently generated pipeline query statement
{code:java}
{
  "$project": {
    "$f0": {
      "$gt": [
        "$pop",
        {
          "$literal": 5000
        }
      ]
    }
  }
}
{
  "$group": {
    "_id": {},
    "POP_RESULT": {
      "$min": "$_0"
    }
  }
} {code}
The correct one should be
{code:java}
{
  $project: {
    _0: {
      $gt: ['$pop', {
        $literal: 5000
      }]
    }
  }
}
{
  $group: {
    _id: {},
    POP_RESULT: {
      $min: '$_0'
    }
  }
}{code}
We should improve it



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to