Skip to content

Commit

Permalink
Adding IT test for nested all fields in invalid clause of SQL statement.
Browse files Browse the repository at this point in the history
Signed-off-by: forestmvey <[email protected]>
  • Loading branch information
forestmvey committed Jun 26, 2023
1 parent 04dcea2 commit 14ad058
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions integ-test/src/test/java/org/opensearch/sql/sql/NestedIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -501,4 +501,23 @@ public void nested_function_all_subfields_and_non_nested_field() {
rows("i", 5, "a", 4),
rows("zz", 6, "zz", new JSONArray(List.of(3, 4))));
}

@Test
public void nested_function_all_subfields_in_wrong_clause() {
String query = "SELECT * FROM " + TEST_INDEX_NESTED_TYPE + " ORDER BY nested(message.*)";

Exception exception = assertThrows(RuntimeException.class, () ->
executeJdbcRequest(query));

assertTrue(exception.getMessage().contains("" +
"{\n" +
" \"error\": {\n" +
" \"reason\": \"There was internal problem at backend\",\n" +
" \"details\": \"Invalid use of expression nested(message.*)\",\n" +
" \"type\": \"UnsupportedOperationException\"\n" +
" },\n" +
" \"status\": 503\n" +
"}"
));
}
}

0 comments on commit 14ad058

Please sign in to comment.