add option to disable sending metadata

This commit is contained in:
chertus 2018-07-12 17:33:57 +03:00
parent a7fcae2759
commit f89e476c0f
4 changed files with 11 additions and 4 deletions

View File

@ -313,8 +313,12 @@ void TCPHandler::processInsertQuery(const Settings & global_settings)
state.io.out->writePrefix();
/// Send query metadata (column defaults)
Block meta_block = storeContextBlock(query_context);
sendMetadata(meta_block);
if (global_settings.insert_sample_with_metadata &&
query_context.getSettingsRef().insert_sample_with_metadata)
{
Block meta_block = storeContextBlock(query_context);
sendMetadata(meta_block);
}
/// Send block to the client - table structure.
Block block = state.io.out->getHeader();

View File

@ -123,6 +123,7 @@ struct Settings
M(SettingUInt64, max_concurrent_queries_for_user, 0, "The maximum number of concurrent requests per user.") \
\
M(SettingBool, insert_deduplicate, true, "For INSERT queries in the replicated table, specifies that deduplication of insertings blocks should be preformed") \
M(SettingBool, insert_sample_with_metadata, true, "For INSERT queries, specifies that need add metadata before sample block") \
\
M(SettingUInt64, insert_quorum, 0, "For INSERT queries in the replicated table, wait writing for the specified number of replicas and linearize the addition of the data. 0 - disabled.") \
M(SettingMilliseconds, insert_quorum_timeout, 600000, "") \

View File

@ -165,6 +165,9 @@ StorageDistributed::StorageDistributed(
if (num_local_shards && remote_database == database_name && remote_table == table_name)
throw Exception("Distributed table " + table_name + " looks at itself", ErrorCodes::INFINITE_LOOP);
}
/// HACK: disable metadata for StorageDistributed queries
const_cast<Context &>(context).getSettingsRef().insert_sample_with_metadata = false;
}

View File

@ -4,10 +4,9 @@ CREATE TABLE IF NOT EXISTS test.defaults
(
x UInt32,
y UInt32,
a UInt32 DEFAULT x + y,
a DEFAULT x + y,
b Float32 DEFAULT log(1 + x + y),
c UInt32 DEFAULT 42,
d DEFAULT x + y,
e MATERIALIZED x + y,
f ALIAS x + y
) ENGINE = Memory;