mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-15 12:14:18 +00:00
Merge pull request #71193 from Avogar/native-http-async-insert-settings
Fix ignoring format settings in Native format via HTTP and Async Inserts
This commit is contained in:
commit
1a2b5686c4
@ -15,16 +15,17 @@ namespace DB
|
||||
class NativeInputFormat final : public IInputFormat
|
||||
{
|
||||
public:
|
||||
NativeInputFormat(ReadBuffer & buf, const Block & header_, const FormatSettings & settings)
|
||||
NativeInputFormat(ReadBuffer & buf, const Block & header_, const FormatSettings & settings_)
|
||||
: IInputFormat(header_, &buf)
|
||||
, reader(std::make_unique<NativeReader>(
|
||||
buf,
|
||||
header_,
|
||||
0,
|
||||
settings,
|
||||
settings.defaults_for_omitted_fields ? &block_missing_values : nullptr))
|
||||
settings_,
|
||||
settings_.defaults_for_omitted_fields ? &block_missing_values : nullptr))
|
||||
, header(header_)
|
||||
, block_missing_values(header.columns())
|
||||
, settings(settings_)
|
||||
{
|
||||
}
|
||||
|
||||
@ -55,7 +56,7 @@ public:
|
||||
|
||||
void setReadBuffer(ReadBuffer & in_) override
|
||||
{
|
||||
reader = std::make_unique<NativeReader>(in_, header, 0);
|
||||
reader = std::make_unique<NativeReader>(in_, header, 0, settings, settings.defaults_for_omitted_fields ? &block_missing_values : nullptr);
|
||||
IInputFormat::setReadBuffer(in_);
|
||||
}
|
||||
|
||||
@ -67,6 +68,7 @@ private:
|
||||
std::unique_ptr<NativeReader> reader;
|
||||
Block header;
|
||||
BlockMissingValues block_missing_values;
|
||||
const FormatSettings settings;
|
||||
size_t approx_bytes_read_for_chunk = 0;
|
||||
};
|
||||
|
||||
|
@ -4193,7 +4193,7 @@ def test_kafka_formats_with_broken_message(kafka_cluster, create_query_generator
|
||||
],
|
||||
"expected": {
|
||||
"raw_message": "050102696405496E743634000000000000000007626C6F636B4E6F06537472696E67034241440476616C3106537472696E6702414D0476616C3207466C6F617433320000003F0476616C330555496E743801",
|
||||
"error": "Cannot convert: String to UInt16",
|
||||
"error": "Cannot parse string 'BAD' as UInt16",
|
||||
},
|
||||
"printable": False,
|
||||
},
|
||||
|
@ -0,0 +1 @@
|
||||
0
|
17
tests/queries/0_stateless/03259_native_http_async_insert_settings.sh
Executable file
17
tests/queries/0_stateless/03259_native_http_async_insert_settings.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/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) engine=Memory";
|
||||
|
||||
url="${CLICKHOUSE_URL}&async_insert=1&wait_for_async_insert=1"
|
||||
|
||||
$CLICKHOUSE_LOCAL -q "select NULL::Nullable(UInt32) as x format Native" | ${CLICKHOUSE_CURL} -sS "$url&query=INSERT%20INTO%20test%20FORMAT%20Native" --data-binary @-
|
||||
|
||||
$CLICKHOUSE_CLIENT -q "select * from test";
|
||||
$CLICKHOUSE_CLIENT -q "drop table test"
|
||||
|
Loading…
Reference in New Issue
Block a user