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

Function decodeDataType

src/DataTypes/DataTypesBinaryEncoding.cpp:562–848  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

560}
561
562static DataTypePtr decodeDataType(ReadBuffer & buf, size_t & complexity)
563{
564 ++complexity;
565 size_t max_complexity = getMaxTypeDecodingComplexity();
566 if (max_complexity > 0 && complexity > max_complexity)
567 throw Exception(ErrorCodes::INCORRECT_DATA, "Binary type decoding complexity limit exceeded: {} > {} (adjust input_format_binary_max_type_complexity)", complexity, max_complexity);
568 if (complexity % 128 == 0)
569 checkStackSize();
570
571 UInt8 type = 0;
572 readBinary(type, buf);
573 auto binary_type_index = static_cast<BinaryTypeIndex>(type);
574
575 switch (binary_type_index)
576 {
577 case BinaryTypeIndex::Nothing:
578 case BinaryTypeIndex::UInt8:
579 case BinaryTypeIndex::Bool:
580 case BinaryTypeIndex::UInt16:
581 case BinaryTypeIndex::UInt32:
582 case BinaryTypeIndex::UInt64:
583 case BinaryTypeIndex::UInt128:
584 case BinaryTypeIndex::UInt256:
585 case BinaryTypeIndex::Int8:
586 case BinaryTypeIndex::Int16:
587 case BinaryTypeIndex::Int32:
588 case BinaryTypeIndex::Int64:
589 case BinaryTypeIndex::Int128:
590 case BinaryTypeIndex::Int256:
591 case BinaryTypeIndex::BFloat16:
592 case BinaryTypeIndex::Float32:
593 case BinaryTypeIndex::Float64:
594 case BinaryTypeIndex::Date:
595 case BinaryTypeIndex::Date32:
596 case BinaryTypeIndex::String:
597 case BinaryTypeIndex::UUID:
598 case BinaryTypeIndex::IPv4:
599 case BinaryTypeIndex::IPv6:
600 return getSimpleDataTypesCache().getType(binary_type_index);
601 case BinaryTypeIndex::DateTimeUTC:
602 return std::make_shared<DataTypeDateTime>();
603 case BinaryTypeIndex::DateTimeWithTimezone:
604 {
605 String time_zone;
606 readStringBinary(time_zone, buf);
607 return std::make_shared<DataTypeDateTime>(time_zone);
608 }
609 case BinaryTypeIndex::DateTime64UTC:
610 {
611 UInt8 scale = 0;
612 readBinary(scale, buf);
613 return std::make_shared<DataTypeDateTime64>(scale);
614 }
615 case BinaryTypeIndex::DateTime64WithTimezone:
616 {
617 UInt8 scale = 0;
618 readBinary(scale, buf);
619 String time_zone;

Callers 15

deserializeSetsMethod · 0.85
deserializeHeaderFunction · 0.85
deserializeMethod · 0.85
readTypesMethod · 0.85
addMethod · 0.85
addWholeColumnMethod · 0.85
getMethod · 0.85
getValueNameImplMethod · 0.85
doInsertFromMethod · 0.85
doInsertRangeFromMethod · 0.85
doInsertManyFromMethod · 0.85

Calls 15

checkStackSizeFunction · 0.85
readStringBinaryFunction · 0.85
IntervalKindClass · 0.85
decodeAggregateFunctionFunction · 0.85
createNestedFunction · 0.85
ExceptionClass · 0.50
readBinaryFunction · 0.50
KindEnum · 0.50
getTypeMethod · 0.45
reserveMethod · 0.45

Tested by 2

checkFunction · 0.68