You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2019/08/17 19:37:48 UTC
[GitHub] [nifi] mans2singh commented on a change in pull request #3646:
NIFI-6546 - Add JsonPath set value support
mans2singh commented on a change in pull request #3646: NIFI-6546 - Add JsonPath set value support
URL: https://github.com/apache/nifi/pull/3646#discussion_r314957566
##########
File path: nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/compile/ExpressionCompiler.java
##########
@@ -919,6 +924,29 @@ private DateEvaluator toDateEvaluator(final Evaluator<?> evaluator, final String
return addToken(new JsonPathDeleteEvaluator(toStringEvaluator(subjectEvaluator),
toStringEvaluator(argEvaluators.get(0), "first argument to jsonPathDelete")), "jsonPathDelete");
}
+ case JSON_PATH_SET: {
+ verifyArgCount(argEvaluators, 2, "jsonPathSet");
+ Evaluator<?> valueEvaluator = null;
+ Evaluator<?> argValueEvaluator = argEvaluators.get(1);
+ String location = "second argument to jsonPathSet";
+ if (argValueEvaluator instanceof StringEvaluator) {
+ valueEvaluator = toStringEvaluator(argValueEvaluator, location);
+ } else if (argValueEvaluator instanceof DecimalEvaluator) {
+ valueEvaluator = toDecimalEvaluator(argValueEvaluator, location);
+ } else if (argValueEvaluator instanceof NumberEvaluator) {
+ valueEvaluator = toNumberEvaluator(argValueEvaluator, location);
+ } else if (argValueEvaluator instanceof WholeNumberEvaluator) {
+ valueEvaluator = toWholeNumberEvaluator(argValueEvaluator, location);
+ } else if (argValueEvaluator instanceof BooleanEvaluator) {
+ valueEvaluator = toBooleanEvaluator(argValueEvaluator, location);
+ } else {
+ throw new AttributeExpressionLanguageParsingException("Cannot implicitly convert Data Type " + argValueEvaluator.getResultType() + " to " + ResultType.WHOLE_NUMBER
Review comment:
Corrected thanks
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services