Skip to content

Commit a0bf7ce

Browse files
qianheng-awsxinyual
authored andcommitted
Fix CalcitePPLJoinIT (#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> Signed-off-by: xinyual <xinyual@amazon.com>
1 parent 3b8130f commit a0bf7ce

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;
@@ -905,15 +906,15 @@ public QueryExpression isTrue() {
905906

906907
@Override
907908
public QueryExpression in(LiteralExpression literal) {
908-
Iterable<?> iterable = (Iterable<?>) literal.value();
909-
builder = termsQuery(getFieldReference(), iterable);
909+
Collection<?> collection = (Collection<?>) literal.value();
910+
builder = termsQuery(getFieldReference(), collection);
910911
return this;
911912
}
912913

913914
@Override
914915
public QueryExpression notIn(LiteralExpression literal) {
915-
Iterable<?> iterable = (Iterable<?>) literal.value();
916-
builder = boolQuery().mustNot(termsQuery(getFieldReference(), iterable));
916+
Collection<?> collection = (Collection<?>) literal.value();
917+
builder = boolQuery().mustNot(termsQuery(getFieldReference(), collection));
917918
return this;
918919
}
919920
}

0 commit comments

Comments
 (0)