MCPcopy Create free account
hub / github.com/ByConity/ByConity / deserializeImpl

Function deserializeImpl

src/DataTypes/Serializations/SerializationBool.cpp:154–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154void deserializeImpl(
155 IColumn & column, ReadBuffer & istr, const FormatSettings & settings, std::function<bool(ReadBuffer &)> check_end_of_value)
156{
157 ColumnUInt8 * col = checkAndGetDeserializeColumnType(column);
158
159 PeekableReadBuffer buf(istr);
160 buf.setCheckpoint();
161 if (checkString(settings.bool_true_representation, buf) && check_end_of_value(buf))
162 {
163 col->insert(true);
164 return;
165 }
166
167 buf.rollbackToCheckpoint();
168 if (checkString(settings.bool_false_representation, buf) && check_end_of_value(buf))
169 {
170 col->insert(false);
171 buf.dropCheckpoint();
172 if (buf.hasUnreadData())
173 throw Exception(
174 ErrorCodes::CANNOT_PARSE_BOOL,
175 "Cannot continue parsing after parsed bool value because it will result in the loss of some data. It may happen if "
176 "bool_true_representation or bool_false_representation contains some delimiters of input format");
177 return;
178 }
179
180 buf.rollbackToCheckpoint();
181 if (tryDeserializeAllVariants(col, buf) && check_end_of_value(buf))
182 {
183 buf.dropCheckpoint();
184 if (buf.hasUnreadData())
185 throw Exception(
186 ErrorCodes::CANNOT_PARSE_BOOL,
187 "Cannot continue parsing after parsed bool value because it will result in the loss of some data. It may happen if "
188 "bool_true_representation or bool_false_representation contains some delimiters of input format");
189 return;
190 }
191
192 buf.makeContinuousMemoryFromCheckpointToPos();
193 buf.rollbackToCheckpoint();
194 throw Exception(
195 ErrorCodes::CANNOT_PARSE_BOOL,
196 "Cannot parse boolean value here: '{}', should be '{}' or '{}' controlled by setting bool_true_representation and "
197 "bool_false_representation or one of "
198 "True/False/T/F/Y/N/Yes/No/On/Off/Enable/Disable/Enabled/Disabled/1/0",
199 String(buf.position(), std::min(10lu, buf.available())),
200 settings.bool_true_representation, settings.bool_false_representation);
201}
202
203}
204

Callers 15

deserializeImplMethod · 0.85
deserializeImplMethod · 0.85
deserializeImplMethod · 0.85
deserializeImplMethod · 0.85
deserializeImplMethod · 0.85
deserializeImplMethod · 0.85
deserializeBinaryMethod · 0.85
deserializeTextQuotedMethod · 0.85
deserializeWholeTextMethod · 0.85
deserializeTextCSVMethod · 0.85
deserializeTextJSONMethod · 0.85

Calls 14

setCheckpointMethod · 0.80
rollbackToCheckpointMethod · 0.80
dropCheckpointMethod · 0.80
hasUnreadDataMethod · 0.80
checkStringFunction · 0.50
ExceptionClass · 0.50
StringClass · 0.50
minFunction · 0.50
insertMethod · 0.45

Tested by

no test coverage detected