Skip to content

Fix crash on CAST(... AS MAP(..., JSON))#606

Merged
adsharma merged 2 commits into
LadybugDB:mainfrom
mdbenito:fix/cast-nested-json
Jun 21, 2026
Merged

Fix crash on CAST(... AS MAP(..., JSON))#606
adsharma merged 2 commits into
LadybugDB:mainfrom
mdbenito:fix/cast-nested-json

Conversation

@mdbenito

Copy link
Copy Markdown
Contributor

This PR is the "read" side of LadybugDB/ladybug-python#29.

The following:

RETURN CAST('{k={"val":1}}' AS MAP(STRING, JSON))

Yields:

RuntimeError: Assertion failed in file ".../src/function/cast_from_string_functions.cpp"
on line 1050: UNREACHABLE_CODE

The problem is in CastString::copyStringToVector, which has a missing case for LogicalTypeID::JSON. I added that and a test case covering the above and a couple of (somewhat redundant) corner cases.

@mdbenito mdbenito marked this pull request as ready for review June 21, 2026 20:01
@adsharma adsharma merged commit 7c5210f into LadybugDB:main Jun 21, 2026
4 checks passed
@mdbenito mdbenito deleted the fix/cast-nested-json branch June 22, 2026 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants