add fields to table system.formats

This commit is contained in:
Anton Popov 2023-01-23 02:04:31 +00:00
parent 97900e9613
commit 8a39337c7c
4 changed files with 13 additions and 1 deletions

View File

@ -12,6 +12,8 @@ NamesAndTypesList StorageSystemFormats::getNamesAndTypes()
{"name", std::make_shared<DataTypeString>()}, {"name", std::make_shared<DataTypeString>()},
{"is_input", std::make_shared<DataTypeUInt8>()}, {"is_input", std::make_shared<DataTypeUInt8>()},
{"is_output", std::make_shared<DataTypeUInt8>()}, {"is_output", std::make_shared<DataTypeUInt8>()},
{"supports_parallel_parsing", std::make_shared<DataTypeUInt8>()},
{"supports_parallel_formatting", std::make_shared<DataTypeUInt8>()},
}; };
} }
@ -23,9 +25,14 @@ void StorageSystemFormats::fillData(MutableColumns & res_columns, ContextPtr, co
const auto & [format_name, creators] = pair; const auto & [format_name, creators] = pair;
UInt64 has_input_format(creators.input_creator != nullptr); UInt64 has_input_format(creators.input_creator != nullptr);
UInt64 has_output_format(creators.output_creator != nullptr); UInt64 has_output_format(creators.output_creator != nullptr);
UInt64 supports_parallel_parsing(creators.file_segmentation_engine != nullptr);
UInt64 supports_parallel_formatting(creators.supports_parallel_formatting);
res_columns[0]->insert(format_name); res_columns[0]->insert(format_name);
res_columns[1]->insert(has_input_format); res_columns[1]->insert(has_input_format);
res_columns[2]->insert(has_output_format); res_columns[2]->insert(has_output_format);
res_columns[3]->insert(supports_parallel_parsing);
res_columns[4]->insert(supports_parallel_formatting);
} }
} }

View File

@ -266,7 +266,9 @@ CREATE TABLE system.formats
( (
`name` String, `name` String,
`is_input` UInt8, `is_input` UInt8,
`is_output` UInt8 `is_output` UInt8,
`supports_parallel_parsing` UInt8,
`supports_parallel_formatting` UInt8
) )
ENGINE = SystemFormats ENGINE = SystemFormats
COMMENT 'SYSTEM TABLE is built on the fly.' COMMENT 'SYSTEM TABLE is built on the fly.'

View File

@ -0,0 +1,2 @@
CSV 1 1 1 1
Parquet 1 1 0 0

View File

@ -0,0 +1 @@
SELECT * FROM system.formats WHERE name IN ('CSV', 'Parquet') ORDER BY name;