Fix crash in JSONColumnsWithMetadata format over http

This commit is contained in:
avogar 2024-02-13 09:53:32 +00:00
parent e029021696
commit 743f2410c1
4 changed files with 19 additions and 2 deletions

View File

@ -60,7 +60,7 @@ void registerInputFormatJSONColumnsWithMetadata(FormatFactory & factory)
factory.registerInputFormat(
"JSONColumnsWithMetadata",
[](ReadBuffer & buf,
const Block &sample,
const Block & sample,
const RowInputFormatParams &,
const FormatSettings & settings)
{

View File

@ -15,7 +15,7 @@ public:
bool checkChunkEnd() override;
private:
const Block & header;
const Block header;
const bool validate_types_from_metadata;
};

View File

@ -0,0 +1,3 @@
1 4
2 5
3 6

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CUR_DIR"/../shell_config.sh
$CLICKHOUSE_CLIENT -q "drop table if exists test"
$CLICKHOUSE_CLIENT -q "create table test(x UInt32, y UInt32) engine=Memory"
echo -ne '{"meta":[{"name":"x","type":"UInt32"}, {"name":"y", "type":"UInt32"}],"data":{"x":[1,2,3],"y":[4,5,6]}}\n' | ${CLICKHOUSE_CURL} -sS "{$CLICKHOUSE_URL}&query=INSERT%20INTO%20test%20FORMAT%20JSONColumnsWithMetadata" --data-binary @-
$CLICKHOUSE_CLIENT -q "select * from test"
$CLICKHOUSE_CLIENT -q "drop table test"