Skip to content

Commit

Permalink
check-style fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-jf committed Mar 13, 2024
1 parent 5428951 commit 7bcaac6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 12 additions & 8 deletions src/test/java/net/snowflake/client/jdbc/ResultSetLatestIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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);
Expand All @@ -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());
Expand All @@ -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();
Expand Down

0 comments on commit 7bcaac6

Please sign in to comment.