KevinyhZou commented on code in PR #8558:
URL: https://github.com/apache/incubator-gluten/pull/8558#discussion_r1955619225
##########
cpp-ch/local-engine/Rewriter/ExpressionRewriter.h:
##########
@@ -85,6 +85,24 @@ class GetJsonObjectFunctionWriter : public RelRewriter
}
}
}
+ String getJsonPathOfGetJSONObject(const
substrait::Expression_ScalarFunction & func)
+ {
+ String json_path = "";
+ for (size_t i = 1; i < func.arguments().size(); ++i)
+ {
+ auto json_path_pb = func.arguments(i).value();
+ if (!json_path_pb.has_literal() ||
!json_path_pb.literal().has_string())
+ {
+ break;
+ }
+ json_path += json_path_pb.literal().string();
+ if (i != func.arguments().size() - 1)
+ {
+ json_path += "#" ;
+ }
+ }
+ return json_path;
+ }
Review Comment:
If more levels of nested `get_json_object`call mixed with other
`get_json_object` call, like
`get_json_object(get_json_object(get_json_object(d, '$.a'), '$.b'), '$.c'),
get_json_object(d, '$.e') ` and this will be optimized to `get_json_object(d,
'$.a', '$.b', '$.c'), get_json_object(d, '$.e')` by the optimized rule
`CollapsedNestedExpressions`, at next steps, the path of them will be converted
to '$.a#$.b#$.c | $.e', and it will be executed by
`SparkFunctionGetJsonObject` to return a tuple eventually, So more levels case
can be handled here. @lgbo-ustc
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]