tpalfy commented on a change in pull request #3646: NIFI-6546 - Add JsonPath 
set value support
URL: https://github.com/apache/nifi/pull/3646#discussion_r314767395
 
 

 ##########
 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:
   The `" to " + ResultType.WHOLE_NUMBER` part was probably an unintentional 
remainder of a copy.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to