feat: UDF json_get with user specified return type#7554
Conversation
json_get with third argument accepting a scalar value for type.
|
How about use datatype itself as a parameter instead of parsing a string? like this https://github.com/waynexia/jsonfusion/blob/645f8eccf8eccf9d6139b848d1fffe9f70d95cdf/src/get_field_typed.rs#L79-L85 This can express a more complicated type, and reduce maintaince burden of the string to type mapping |
|
@waynexia I'm afraid this will make the function difficult to understand, for example |
|
why use it like this, rather than |
|
Even if we will be rewriting For example, if we want to support int array as return type, we can rewrite |
* feat: add return_field_from_args * feat: add JsonGetWithType * port json_get_float and json_get_bool to new implementation, add json_get with third argument accepting a scalar value for type. * fix: lint fix * chore: add sqlness tests * chore: update tests
I hereby agree to the terms of the GreptimeDB CLA.
Refer to a related PR or issue link (optional)
Fixes #7500
What's changed and what's your intention?
json_getfunction that accept a return type, likestring,int, 'float' and 'bool'return_field_from_argsto ourFunctiontraitjson_get_boolandjson_get_floatto new data typePR Checklist
Please convert it to a draft if some of the following conditions are not met.