[ 
https://issues.apache.org/jira/browse/NIFI-482?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14593398#comment-14593398
 ] 

Mark Payne edited comment on NIFI-482 at 6/19/15 1:08 PM:
----------------------------------------------------------

A good example of this issue is as follows:

If we have attributes:
a.1 == 245
a.2 == 123
a.3 == 732
a.4 == 343
a.5 == 553
 
Then we evaluate the Expression:
${allMatchingAttributes('a.*'):contains('2'):count():gt(2)}

The expression is valid but returns unexpected results. This happens because 
the 'count' function "reduces" the allMatchingAttributes function. I.e., no 
function should be allowed to be evaluated against the result of 'count' or 
'join'.

There are two issues here really: 1) The Expression is valid, as is, but 
returns incorrect results.  2) We can't do the above.

The attached patch makes the expression invalid as-is but introduces a new 
'literal' function so that we can do this by enclosing the first part as an 
argument to the 'literal' function:

${ literal( ${allMatchingAttributes('a.*'):contains('2'):count()} ):gt(2) }


was (Author: markap14):
A good example of this issue is as follows:

If we have attributes:
a.1 == 245
a.2 == 123
a.3 == 732
a.4 == 343
a.5 == 553
 
Then we evaluate the Expression:
${allMatchingAttributes('a.*'):contains('2'):count():gt(2)}

The expression is valid but returns unexpected results. This happens because 
the 'count' function "reduces" the allMatchingAttributes function. I.e., no 
function should be allowed to be evaluated against the result of 'count' or 
'join'.

There are two issues here really: 1) The Expression is valid, as is, but 
returns incorrect results.  2) We can't do the above.

> users are currently able to evaluate a function against the result of an 
> aggregrate function
> --------------------------------------------------------------------------------------------
>
>                 Key: NIFI-482
>                 URL: https://issues.apache.org/jira/browse/NIFI-482
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 0.0.2
>            Reporter: Ben Icore
>            Assignee: Mark Payne
>             Fix For: 0.2.0
>
>         Attachments: 
> 0001-NIFI-482-Allowed-for-new-literal-function.-Make-expr.patch
>
>
> users should not be able to evaluate a function against the result of an 
> aggregrate function as it will often yield indeterminate results.
>  
> expression should be invalid



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to