Skip to content

Commit

Permalink
Always send empty array, even if underlying isn't nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
Paultagoras committed Jan 10, 2024
1 parent 6d87967 commit 30fb894
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ private void doWriteCol(Record record, Column col, ClickHousePipedOutputStream s
BinaryStreamUtils.writeNonNull(stream);
}
if (!col.isNullable() && value.getObject() == null) {
if (colType == Type.ARRAY && col.getSubType().isNullable())
if (colType == Type.ARRAY)
BinaryStreamUtils.writeNonNull(stream);
else
throw new RuntimeException(String.format("An attempt to write null into not nullable column '%s'", col.getName()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,10 @@ public void nullArrayTypeTest() {

ClickHouseSinkTask chst = new ClickHouseSinkTask();
chst.start(props);
assertThrowsExactly(RuntimeException.class, () -> chst.put(sr), "An attempt to write null into not nullable column 'arr'");
chst.put(sr);
chst.stop();

assertEquals(sr.size(), ClickHouseTestHelpers.countRows(chc, topic));
}

@Test
Expand Down

0 comments on commit 30fb894

Please sign in to comment.