Skip to content

Commit

Permalink
Fixed assertions of array equality
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-astachowski committed Nov 5, 2024
1 parent 73ce0fd commit 704f86f
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.snowflake.client.jdbc;

import static net.snowflake.client.jdbc.SnowflakeUtil.EXTRA_TYPES_VECTOR;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand Down Expand Up @@ -39,7 +40,7 @@ public void testGetIntVectorAsIntArray(String queryResultFormat) throws SQLExcep
assertTrue(resultSet.next());
Integer[] result =
resultSet.unwrap(SnowflakeBaseResultSet.class).getArray(1, Integer.class);
assertEquals(vector, result);
assertArrayEquals(vector, result);
assertVectorMetadata(resultSet, 1, Types.INTEGER, 1);
}
}
Expand All @@ -54,7 +55,7 @@ public void testGetIntVectorAsLongArray(String queryResultFormat) throws SQLExce
try (ResultSet resultSet = stmt.executeQuery("select " + vectorToString(vector, "int"))) {
assertTrue(resultSet.next());
Long[] result = resultSet.unwrap(SnowflakeBaseResultSet.class).getArray(1, Long.class);
assertEquals(vector, result);
assertArrayEquals(vector, result);
assertVectorMetadata(resultSet, 1, Types.INTEGER, 1);
}
}
Expand All @@ -69,7 +70,7 @@ public void testGetFloatVectorAsFloatArray(String queryResultFormat) throws SQLE
try (ResultSet resultSet = stmt.executeQuery("select " + vectorToString(vector, "float"))) {
assertTrue(resultSet.next());
Float[] result = resultSet.unwrap(SnowflakeBaseResultSet.class).getArray(1, Float.class);
assertEquals(vector, result);
assertArrayEquals(vector, result);
assertVectorMetadata(resultSet, 1, Types.FLOAT, 1);
}
}
Expand Down Expand Up @@ -116,7 +117,7 @@ public void testGetIntVectorFromTable(String queryResultFormat) throws SQLExcept
assertTrue(resultSet.next());
Integer[] result =
resultSet.unwrap(SnowflakeBaseResultSet.class).getArray(1, Integer.class);
assertEquals(new Integer[] {3, 7}, result);
assertArrayEquals(new Integer[] {3, 7}, result);
assertVectorMetadata(resultSet, 1, Types.INTEGER, 2);
}
}
Expand All @@ -132,7 +133,7 @@ public void testGetFloatVectorFromTable(String queryResultFormat) throws SQLExce
try (ResultSet resultSet = stmt.executeQuery("select x, y from test_vector_float")) {
assertTrue(resultSet.next());
Float[] result = resultSet.unwrap(SnowflakeBaseResultSet.class).getArray(1, Float.class);
assertEquals(new Float[] {-3f, 7.1f}, result);
assertArrayEquals(new Float[] {-3f, 7.1f}, result);
assertVectorMetadata(resultSet, 1, Types.FLOAT, 2);
}
}
Expand Down

0 comments on commit 704f86f

Please sign in to comment.