Apply suggestions from code review

Co-authored-by: János Benjamin Antal <antaljanosbenjamin@users.noreply.github.com>
This commit is contained in:
Kruglov Pavel 2023-08-10 13:21:11 +02:00 committed by GitHub
parent 33a39900ad
commit bb38918a26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -417,7 +417,7 @@ std::optional<std::pair<std::vector<String>, 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<DataTypes> CSVSchemaReader::readRowAndGetDataTypesImpl()

View File

@ -388,7 +388,7 @@ std::optional<std::pair<std::vector<String>, 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<DataTypes> CustomSeparatedSchemaReader::readRowAndGetDataTypesImpl()

View File

@ -425,7 +425,7 @@ void FormatWithNamesAndTypesSchemaReader::tryDetectHeader(std::vector<String> &
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<String> &
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));