From 5c97d43a538cab89e68a85a3c13e7ab55a2f739f Mon Sep 17 00:00:00 2001 From: forestmvey Date: Wed, 21 Jun 2023 14:06:17 -0700 Subject: [PATCH] Adding schema validation for IT test, and another UT for nested arrays. Signed-off-by: forestmvey --- .../test/java/org/opensearch/sql/sql/NestedIT.java | 3 +++ .../data/value/OpenSearchExprValueFactoryTest.java | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/integ-test/src/test/java/org/opensearch/sql/sql/NestedIT.java b/integ-test/src/test/java/org/opensearch/sql/sql/NestedIT.java index b86616d511..80886fe779 100644 --- a/integ-test/src/test/java/org/opensearch/sql/sql/NestedIT.java +++ b/integ-test/src/test/java/org/opensearch/sql/sql/NestedIT.java @@ -375,6 +375,9 @@ public void nested_function_with_date_types_as_object_arrays_within_arrays_test( JSONObject result = executeJdbcRequest(query); assertEquals(11, result.getInt("total")); + verifySchema(result, + schema("nested(address.moveInDate)", null, "object") + ); verifyDataRows(result, rows(new JSONObject(Map.of("dateAndTime","1984-04-12 09:07:42"))), rows(new JSONArray( diff --git a/opensearch/src/test/java/org/opensearch/sql/opensearch/data/value/OpenSearchExprValueFactoryTest.java b/opensearch/src/test/java/org/opensearch/sql/opensearch/data/value/OpenSearchExprValueFactoryTest.java index 27ded89f7d..a7e3531e8b 100644 --- a/opensearch/src/test/java/org/opensearch/sql/opensearch/data/value/OpenSearchExprValueFactoryTest.java +++ b/opensearch/src/test/java/org/opensearch/sql/opensearch/data/value/OpenSearchExprValueFactoryTest.java @@ -452,6 +452,19 @@ public void constructNestedArraysOfStringsReturnsFirstIndex() { ).get("stringV")); } + @Test + public void constructMultiNestedArraysOfStringsReturnsFirstIndex() { + assertEquals( + stringValue("z"), + tupleValue( + "{\"stringV\":" + + "[\"z\"," + + "[\"s\"]," + + "[\"zz\", \"au\"]" + + "]}" + ).get("stringV")); + } + @Test public void constructArrayOfInts() { assertEquals(new ExprCollectionValue(