Skip to content

Commit 18e832a

Browse files
qianheng-awspenghuo
authored andcommitted
Fix CalcitePPLJoinIT (opensearch-project#3369)
* Fix PredicateAnalyzer for in and notIn Signed-off-by: Heng Qian <qianheng@amazon.com> * Change text field to keyword since we don't support push down for that type Signed-off-by: Heng Qian <qianheng@amazon.com> --------- Signed-off-by: Heng Qian <qianheng@amazon.com>
1 parent 8a9b591 commit 18e832a

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

integ-test/src/test/resources/indexDefinitions/occupation_index_mapping.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"type": "keyword"
66
},
77
"occupation": {
8-
"type": "text"
8+
"type": "keyword"
99
},
1010
"country": {
1111
"type": "text"

integ-test/src/test/resources/indexDefinitions/state_country_index_mapping.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
}
1818
},
1919
"country": {
20-
"type": "text"
20+
"type": "keyword"
2121
},
2222
"year": {
2323
"type": "integer"

opensearch/src/main/java/org/opensearch/sql/opensearch/request/PredicateAnalyzer.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import com.google.common.base.Throwables;
4242
import com.google.common.collect.Range;
4343
import java.util.ArrayList;
44+
import java.util.Collection;
4445
import java.util.GregorianCalendar;
4546
import java.util.LinkedHashMap;
4647
import java.util.List;
@@ -897,15 +898,15 @@ public QueryExpression isTrue() {
897898

898899
@Override
899900
public QueryExpression in(LiteralExpression literal) {
900-
Iterable<?> iterable = (Iterable<?>) literal.value();
901-
builder = termsQuery(getFieldReference(), iterable);
901+
Collection<?> collection = (Collection<?>) literal.value();
902+
builder = termsQuery(getFieldReference(), collection);
902903
return this;
903904
}
904905

905906
@Override
906907
public QueryExpression notIn(LiteralExpression literal) {
907-
Iterable<?> iterable = (Iterable<?>) literal.value();
908-
builder = boolQuery().mustNot(termsQuery(getFieldReference(), iterable));
908+
Collection<?> collection = (Collection<?>) literal.value();
909+
builder = boolQuery().mustNot(termsQuery(getFieldReference(), collection));
909910
return this;
910911
}
911912
}

0 commit comments

Comments
 (0)