MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / copyStringToVector

Method copyStringToVector

src/function/cast_from_string_functions.cpp:882–1054  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

880}
881
882void CastString::copyStringToVector(ValueVector* vector, uint64_t vectorPos,
883 std::string_view strVal, const CSVOption* option) {
884 auto& type = vector->dataType;
885 setVectorNull(vector, vectorPos, strVal, option);
886 if (vector->isNull(vectorPos)) {
887 return;
888 }
889 switch (type.getLogicalTypeID()) {
890 case LogicalTypeID::INT128: {
891 int128_t val = 0;
892 CastStringHelper::cast(strVal.data(), strVal.length(), val);
893 vector->setValue(vectorPos, val);
894 } break;
895 case LogicalTypeID::SERIAL:
896 case LogicalTypeID::INT64: {
897 int64_t val = 0;
898 CastStringHelper::cast(strVal.data(), strVal.length(), val);
899 vector->setValue(vectorPos, val);
900 } break;
901 case LogicalTypeID::INT32: {
902 int32_t val = 0;
903 CastStringHelper::cast(strVal.data(), strVal.length(), val);
904 vector->setValue(vectorPos, val);
905 } break;
906 case LogicalTypeID::INT16: {
907 int16_t val = 0;
908 CastStringHelper::cast(strVal.data(), strVal.length(), val);
909 vector->setValue(vectorPos, val);
910 } break;
911 case LogicalTypeID::INT8: {
912 int8_t val = 0;
913 CastStringHelper::cast(strVal.data(), strVal.length(), val);
914 vector->setValue(vectorPos, val);
915 } break;
916 case LogicalTypeID::UINT64: {
917 uint64_t val = 0;
918 CastStringHelper::cast(strVal.data(), strVal.length(), val);
919 vector->setValue(vectorPos, val);
920 } break;
921 case LogicalTypeID::UINT32: {
922 uint32_t val = 0;
923 CastStringHelper::cast(strVal.data(), strVal.length(), val);
924 vector->setValue(vectorPos, val);
925 } break;
926 case LogicalTypeID::UINT16: {
927 uint16_t val = 0;
928 CastStringHelper::cast(strVal.data(), strVal.length(), val);
929 vector->setValue(vectorPos, val);
930 } break;
931 case LogicalTypeID::UINT8: {
932 uint8_t val = 0;
933 CastStringHelper::cast(strVal.data(), strVal.length(), val);
934 vector->setValue(vectorPos, val);
935 } break;
936 case LogicalTypeID::FLOAT: {
937 float val = 0;
938 CastStringHelper::cast(strVal.data(), strVal.length(), val);
939 vector->setValue(vectorPos, val);

Callers

nothing calls this directly

Calls 9

setVectorNullFunction · 0.85
castFunction · 0.85
decimalCastFunction · 0.85
getLogicalTypeIDMethod · 0.80
lengthMethod · 0.80
isNullMethod · 0.45
dataMethod · 0.45
setValueMethod · 0.45
getPhysicalTypeMethod · 0.45

Tested by

no test coverage detected