Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions jdbc-v2/src/test/java/com/clickhouse/jdbc/DataTypeTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;


Expand Down Expand Up @@ -677,9 +678,10 @@ public void testLowCardinalityTypeSimpleStatement() throws SQLException {

@Test(groups = { "integration" })
public void testSimpleAggregateFunction() throws SQLException {
runQuery("CREATE TABLE test_aggregate (order Int8, "
+ "int8 Int8"
+ ") ENGINE = MergeTree ORDER BY ()");
runQuery("CREATE TABLE test_aggregate (order Int8," +
" int8 Int8," +
" val SimpleAggregateFunction(any, Nullable(Int8))" +
") ENGINE = MergeTree ORDER BY ()");

// Insert random (valid) values
long seed = System.currentTimeMillis();
Expand All @@ -688,9 +690,9 @@ public void testSimpleAggregateFunction() throws SQLException {

int int8 = rand.nextInt(256) - 128;

insertData(String.format("INSERT INTO test_aggregate VALUES ( 1, %d )", int8));
insertData(String.format("INSERT INTO test_aggregate VALUES ( 2, %d )", int8));
insertData(String.format("INSERT INTO test_aggregate VALUES ( 3, %d )", int8));
insertData(String.format("INSERT INTO test_aggregate VALUES ( 1, %d, null )", int8));
insertData(String.format("INSERT INTO test_aggregate VALUES ( 2, %d, null )", int8));
insertData(String.format("INSERT INTO test_aggregate VALUES ( 3, %d, null )", int8));

// Check the results
try (Connection conn = getConnection()) {
Expand All @@ -699,6 +701,11 @@ public void testSimpleAggregateFunction() throws SQLException {
assertTrue(rs.next());
assertEquals(rs.getInt(1), int8 * 3);
}
try (ResultSet rs = stmt.executeQuery("SELECT any(val) FROM test_aggregate")) {
assertTrue(rs.next());
assertNull(rs.getObject(1));
assertTrue(rs.wasNull());
}
}
}
}
Expand Down
Loading