-
Notifications
You must be signed in to change notification settings - Fork 4.8k
HIVE-29310: Type casting problem in the variant_get UDF #6176
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
Conversation
2ba9903 to
0d500c7
Compare
|
ayushtkn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanx @deniskuzZ for the fix, the prod changes looks good. I think it isn't filtering broken, it is the UDF broken in case of type casting.
this query will fail without the fix, nothing around filtering
select try_variant_get(parse_json('{"a": 1}'), '$.a', 'int')
we must change the title to reflect that and maybe rather than testing the filtering, we might add tests around different types of casting.
Regarding filtering, I tried this
SELECT
try_variant_get(data, '$.name') AS name,
try_variant_get(data, '$.age', 'int') AS age,
try_variant_get(data, '$.address.city') AS city
FROM variant_filter_basic
WHERE CAST(try_variant_get(data, '$.age') AS INT) >= 30;
this works, so filtering isn't broken, the UDF cast functionality is broken
|
If possible to include, it would be very nice |
please +1, or i need to fix something (updated the title)? btw it didn't fail in variant_type.q. I don't have exception at hand but it was failing because constant in predicate and value had different types. |
ayushtkn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
(cherry picked from commit e34e87f)



What changes were proposed in this pull request?
Create the ObjectInspector according to the specified target type
Why are the changes needed?
Filter on non-String value fails
Does this PR introduce any user-facing change?
No
How was this patch tested?
qtest