From 821300342268168f7721ecf3a327e91834491852 Mon Sep 17 00:00:00 2001 From: avogar Date: Fri, 29 Oct 2021 16:51:57 +0300 Subject: [PATCH] Fix PVS check, mark tests as no-parallel --- .../Serializations/SerializationNullable.cpp | 40 +++++++++---------- ...2103_tsv_csv_custom_null_representation.sh | 1 + .../02104_json_strings_nullable_string.sh | 1 + 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/DataTypes/Serializations/SerializationNullable.cpp b/src/DataTypes/Serializations/SerializationNullable.cpp index 0dbb140af8b..7bf7b6e55b0 100644 --- a/src/DataTypes/Serializations/SerializationNullable.cpp +++ b/src/DataTypes/Serializations/SerializationNullable.cpp @@ -257,7 +257,7 @@ void SerializationNullable::deserializeTextEscaped(IColumn & column, ReadBuffer template ReturnType SerializationNullable::deserializeTextEscapedImpl(IColumn & column, ReadBuffer & istr, const FormatSettings & settings, - const SerializationPtr & nested) + const SerializationPtr & nested_serialization) { const String & null_representation = settings.tsv.null_representation; @@ -265,9 +265,9 @@ ReturnType SerializationNullable::deserializeTextEscapedImpl(IColumn & column, R if (istr.eof() || (!null_representation.empty() && *istr.position() != null_representation[0])) { /// This is not null, surely. - return safeDeserialize(column, *nested, + return safeDeserialize(column, *nested_serialization, [] { return false; }, - [&nested, &istr, &settings] (IColumn & nested_column) { nested->deserializeTextEscaped(nested_column, istr, settings); }); + [&nested_serialization, &istr, &settings] (IColumn & nested_column) { nested_serialization->deserializeTextEscaped(nested_column, istr, settings); }); } /// Check if we have enough data in buffer to check if it's a null. @@ -281,11 +281,11 @@ ReturnType SerializationNullable::deserializeTextEscapedImpl(IColumn & column, R istr.position() = pos; return false; }; - auto deserialize_nested = [&nested, &settings, &istr] (IColumn & nested_column) + auto deserialize_nested = [&nested_serialization, &settings, &istr] (IColumn & nested_column) { - nested->deserializeTextEscaped(nested_column, istr, settings); + nested_serialization->deserializeTextEscaped(nested_column, istr, settings); }; - return safeDeserialize(column, *nested, check_for_null, deserialize_nested); + return safeDeserialize(column, *nested_serialization, check_for_null, deserialize_nested); } /// We don't have enough data in buffer to check if it's a null. @@ -303,10 +303,10 @@ ReturnType SerializationNullable::deserializeTextEscapedImpl(IColumn & column, R return false; }; - auto deserialize_nested = [&nested, &settings, &buf, &null_representation, &istr] (IColumn & nested_column) + auto deserialize_nested = [&nested_serialization, &settings, &buf, &null_representation, &istr] (IColumn & nested_column) { auto * pos = buf.position(); - nested->deserializeTextEscaped(nested_column, buf, settings); + nested_serialization->deserializeTextEscaped(nested_column, buf, settings); /// Check that we don't have any unread data in PeekableReadBuffer own memory. if (likely(!buf.hasUnreadData())) return; @@ -320,7 +320,7 @@ ReturnType SerializationNullable::deserializeTextEscapedImpl(IColumn & column, R "for large input.", ErrorCodes::CANNOT_READ_ALL_DATA); WriteBufferFromOwnString parsed_value; - nested->serializeTextEscaped(nested_column, nested_column.size() - 1, parsed_value, settings); + nested_serialization->serializeTextEscaped(nested_column, nested_column.size() - 1, parsed_value, settings); throw DB::ParsingException("Error while parsing \"" + std::string(pos, buf.buffer().end()) + std::string(istr.position(), std::min(size_t(10), istr.available())) + "\" as Nullable" + " at position " + std::to_string(istr.count()) + ": got \"" + std::string(pos, buf.position() - pos) + "\", which was deserialized as \"" @@ -328,7 +328,7 @@ ReturnType SerializationNullable::deserializeTextEscapedImpl(IColumn & column, R ErrorCodes::CANNOT_READ_ALL_DATA); }; - return safeDeserialize(column, *nested, check_for_null, deserialize_nested); + return safeDeserialize(column, *nested_serialization, check_for_null, deserialize_nested); } void SerializationNullable::serializeTextQuoted(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const @@ -413,15 +413,15 @@ void SerializationNullable::deserializeTextCSV(IColumn & column, ReadBuffer & is template ReturnType SerializationNullable::deserializeTextCSVImpl(IColumn & column, ReadBuffer & istr, const FormatSettings & settings, - const SerializationPtr & nested) + const SerializationPtr & nested_serialization) { const String & null_representation = settings.csv.null_representation; if (istr.eof() || (!null_representation.empty() && *istr.position() != null_representation[0])) { /// This is not null, surely. - return safeDeserialize(column, *nested, + return safeDeserialize(column, *nested_serialization, [] { return false; }, - [&nested, &istr, &settings] (IColumn & nested_column) { nested->deserializeTextCSV(nested_column, istr, settings); }); + [&nested_serialization, &istr, &settings] (IColumn & nested_column) { nested_serialization->deserializeTextCSV(nested_column, istr, settings); }); } /// Check if we have enough data in buffer to check if it's a null. @@ -435,11 +435,11 @@ ReturnType SerializationNullable::deserializeTextCSVImpl(IColumn & column, ReadB istr.position() = pos; return false; }; - auto deserialize_nested = [&nested, &settings, &istr] (IColumn & nested_column) + auto deserialize_nested = [&nested_serialization, &settings, &istr] (IColumn & nested_column) { - nested->deserializeTextCSV(nested_column, istr, settings); + nested_serialization->deserializeTextCSV(nested_column, istr, settings); }; - return safeDeserialize(column, *nested, check_for_null, deserialize_nested); + return safeDeserialize(column, *nested_serialization, check_for_null, deserialize_nested); } /// We don't have enough data in buffer to check if it's a null. @@ -457,10 +457,10 @@ ReturnType SerializationNullable::deserializeTextCSVImpl(IColumn & column, ReadB return false; }; - auto deserialize_nested = [&nested, &settings, &buf, &null_representation, &istr] (IColumn & nested_column) + auto deserialize_nested = [&nested_serialization, &settings, &buf, &null_representation, &istr] (IColumn & nested_column) { auto * pos = buf.position(); - nested->deserializeTextCSV(nested_column, buf, settings); + nested_serialization->deserializeTextCSV(nested_column, buf, settings); /// Check that we don't have any unread data in PeekableReadBuffer own memory. if (likely(!buf.hasUnreadData())) return; @@ -475,7 +475,7 @@ ReturnType SerializationNullable::deserializeTextCSVImpl(IColumn & column, ReadB "for large input.", ErrorCodes::CANNOT_READ_ALL_DATA); WriteBufferFromOwnString parsed_value; - nested->serializeTextCSV(nested_column, nested_column.size() - 1, parsed_value, settings); + nested_serialization->serializeTextCSV(nested_column, nested_column.size() - 1, parsed_value, settings); throw DB::ParsingException("Error while parsing \"" + std::string(pos, buf.buffer().end()) + std::string(istr.position(), std::min(size_t(10), istr.available())) + "\" as Nullable" + " at position " + std::to_string(istr.count()) + ": got \"" + std::string(pos, buf.position() - pos) + "\", which was deserialized as \"" @@ -483,7 +483,7 @@ ReturnType SerializationNullable::deserializeTextCSVImpl(IColumn & column, ReadB ErrorCodes::CANNOT_READ_ALL_DATA); }; - return safeDeserialize(column, *nested, check_for_null, deserialize_nested); + return safeDeserialize(column, *nested_serialization, check_for_null, deserialize_nested); } void SerializationNullable::serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const diff --git a/tests/queries/0_stateless/02103_tsv_csv_custom_null_representation.sh b/tests/queries/0_stateless/02103_tsv_csv_custom_null_representation.sh index 676e8cb867f..4162e046ca4 100755 --- a/tests/queries/0_stateless/02103_tsv_csv_custom_null_representation.sh +++ b/tests/queries/0_stateless/02103_tsv_csv_custom_null_representation.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +# Tags: no-parallel CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) # shellcheck source=../shell_config.sh diff --git a/tests/queries/0_stateless/02104_json_strings_nullable_string.sh b/tests/queries/0_stateless/02104_json_strings_nullable_string.sh index 5385c1282b2..6a5d369e7b6 100755 --- a/tests/queries/0_stateless/02104_json_strings_nullable_string.sh +++ b/tests/queries/0_stateless/02104_json_strings_nullable_string.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +# Tags: no-parallel CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) # shellcheck source=../shell_config.sh