MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / insertString

Function insertString

src/Processors/Formats/Impl/MsgPackRowInputFormat.cpp:215–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213}
214
215static void insertString(IColumn & column, DataTypePtr type, const char * value, size_t size, bool bin)
216{
217 auto insert_func = [&](IColumn & column_, DataTypePtr type_)
218 {
219 insertString(column_, type_, value, size, bin);
220 };
221
222 if (checkAndInsertNullable(column, type, insert_func) || checkAndInsertLowCardinality(column, type, insert_func))
223 return;
224
225 if (isUUID(type))
226 {
227 ReadBufferFromMemory buf(value, size);
228 UUID uuid;
229 if (bin)
230 readBinary(uuid, buf);
231 else
232 readUUIDText(uuid, buf);
233
234 assert_cast<ColumnUUID &>(column).insertValue(uuid);
235 return;
236 }
237
238 if (bin)
239 {
240 switch (type->getTypeId())
241 {
242 case TypeIndex::IPv6:
243 insertFromBinaryRepresentation<ColumnIPv6>(column, type, value, size);
244 return;
245 case TypeIndex::Int128:
246 insertFromBinaryRepresentation<ColumnInt128>(column, type, value, size);
247 return;
248 case TypeIndex::UInt128:
249 insertFromBinaryRepresentation<ColumnUInt128>(column, type, value, size);
250 return;
251 case TypeIndex::Int256:
252 insertFromBinaryRepresentation<ColumnInt256>(column, type, value, size);
253 return;
254 case TypeIndex::UInt256:
255 insertFromBinaryRepresentation<ColumnUInt256>(column, type, value, size);
256 return;
257 case TypeIndex::Decimal128:
258 insertFromBinaryRepresentation<ColumnDecimal<Decimal128>>(column, type, value, size);
259 return;
260 case TypeIndex::Decimal256:
261 insertFromBinaryRepresentation<ColumnDecimal<Decimal256>>(column, type, value, size);
262 return;
263 default:
264 break;
265 }
266 }
267
268 if (!isStringOrFixedString(type))
269 throw Exception(ErrorCodes::ILLEGAL_COLUMN, "Cannot insert MessagePack string into column with type {}.", type->getName());
270
271 column.insertData(value, size);
272}

Callers 2

visit_strMethod · 0.85
visit_binMethod · 0.85

Calls 9

checkAndInsertNullableFunction · 0.85
readUUIDTextFunction · 0.85
readBinaryFunction · 0.50
ExceptionClass · 0.50
insertValueMethod · 0.45
getTypeIdMethod · 0.45
getNameMethod · 0.45
insertDataMethod · 0.45

Tested by

no test coverage detected