From 6fd955aad539f8a18af9c6634db61268528da1df Mon Sep 17 00:00:00 2001 From: Dominik Przybysz Date: Mon, 4 Nov 2024 13:21:30 +0100 Subject: [PATCH] SNOW-1782852: Testing arrow too many rows --- .../client/jdbc/ResultSetArrowLatestIT.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/test/java/net/snowflake/client/jdbc/ResultSetArrowLatestIT.java b/src/test/java/net/snowflake/client/jdbc/ResultSetArrowLatestIT.java index 4ea7f7d8f..4e02849ad 100644 --- a/src/test/java/net/snowflake/client/jdbc/ResultSetArrowLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/ResultSetArrowLatestIT.java @@ -3,7 +3,14 @@ */ package net.snowflake.client.jdbc; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; import net.snowflake.client.category.TestCategoryArrow; +import org.junit.Test; import org.junit.experimental.categories.Category; /** @@ -15,4 +22,27 @@ public class ResultSetArrowLatestIT extends ResultSetLatestIT { public ResultSetArrowLatestIT() { super("arrow"); } + + // TODO move to parent - for now we only want to test ARROW + @Test + public void testChunkedResultSetHasExpectedNumberOfRows() throws SQLException { + int rowsToGet = 8295305; + int count = 0; + long seq8 = -1; + try (Statement statement = connection.createStatement(); + ResultSet resultSet = + statement.executeQuery( + "select randstr(20,random()), seq8() as s from table(generator(rowcount=>" + + rowsToGet + + ")) where 1=1 and s >= 0 " + + "order by s")) { + while (resultSet.next()) { + count++; + long newSeq8 = resultSet.getLong(2); + assertTrue(seq8 < newSeq8); + seq8 = newSeq8; + } + } + assertEquals(rowsToGet, count); + } }