diff --git a/src/main/java/net/snowflake/client/core/arrow/AbstractArrowVectorConverter.java b/src/main/java/net/snowflake/client/core/arrow/AbstractArrowVectorConverter.java index e290831b8..c47050e64 100644 --- a/src/main/java/net/snowflake/client/core/arrow/AbstractArrowVectorConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/AbstractArrowVectorConverter.java @@ -146,9 +146,9 @@ public BigDecimal toBigDecimal(int index) throws SFException { ErrorCode.INVALID_VALUE_CONVERT, logicalTypeStr, SnowflakeUtil.BIG_DECIMAL_STR, ""); } - public boolean shouldTreatDecimalAsInt(){ + public boolean shouldTreatDecimalAsInt() { if (!context.getSession().isJdbcArrowTreatDecimalAsInt() - && !context.getSession().isJdbcTreatDecimalAsInt()) { + && !context.getSession().isJdbcTreatDecimalAsInt()) { return false; } return true; diff --git a/src/test/java/net/snowflake/client/jdbc/ResultSetLatestIT.java b/src/test/java/net/snowflake/client/jdbc/ResultSetLatestIT.java index 5efa4534f..aa3bb9909 100644 --- a/src/test/java/net/snowflake/client/jdbc/ResultSetLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/ResultSetLatestIT.java @@ -980,8 +980,9 @@ public void testLargeStringRetrieval() throws SQLException { } } - private static void assertAllColumnsAreLongButBigIntIsBigDecimal(ResultSet rs) throws SQLException { - while(rs.next()) { + private static void assertAllColumnsAreLongButBigIntIsBigDecimal(ResultSet rs) + throws SQLException { + while (rs.next()) { assertEquals("class java.lang.Long", rs.getObject(1).getClass().toString()); assertEquals("class java.math.BigDecimal", rs.getObject(2).getClass().toString()); assertEquals("class java.lang.Long", rs.getObject(3).getClass().toString()); @@ -998,13 +999,14 @@ private static void assertAllColumnsAreBigDecimal(ResultSet rs) throws SQLExcept } } - // Test setting new connection property jdbc_arrow_treat_decimal_as_int=false. Connection property introduced after version 3.15.0. + // Test setting new connection property jdbc_arrow_treat_decimal_as_int=false. Connection property + // introduced after version 3.15.0. @Test public void testGetObjectForArrowResultFormatJDBCArrowDecimalAsIntFalse() throws SQLException { Properties properties = new Properties(); properties.put("jdbc_arrow_treat_decimal_as_int", false); try (Connection con = getConnection(properties); - Statement stmt = con.createStatement()) { + Statement stmt = con.createStatement()) { stmt.execute("alter session set jdbc_query_result_format = 'ARROW'"); stmt.execute(createTableSql); stmt.execute(insertStmt); @@ -1022,18 +1024,19 @@ public void testGetObjectForArrowResultFormatJDBCArrowDecimalAsIntFalse() throws } } - // Test default setting of new connection property jdbc_arrow_treat_decimal_as_int=true. Connection property introduced after version 3.15.0. + // Test default setting of new connection property jdbc_arrow_treat_decimal_as_int=true. + // Connection property introduced after version 3.15.0. @Test public void testGetObjectForArrowResultFormatJDBCArrowDecimalAsIntTrue() throws SQLException { try (Connection con = BaseJDBCTest.getConnection(); - Statement stmt = con.createStatement()) { + Statement stmt = con.createStatement()) { stmt.execute("alter session set jdbc_query_result_format = 'ARROW'"); stmt.execute(createTableSql); stmt.execute(insertStmt); // Test with jdbc_arrow_treat_decimal_as_int=true and JDBC_TREAT_DECIMAL_AS_INT=true try (ResultSet rs = stmt.executeQuery(selectQuery)) { - while(rs.next()) { + while (rs.next()) { assertEquals("class java.lang.Long", rs.getObject(1).getClass().toString()); assertEquals("class java.math.BigDecimal", rs.getObject(2).getClass().toString()); assertEquals("class java.lang.Long", rs.getObject(3).getClass().toString()); @@ -1049,7 +1052,8 @@ public void testGetObjectForArrowResultFormatJDBCArrowDecimalAsIntTrue() throws } } - // Test getObject for numeric types when JDBC_TREAT_DECIMAL_AS_INT is set and using JSON result format. + // Test getObject for numeric types when JDBC_TREAT_DECIMAL_AS_INT is set and using JSON result + // format. @Test public void testGetObjectForJSONResultFormatJDBCDecimalAsIntFalse() throws SQLException { try (Connection con = BaseJDBCTest.getConnection();