From bb38918a263dd59307c463bf038ebf0c4d28d184 Mon Sep 17 00:00:00 2001 From: Kruglov Pavel <48961922+Avogar@users.noreply.github.com> Date: Thu, 10 Aug 2023 13:21:11 +0200 Subject: [PATCH] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: János Benjamin Antal --- src/Processors/Formats/Impl/CSVRowInputFormat.cpp | 2 +- src/Processors/Formats/Impl/CustomSeparatedRowInputFormat.cpp | 2 +- src/Processors/Formats/RowInputFormatWithNamesAndTypes.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Processors/Formats/Impl/CSVRowInputFormat.cpp b/src/Processors/Formats/Impl/CSVRowInputFormat.cpp index 9092c7fceba..52f9571f962 100644 --- a/src/Processors/Formats/Impl/CSVRowInputFormat.cpp +++ b/src/Processors/Formats/Impl/CSVRowInputFormat.cpp @@ -417,7 +417,7 @@ std::optional, DataTypes>> CSVSchemaReader::readRo auto fields = reader.readRow(); auto data_types = tryInferDataTypesByEscapingRule(fields, format_settings, FormatSettings::EscapingRule::CSV); - return std::make_pair(fields, data_types); + return std::make_pair(std::move(fields), std::move(data_types)); } std::optional CSVSchemaReader::readRowAndGetDataTypesImpl() diff --git a/src/Processors/Formats/Impl/CustomSeparatedRowInputFormat.cpp b/src/Processors/Formats/Impl/CustomSeparatedRowInputFormat.cpp index ff3d6d49199..17cc88425f5 100644 --- a/src/Processors/Formats/Impl/CustomSeparatedRowInputFormat.cpp +++ b/src/Processors/Formats/Impl/CustomSeparatedRowInputFormat.cpp @@ -388,7 +388,7 @@ std::optional, DataTypes>> CustomSeparatedSchemaRe auto fields = reader.readRow(); auto data_types = tryInferDataTypesByEscapingRule(fields, reader.getFormatSettings(), reader.getEscapingRule(), &json_inference_info); - return std::make_pair(fields, data_types); + return std::make_pair(std::move(fields), std::move(data_types)); } std::optional CustomSeparatedSchemaReader::readRowAndGetDataTypesImpl() diff --git a/src/Processors/Formats/RowInputFormatWithNamesAndTypes.cpp b/src/Processors/Formats/RowInputFormatWithNamesAndTypes.cpp index 4000bd14ddc..fc2b5cd8207 100644 --- a/src/Processors/Formats/RowInputFormatWithNamesAndTypes.cpp +++ b/src/Processors/Formats/RowInputFormatWithNamesAndTypes.cpp @@ -425,7 +425,7 @@ void FormatWithNamesAndTypesSchemaReader::tryDetectHeader(std::vector & if (!first_row) return; - auto [first_row_values, first_row_types] = *first_row; + const auto & [first_row_values, first_row_types] = *first_row; /// The first row contains non String elements, it cannot be a header. if (!checkIfAllTypesAreString(first_row_types)) @@ -443,7 +443,7 @@ void FormatWithNamesAndTypesSchemaReader::tryDetectHeader(std::vector & return; } - auto [second_row_values, second_row_types] = *second_row; + const auto & [second_row_values, second_row_types] = *second_row; DataTypes data_types; bool second_row_can_be_type_names = checkIfAllTypesAreString(second_row_types) && checkIfAllValuesAreTypeNames(readNamesFromFields(second_row_values));