Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Fix IT issue in Opendistro 1.8 (#539)
Browse files Browse the repository at this point in the history
* fix testRegressionOnDateFormatChange

* update
  • Loading branch information
penghuo authored Jun 29, 2020
1 parent 07801b2 commit 3fd35b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -172,15 +173,16 @@ 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);
}

@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);

Expand Down Expand Up @@ -256,13 +258,11 @@ public void testRegressionOnDateFormatChange() throws IOException {
actualDateList.add(response.getJSONArray(DATAROWS).getJSONArray(0).getString(0));
}

List<String> 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"));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ public static String getDateTimeIndexMapping() {
return "{" +
" \"mappings\": {" +
" \"properties\": {" +
" \"birthday\": {" +
" \"login_time\": {" +
" \"type\": \"date\"" +
" }" +
" }" +
Expand Down

0 comments on commit 3fd35b1

Please sign in to comment.