Skip to content

Commit b69d9e7

Browse files
author
Paultagoras
committed
Update RowBinaryFormatWriterTest.java
1 parent 5280c6f commit b69d9e7

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

client-v2/src/test/java/com/clickhouse/client/datatypes/RowBinaryFormatWriterTest.java

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ private static void assertEqualsKinda(Object actual, Object expected) {
8484
expected = ((ZonedDateTime) expected).toInstant().getEpochSecond();
8585
}
8686

87+
if (actual instanceof Object[]) {
88+
actual = List.of((Object[]) actual);
89+
}
90+
91+
if (expected instanceof Object[]) {
92+
expected = List.of((Object[]) expected);
93+
}
94+
8795
assertEquals(String.valueOf(actual), String.valueOf(expected));
8896
}
8997

@@ -225,7 +233,7 @@ public void writeNumbersTest() throws Exception {
225233

226234
@Test (groups = { "integration" })
227235
public void writeStringsTest() throws Exception {
228-
String tableName = "rowBinaryFormatWriterTest_writeNumbersTest_" + UUID.randomUUID().toString().replace('-', '_');
236+
String tableName = "rowBinaryFormatWriterTest_writeStringsTests_" + UUID.randomUUID().toString().replace('-', '_');
229237
String tableCreate = "CREATE TABLE \"" + tableName + "\" " +
230238
" (id Int32, " +
231239
" string String, string_nullable Nullable(String), string_default String DEFAULT '3', " +
@@ -259,7 +267,7 @@ public void writeStringsTest() throws Exception {
259267

260268
@Test (groups = { "integration" })
261269
public void writeDatetimeTests() throws Exception {
262-
String tableName = "rowBinaryFormatWriterTest_writeNumbersTest_" + UUID.randomUUID().toString().replace('-', '_');
270+
String tableName = "rowBinaryFormatWriterTest_writeDatetimeTests_" + UUID.randomUUID().toString().replace('-', '_');
263271
String tableCreate = "CREATE TABLE \"" + tableName + "\" " +
264272
" (id Int32, " +
265273
" datetime DateTime, datetime_nullable Nullable(DateTime), datetime_default DateTime DEFAULT '2020-01-01 00:00:00', " +
@@ -280,4 +288,22 @@ public void writeDatetimeTests() throws Exception {
280288

281289
writeTest(tableName, tableCreate, rows);
282290
}
291+
292+
@Test (groups = { "integration" })
293+
public void writeTupleTests() throws Exception {
294+
String tableName = "rowBinaryFormatWriterTest_writeTuplesTests_" + UUID.randomUUID().toString().replace('-', '_');
295+
String tableCreate = "CREATE TABLE \"" + tableName + "\" " +
296+
" (id Int32, " +
297+
" tuple Tuple(Int8, Int16), tuple_default Tuple(Int8, Int16) DEFAULT (3, 4), " +
298+
" ) Engine = MergeTree ORDER BY id";
299+
300+
// Insert random (valid) values
301+
Field[][] rows = new Field[][] {{
302+
new Field("id", 1), //Row ID
303+
new Field("tuple", List.of((byte) 1, (short) 2)).set(new Object[]{(byte) 1, (short) 2}), new Field("tuple_default").set(List.of((byte) 3, (short) 4)) //Tuple
304+
}
305+
};
306+
307+
writeTest(tableName, tableCreate, rows);
308+
}
283309
}

0 commit comments

Comments
 (0)