yinchuanwang commented on a change in pull request #2434:
URL: https://github.com/apache/calcite/pull/2434#discussion_r650946777
##########
File path:
elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/PredicateAnalyzer.java
##########
@@ -873,8 +866,37 @@ private SimpleQueryExpression(NamedFieldExpression rel) {
builder = boolQuery().mustNot(termsQuery(getFieldReference(), iterable));
return this;
}
- }
+ @Override public QueryExpression range(LiteralExpression literal) {
+ Iterator<?> iterator = ((Iterable<?>) literal.value()).iterator();
+ BoolQueryBuilder boolQuery = boolQuery();
+ while (iterator.hasNext()) {
+ Range range = (Range) iterator.next();
Review comment:
Originally I would like to add a class 'RangeExpression' to convey the
information of 'Range Set'. When i began to implement it, i found the
'RangeExpression''s structure will be almost same with the class 'Range'. The
benefit to add a new RangeExpression looks not that much. So i just directly
return a list of 'Range' and build the rangeQueryBuilder for each Range.
However you are right and I should at least move the extraction and
transformation of the Range to a kind of utility function.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]