Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Support between/not between operator #1067

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

chloe-zh
Copy link
Member

@chloe-zh chloe-zh commented Mar 6, 2021

Issue #, if available:
#1058

Description of changes:

{
  "from":0,
  "size":200,
  "timeout":"1m",
  "query":{
    "range":{
      "age":{
        "from":20,
        "to":30,
        "include_lower":true,
        "include_upper":true,
        "boost":1.0
      }
    }
  },
  "_source":{
    "includes":[
      "age",
      "lastname"
    ],
    "excludes":[
      
    ]
  },
  "sort":[
    {
      "_doc":{
        "order":"asc"
      }
    }
  ]
}

And query SELECT lastname, age FROM accounts WHERE age NOT BETWEEN 20 AND 30:

{
  "from":0,
  "size":200,
  "timeout":"1m",
  "query":{
    "bool":{
      "must_not":[
        {
          "range":{
            "age":{
              "from":20,
              "to":30,
              "include_lower":true,
              "include_upper":true,
              "boost":1.0
            }
          }
        }
      ],
      "adjust_pure_negative":true,
      "boost":1.0
    }
  },
  "_source":{
    "includes":[
      "age",
      "lastname"
    ],
    "excludes":[
      
    ]
  },
  "sort":[
    {
      "_doc":{
        "order":"asc"
      }
    }
  ]
}

Note: this PR does not include comparison test because of different behaviors for the testing DBs, they are returning integer type (1 as true and 0 as false).

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@chloe-zh chloe-zh added the SQL label Mar 6, 2021
@codecov
Copy link

codecov bot commented Mar 6, 2021

Codecov Report

Merging #1067 (1545188) into develop (c1107bb) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             develop    #1067   +/-   ##
==========================================
  Coverage      99.89%   99.89%           
- Complexity      2408     2432   +24     
==========================================
  Files            236      236           
  Lines           5484     5537   +53     
  Branches         327      338   +11     
==========================================
+ Hits            5478     5531   +53     
  Misses             5        5           
  Partials           1        1           
Impacted Files Coverage Δ Complexity Δ
...elasticsearch/sql/analysis/ExpressionAnalyzer.java 100.00% <ø> (ø) 31.00 <0.00> (ø)
...arch/storage/script/filter/FilterQueryBuilder.java 100.00% <ø> (ø) 10.00 <0.00> (ø)
...opendistroforelasticsearch/sql/expression/DSL.java 100.00% <100.00%> (ø) 135.00 <2.00> (+2.00)
...h/sql/expression/function/BuiltinFunctionName.java 100.00% <100.00%> (ø) 3.00 <0.00> (ø)
...on/operator/predicate/BinaryPredicateOperator.java 100.00% <100.00%> (ø) 38.00 <1.00> (+1.00)
...istroforelasticsearch/sql/utils/OperatorUtils.java 100.00% <100.00%> (ø) 22.00 <10.00> (+10.00)
...arch/storage/script/filter/lucene/LuceneQuery.java 100.00% <100.00%> (ø) 12.00 <6.00> (+3.00)
...earch/storage/script/filter/lucene/RangeQuery.java 100.00% <100.00%> (ø) 7.00 <2.00> (+2.00)
...ticsearch/sql/sql/parser/AstExpressionBuilder.java 100.00% <100.00%> (ø) 53.00 <2.00> (+2.00)
...relasticsearch/sql/sql/domain/SQLQueryRequest.java 100.00% <0.00%> (ø) 21.00% <0.00%> (-1.00%)
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c1107bb...1545188. Read the comment docs.

@chloe-zh chloe-zh marked this pull request as ready for review March 8, 2021 06:22
@kaioken
Copy link

kaioken commented Apr 14, 2021

@chloe-zh this is perfect we are needed this specific feature for one of our components, any idea when this will get a release?

Thanks

@kaioken
Copy link

kaioken commented Nov 25, 2021

@chloe-zh any update on this pull?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants