Skip to content

Commit

Permalink
fix: add json remaining functions
Browse files Browse the repository at this point in the history
  • Loading branch information
emptyOVO committed Oct 15, 2024
1 parent 6c96919 commit 500af97
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import org.apache.inlong.sdk.transform.decode.SourceData;
import org.apache.inlong.sdk.transform.process.Context;
import org.apache.inlong.sdk.transform.process.function.FunctionConstant;
import org.apache.inlong.sdk.transform.process.function.TransformFunction;
import org.apache.inlong.sdk.transform.process.operator.OperatorTools;
import org.apache.inlong.sdk.transform.process.parser.ValueParser;
Expand All @@ -38,17 +39,16 @@
* is not a valid path expression or is $ or contains a * or ** wildcard;
* - return the result of removing data from 'json_doc'.
*/
@TransformFunction(names = {
@TransformFunction(type = FunctionConstant.JSON_TYPE, names = {
"json_remove"}, parameter = "(String json_doc, String path1[, String path2, ...])", descriptions = {
"- Return \"\" if any argument is NULL or the 'json_doc' argument is not a valid JSON document or any "
+
"path argument is not a valid path expression or is $ or contains a * or ** wildcard;",
"- Return the result of removing data from 'json_doc'."
}, examples = {
"json_remove(\"{\\\"name\\\":\\\"Charlie\\\",\\\"hobbies\\\":[[\\\"swimming1\\\",\\\"swimming2\\\"]," +
"json_remove(\"{\\\"name\\\":\\\"Charlie\\\",\\\"hobbies\\\":[[\\\"swimming1\\\",\\\"swimming2\\\"], " +
"\\\"reading\\\",\\\"coding\\\"]}\",\"$.age\") = {\"hobbies\":[[\"swimming2\"],\"coding\"]," +
"\"name\":\"Charlie\"}"
})
"\"name\":\"Charlie\"}"})
public class JsonRemoveFunction implements ValueParser {

private ValueParser jsonDocParser;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import org.apache.inlong.sdk.transform.decode.SourceData;
import org.apache.inlong.sdk.transform.process.Context;
import org.apache.inlong.sdk.transform.process.function.FunctionConstant;
import org.apache.inlong.sdk.transform.process.function.TransformFunction;
import org.apache.inlong.sdk.transform.process.operator.OperatorTools;
import org.apache.inlong.sdk.transform.process.parser.ValueParser;
Expand All @@ -38,15 +39,13 @@
* is not a valid path expression or contains a * or ** wildcard;
* - return the result of inserting or updating data in 'json_doc'.
*/
@TransformFunction(names = {
@TransformFunction(type = FunctionConstant.JSON_TYPE, names = {
"json_set"}, parameter = "(String json_doc, String path1, String val1[, String path2, String val2, ...] )", descriptions = {
"- Return \"\" if any argument is NULL or the 'json_doc' argument is not a valid JSON document or any path argument"
"- Return \"\" if any argument is NULL or the 'json_doc' argument is not a valid JSON document or any "
+
" is not a valid path expression or contains a * or ** wildcard;",
"path argument is not a valid path expression or contains a * or ** wildcard;",
"- Return the result of inserting or updating data in 'json_doc'."
}, examples = {
"json_set({\\\"name\\\":\\\"Alice\\\"},\"$.name\",\"inlong\") = {\"name\":\"inlong\"}"
})
}, examples = {"json_set({\\\"name\\\":\\\"Alice\\\"},\"$.name\",\"inlong\") = {\"name\":\"inlong\"}"})
public class JsonSetFunction implements ValueParser {

private ValueParser jsonDocParser;
Expand Down

0 comments on commit 500af97

Please sign in to comment.