Skip to content

Commit

Permalink
SQL: [Test] Fix JdbcPreparedStatement date test
Browse files Browse the repository at this point in the history
Use `ORDER BY` to ensure order of the rows since more
than are returned in the testDate().

Follows: #56492
(cherry picked from commit 0053a1c)
  • Loading branch information
matriv committed May 12, 2020
1 parent 16f2d74 commit 78cef7e
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ public void testDate() throws IOException, SQLException {
setupIndexForDateTimeTests(randomMillis);

try (Connection connection = esJdbc()) {
try (PreparedStatement statement = connection.prepareStatement("SELECT id, birth_date FROM emps WHERE birth_date::date = ?")) {
try (PreparedStatement statement = connection.prepareStatement("SELECT id, birth_date FROM emps WHERE birth_date::date = ? " +
"ORDER BY id")) {

statement.setDate(1, new Date(asDate(randomMillis, UTC).getTime()));
try (ResultSet results = statement.executeQuery()) {
for (int i = 1; i <= 3; i++) {
Expand Down

0 comments on commit 78cef7e

Please sign in to comment.