Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/function/cast_from_string_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,7 @@ void CastString::copyStringToVector(ValueVector* vector, uint64_t vectorPos,
CastStringHelper::cast(strVal.data(), strVal.length(), val);
vector->setValue(vectorPos, val.value);
} break;
case LogicalTypeID::JSON:
case LogicalTypeID::STRING: {
if (!utf8proc::Utf8Proc::isValid(strVal.data(), strVal.length())) {
throw ConversionException{"Invalid UTF8-encoded string."};
Expand Down
3 changes: 3 additions & 0 deletions test/test_files/cast/cast_to_nested_types.test
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ Conversion exception: Map does not allow duplicate keys.
-STATEMENT RETURN cast("{12=34}", "MAP(UINT8, UINT16)"), cast("{12=}", "MAP(UINT32, UINT64)"), cast("{=43}", "MAP(INT8, INT16)"), cast("{=}", "MAP(INT32, INT64)"), cast("{12=12}", "MAP(float, double)");
---- error
Conversion exception: Map does not allow null as key.
-STATEMENT RETURN cast('{k={"val":1}}', 'MAP(STRING, JSON)'), cast(null, 'MAP(STRING, JSON)'), cast('{}', 'MAP(STRING, JSON)')
---- 1
{k={"val":1}}||{}

-LOG CastToStruct
-STATEMENT RETURN cast("{ a : { b : {c:[ 3432423 ,-43423 ,31231 ,NULL ]} } } ", "STRUCT(a STRUCT(b STRUCT(c INT64[])))"), cast("{ a : { b : {c:[]} } } ", "STRUCT(a STRUCT(b STRUCT(c INT64[])))"), cast("{ a : { b : {c:} } } ", "STRUCT(a STRUCT(b STRUCT(c INT64[])))"), cast("{ a : { b : {} } } ", "STRUCT(a STRUCT(b STRUCT(c INT64[])))"), cast("{ a : {} } ", "STRUCT(a STRUCT(b STRUCT(c INT64[])))"), cast("{} ", "STRUCT(a STRUCT(b STRUCT(c INT64[])))");
Expand Down
Loading