apache / inlong

Apache InLong - a one-stop, full-scenario integration framework for massive data
https://inlong.apache.org/
Apache License 2.0
1.37k stars 534 forks source link

[Feature][SDK] Transform support JSON_QUERY() function #11224

Open emptyOVO opened 4 days ago

emptyOVO commented 4 days ago

Description

The result is returned as a STRING or ARRAY. This can be controlled with the RETURNING clause. onEmpty and onError determine the behavior in case the path expression is empty, or in case an error was raised, respectively. By default, in both cases null is returned. Other choices are to use an empty array, an empty object, or to raise an error.

Use case

-- '{ "b": 1 }'
JSON_QUERY('{ "a": { "b": 1 } }', '$.a')
-- '[1, 2]'
JSON_QUERY('[1, 2]', '$')
-- '["c1","c2"]'
JSON_QUERY('{"a":[{"c":"c1"},{"c":"c2"}]}', 'lax $.a[*].c')

Are you willing to submit PR?

Code of Conduct