From 8a39337c7cb9fd2b4ffb839916b132fc8e8435a6 Mon Sep 17 00:00:00 2001 From: Anton Popov Date: Mon, 23 Jan 2023 02:04:31 +0000 Subject: [PATCH] add fields to table system.formats --- src/Storages/System/StorageSystemFormats.cpp | 7 +++++++ .../0_stateless/02117_show_create_table_system.reference | 4 +++- tests/queries/0_stateless/02537_system_formats.reference | 2 ++ tests/queries/0_stateless/02537_system_formats.sql | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tests/queries/0_stateless/02537_system_formats.reference create mode 100644 tests/queries/0_stateless/02537_system_formats.sql diff --git a/src/Storages/System/StorageSystemFormats.cpp b/src/Storages/System/StorageSystemFormats.cpp index b35fdd3f85e..d8a49880257 100644 --- a/src/Storages/System/StorageSystemFormats.cpp +++ b/src/Storages/System/StorageSystemFormats.cpp @@ -12,6 +12,8 @@ NamesAndTypesList StorageSystemFormats::getNamesAndTypes() {"name", std::make_shared()}, {"is_input", std::make_shared()}, {"is_output", std::make_shared()}, + {"supports_parallel_parsing", std::make_shared()}, + {"supports_parallel_formatting", std::make_shared()}, }; } @@ -23,9 +25,14 @@ void StorageSystemFormats::fillData(MutableColumns & res_columns, ContextPtr, co const auto & [format_name, creators] = pair; UInt64 has_input_format(creators.input_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[1]->insert(has_input_format); res_columns[2]->insert(has_output_format); + res_columns[3]->insert(supports_parallel_parsing); + res_columns[4]->insert(supports_parallel_formatting); } } diff --git a/tests/queries/0_stateless/02117_show_create_table_system.reference b/tests/queries/0_stateless/02117_show_create_table_system.reference index 9e065c455e9..c4af1cdeaff 100644 --- a/tests/queries/0_stateless/02117_show_create_table_system.reference +++ b/tests/queries/0_stateless/02117_show_create_table_system.reference @@ -266,7 +266,9 @@ CREATE TABLE system.formats ( `name` String, `is_input` UInt8, - `is_output` UInt8 + `is_output` UInt8, + `supports_parallel_parsing` UInt8, + `supports_parallel_formatting` UInt8 ) ENGINE = SystemFormats COMMENT 'SYSTEM TABLE is built on the fly.' diff --git a/tests/queries/0_stateless/02537_system_formats.reference b/tests/queries/0_stateless/02537_system_formats.reference new file mode 100644 index 00000000000..9ddd7c6094a --- /dev/null +++ b/tests/queries/0_stateless/02537_system_formats.reference @@ -0,0 +1,2 @@ +CSV 1 1 1 1 +Parquet 1 1 0 0 diff --git a/tests/queries/0_stateless/02537_system_formats.sql b/tests/queries/0_stateless/02537_system_formats.sql new file mode 100644 index 00000000000..144ca28b4cf --- /dev/null +++ b/tests/queries/0_stateless/02537_system_formats.sql @@ -0,0 +1 @@ +SELECT * FROM system.formats WHERE name IN ('CSV', 'Parquet') ORDER BY name;