Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Varchar length not honored when casting from json #24428

Open
kgpai opened this issue Jan 24, 2025 · 1 comment
Open

Varchar length not honored when casting from json #24428

kgpai opened this issue Jan 24, 2025 · 1 comment
Labels

Comments

@kgpai
Copy link
Contributor

kgpai commented Jan 24, 2025

Expected Behavior

It seems Presto doesnt honor the length specified when casting json to varchar ; Might be true for other casts too, but I havent verified.

SELECT CAST(json_parse(x) as varchar(1)) from (values '"abcedef"') t(x)

-- output: abcdef 
-- expected: a

SELECT CAST(json_parse(x) as varchar(0)) from (values '"abcedef"') t(x)

-- output: abcdef 
-- expected:     // empty string

Current Behavior

See queries above.

Context

This came up when testing with Presto-native.

@kgpai
Copy link
Contributor Author

kgpai commented Jan 24, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🆕 Unprioritized
Development

No branches or pull requests

1 participant