File tree Expand file tree Collapse file tree
integ-test/src/test/java/org/opensearch/sql/calcite/remote
opensearch/src/main/java/org/opensearch/sql/opensearch/request Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111import static org .opensearch .sql .util .MatcherUtils .rows ;
1212import static org .opensearch .sql .util .MatcherUtils .schema ;
1313import static org .opensearch .sql .util .MatcherUtils .verifyDataRows ;
14+ import static org .opensearch .sql .util .MatcherUtils .verifyErrorMessageContains ;
1415import static org .opensearch .sql .util .MatcherUtils .verifySchema ;
1516
1617import java .io .IOException ;
@@ -81,6 +82,8 @@ public void testFilterOnNestedFields() throws IOException {
8182
8283 @ Test
8384 public void testFilterOnMultipleCascadedNestedFields () throws IOException {
85+ // SQL's static type system does not allow returning list[int] in place of int
86+ enabledOnlyWhenPushdownIsEnabled ();
8487 JSONObject result =
8588 executeQuery (
8689 String .format (
@@ -119,4 +122,22 @@ public void testFilterOnMultipleCascadedNestedFields() throws IOException {
119122 "comment" ,
120123 "Too slow in places" ))))));
121124 }
125+
126+ @ Test
127+ public void testScriptFilterOnDifferentNestedHierarchyShouldThrow () throws IOException {
128+ enabledOnlyWhenPushdownIsEnabled ();
129+ Throwable t =
130+ assertThrows (
131+ Exception .class ,
132+ () ->
133+ executeQuery (
134+ String .format (
135+ "source=%s | where author.books.reviews.rating + length(author.books.title)"
136+ + " > 10" ,
137+ TEST_INDEX_CASCADED_NESTED )));
138+ verifyErrorMessageContains (
139+ t ,
140+ "Accessing multiple nested fields under different hierarchies in script is not supported:"
141+ + " [author.books.reviews, author.books]" );
142+ }
122143}
Original file line number Diff line number Diff line change @@ -1523,11 +1523,11 @@ public QueryBuilder builder() {
15231523 .distinct ()
15241524 .collect (Collectors .toUnmodifiableList ());
15251525 if (nestedPaths .size () > 1 ) {
1526- throw new UnsupportedOperationException (
1526+ throw new UnsupportedScriptException (
15271527 String .format (
15281528 Locale .ROOT ,
1529- "Accessing multiple nested fields under different hierarchies is not supported: "
1530- + " %s" ,
1529+ "Accessing multiple nested fields under different hierarchies in script is not"
1530+ + " supported: %s" ,
15311531 nestedPaths ));
15321532 }
15331533 if (!nestedPaths .isEmpty ()) {
You can’t perform that action at this time.
0 commit comments