Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ private String getAsString(JsonElement value) {
valueStr = value.getAsString();
} else if (value.isJsonArray()) {
valueStr = arrayToString(value);
} else if (value.isJsonNull()){
valueStr = null;
} else {
throw new IllegalArgumentException("unexpected jsonElementType: " + value.toString());
valueStr = value.toString();
}
return valueStr;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,16 @@ public void testJsonResponse() throws SQLException {
}
}

@Test(groups = "integration")
public void testJsonResponseWithNull() throws SQLException {
try (ClickHouseStatement s = connection.createStatement()) {
ClickHouseResponse response = s.executeQueryClickhouseResponse(
"SELECT 1 AS one, 0/0 AS n");
assertNotNull(response);
assertEquals(response.getData(), Collections.singletonList(Arrays.asList("1", null)));
}
}

private static String readQueryId(ClickHouseStatementImpl stmt, long timeoutSecs) {
long start = System.currentTimeMillis();
String value;
Expand Down