This is an automated email from the ASF dual-hosted git repository. xiangfu0 pushed a commit to branch codex/test-audit-jdbc-decimal-error-assertion in repository https://gitbox.apache.org/repos/asf/pinot.git
commit f8d8aba9ee7dd7dc00d4c58b23d79b5897e81a26 Author: Xiang Fu <[email protected]> AuthorDate: Sun Oct 18 23:16:10 2026 -0700 Exercise JDBC invalid decimal parsing on a valid row --- .../java/org/apache/pinot/client/PinotResultSetTest.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pinot-clients/pinot-jdbc-client/src/test/java/org/apache/pinot/client/PinotResultSetTest.java b/pinot-clients/pinot-jdbc-client/src/test/java/org/apache/pinot/client/PinotResultSetTest.java index 9965bf7e8e3..a483cdb4fcf 100644 --- a/pinot-clients/pinot-jdbc-client/src/test/java/org/apache/pinot/client/PinotResultSetTest.java +++ b/pinot-clients/pinot-jdbc-client/src/test/java/org/apache/pinot/client/PinotResultSetTest.java @@ -23,7 +23,6 @@ import java.math.BigDecimal; import java.nio.charset.StandardCharsets; import java.sql.ResultSetMetaData; import java.sql.SQLDataException; -import java.sql.SQLException; import java.sql.Timestamp; import java.sql.Types; import java.util.Arrays; @@ -45,6 +44,7 @@ import org.testng.annotations.Test; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; +import static org.testng.Assert.expectThrows; /// Tests deserialization of a ResultSet given hardcoded Pinot results. @@ -294,12 +294,11 @@ public class PinotResultSetTest { currentRow++; } - // test bad values and make sure exception is thrown - try { - pinotResultSet.getBigDecimal(6); - } catch (SQLException e) { - Assert.assertTrue(e.getMessage().contains("Unable to fetch BigDecimal value")); - } + // Read a valid row so the failure comes from parsing the date string as a decimal. + assertTrue(pinotResultSet.first()); + SQLDataException exception = expectThrows(SQLDataException.class, () -> pinotResultSet.getBigDecimal(6)); + assertTrue(exception.getMessage().contains("Unable to fetch BigDecimal value")); + assertEquals(exception.getCause().getClass(), NumberFormatException.class); } @Test --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
