diff --git a/src/Processors/Formats/Impl/JSONColumnsWithMetadataBlockInputFormat.cpp b/src/Processors/Formats/Impl/JSONColumnsWithMetadataBlockInputFormat.cpp index 23c6114fb39..572b3b0703f 100644 --- a/src/Processors/Formats/Impl/JSONColumnsWithMetadataBlockInputFormat.cpp +++ b/src/Processors/Formats/Impl/JSONColumnsWithMetadataBlockInputFormat.cpp @@ -60,7 +60,7 @@ void registerInputFormatJSONColumnsWithMetadata(FormatFactory & factory) factory.registerInputFormat( "JSONColumnsWithMetadata", [](ReadBuffer & buf, - const Block &sample, + const Block & sample, const RowInputFormatParams &, const FormatSettings & settings) { diff --git a/src/Processors/Formats/Impl/JSONColumnsWithMetadataBlockInputFormat.h b/src/Processors/Formats/Impl/JSONColumnsWithMetadataBlockInputFormat.h index 9a6ed79c522..265f76a74c1 100644 --- a/src/Processors/Formats/Impl/JSONColumnsWithMetadataBlockInputFormat.h +++ b/src/Processors/Formats/Impl/JSONColumnsWithMetadataBlockInputFormat.h @@ -15,7 +15,7 @@ public: bool checkChunkEnd() override; private: - const Block & header; + const Block header; const bool validate_types_from_metadata; }; diff --git a/tests/queries/0_stateless/02982_json_columns_with_metadata_http.reference b/tests/queries/0_stateless/02982_json_columns_with_metadata_http.reference new file mode 100644 index 00000000000..d03bf4df6cb --- /dev/null +++ b/tests/queries/0_stateless/02982_json_columns_with_metadata_http.reference @@ -0,0 +1,3 @@ +1 4 +2 5 +3 6 diff --git a/tests/queries/0_stateless/02982_json_columns_with_metadata_http.sh b/tests/queries/0_stateless/02982_json_columns_with_metadata_http.sh new file mode 100755 index 00000000000..41c06ceae61 --- /dev/null +++ b/tests/queries/0_stateless/02982_json_columns_with_metadata_http.sh @@ -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" +