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 27, 2023
1 parent 91eed47 commit 4461ae8
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 @@ -570,4 +570,23 @@ public void nested_function_with_date_types_as_object_arrays_within_arrays_test(
)
);
}

@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 4461ae8

Please sign in to comment.