From 3fd35b1e6686df686e160cc62b98e2448bec330d Mon Sep 17 00:00:00 2001 From: Peng Huo Date: Mon, 29 Jun 2020 16:24:48 -0700 Subject: [PATCH] Fix IT issue in Opendistro 1.8 (#539) * fix testRegressionOnDateFormatChange * update --- .../sql/esintgtest/CursorIT.java | 12 ++++++------ .../sql/esintgtest/TestUtils.java | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/sql/esintgtest/CursorIT.java b/src/test/java/com/amazon/opendistroforelasticsearch/sql/esintgtest/CursorIT.java index c2d3733202..716f1a7b30 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/sql/esintgtest/CursorIT.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/sql/esintgtest/CursorIT.java @@ -32,6 +32,7 @@ import static com.amazon.opendistroforelasticsearch.sql.esintgtest.TestsConstants.TEST_INDEX_ACCOUNT; import static com.amazon.opendistroforelasticsearch.sql.esintgtest.TestsConstants.TEST_INDEX_DATE_TIME; import static com.amazon.opendistroforelasticsearch.sql.esintgtest.TestsConstants.TEST_INDEX_NESTED_SIMPLE; +import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.containsString; @@ -172,7 +173,7 @@ public void validTotalResultWithAndWithoutPaginationWhereClause() throws IOExcep @Test public void validTotalResultWithAndWithoutPaginationOrderBy() throws IOException { String selectQuery = StringUtils.format( - "SELECT firstname, state FROM %s ORDER BY balance DESC ", TEST_INDEX_ACCOUNT + "SELECT firstname, balance FROM %s ORDER BY balance DESC, firstname DESC", TEST_INDEX_ACCOUNT ); verifyWithAndWithoutPaginationResponse(selectQuery + " LIMIT 2000" , selectQuery , 26); } @@ -180,7 +181,8 @@ public void validTotalResultWithAndWithoutPaginationOrderBy() throws IOException @Test public void validTotalResultWithAndWithoutPaginationWhereAndOrderBy() throws IOException { String selectQuery = StringUtils.format( - "SELECT firstname, state FROM %s WHERE balance < 25000 ORDER BY balance ASC ", TEST_INDEX_ACCOUNT + "SELECT firstname, balance FROM %s WHERE balance < 25000 ORDER BY balance ASC, firstname ASC", + TEST_INDEX_ACCOUNT ); verifyWithAndWithoutPaginationResponse(selectQuery + " LIMIT 2000" , selectQuery , 80); @@ -256,13 +258,11 @@ public void testRegressionOnDateFormatChange() throws IOException { actualDateList.add(response.getJSONArray(DATAROWS).getJSONArray(0).getString(0)); } - List expectedDateList = Arrays.asList( + assertThat(actualDateList, containsInAnyOrder( "2015-01-01 00:00:00.000", "2015-01-01 12:10:30.000", "1585882955", // by existing design, this is not formatted in MySQL standard format - "2020-04-08 06:10:30.000"); - - assertThat(actualDateList, equalTo(expectedDateList)); + "2020-04-08 06:10:30.000")); } diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/sql/esintgtest/TestUtils.java b/src/test/java/com/amazon/opendistroforelasticsearch/sql/esintgtest/TestUtils.java index f0c490dc39..2a495c622a 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/sql/esintgtest/TestUtils.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/sql/esintgtest/TestUtils.java @@ -634,7 +634,7 @@ public static String getDateTimeIndexMapping() { return "{" + " \"mappings\": {" + " \"properties\": {" + - " \"birthday\": {" + + " \"login_time\": {" + " \"type\": \"date\"" + " }" + " }" +