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

Function BottomTypeNameToString

src/Client/BuzzHouse/AST/SQLProtoStr.cpp:795–1014  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

793}
794
795static void BottomTypeNameToString(String & ret, const uint32_t quote, const bool lcard, const BottomTypeName & btn)
796{
797 using BottomTypeNameType = BottomTypeName::BottomOneOfCase;
798 switch (btn.bottom_one_of_case())
799 {
800 case BottomTypeNameType::kIntegers: ret += Integers_Name(btn.integers()); break;
801 case BottomTypeNameType::kFloats: ret += FloatingPoints_Name(btn.floats()); break;
802 case BottomTypeNameType::kStandardString: ret += "String"; break;
803 case BottomTypeNameType::kFixedString:
804 ret += "FixedString(";
805 ret += std::to_string(std::max<uint32_t>(1, btn.fixed_string()));
806 ret += ")";
807 break;
808 case BottomTypeNameType::kDates: ret += Dates_Name(btn.dates()); break;
809 case BottomTypeNameType::kTimes: {
810 const TimeTp & tt = btn.times();
811
812 ret += Times_Name(tt.type());
813 if (tt.has_precision())
814 {
815 ret += "(";
816 ret += std::to_string(tt.precision() % UINT32_C(10));
817 ret += ")";
818 }
819 }
820 break;
821 case BottomTypeNameType::kDatetimes: {
822 const DateTimeTp & dt = btn.datetimes();
823 const bool has_precision = dt.has_precision();
824
825 ret += DateTimes_Name(dt.type());
826 if (has_precision || dt.has_timezone())
827 {
828 ret += "(";
829 if (has_precision)
830 {
831 ret += std::to_string(dt.precision() % UINT32_C(10));
832 }
833 if (dt.has_timezone())
834 {
835 if (has_precision)
836 {
837 ret += ",";
838 }
839 appendSQLStringLiteral(ret, dt.timezone());
840 }
841 ret += ")";
842 }
843 }
844 break;
845 case BottomTypeNameType::kBoolean: ret += "Bool"; break;
846 case BottomTypeNameType::kUuid: ret += "UUID"; break;
847 case BottomTypeNameType::kIPv4: ret += "IPv4"; break;
848 case BottomTypeNameType::kIPv6: ret += "IPv6"; break;
849 case BottomTypeNameType::kDecimal: {
850 const Decimal & dec = btn.decimal();
851
852 ret += "Decimal";

Callers 1

CONV_FN_QUOTEFunction · 0.85

Calls 6

appendSQLStringLiteralFunction · 0.85
AggregateParamToStringFunction · 0.85
timesMethod · 0.80
scaleMethod · 0.80
to_stringFunction · 0.50
typeMethod · 0.45

Tested by

no test coverage detected