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

ASF GitHub Bot commented on NIFI-2641:
--------------------------------------

Github user patricker commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/928#discussion_r76466230
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/QueryDatabaseTable.java
 ---
    @@ -258,6 +260,11 @@ public void onTrigger(final ProcessContext context, 
final ProcessSessionFactory
                                 fileToProcess = 
session.putAttribute(fileToProcess, "fragment.index", 
String.valueOf(fragmentIndex));
                             }
     
    +                        // Add maximum values as attributes
    +                        for (Map.Entry<String, String> entry : 
statePropertyMap.entrySet()) {
    +                            fileToProcess = 
session.putAttribute(fileToProcess, "maxvalue." + entry.getKey(), 
entry.getValue());
    --- End diff --
    
    Hey Matt,
    
    I had been thinking of implementing this same feature, and I have a concern 
with how it works.  I added a property to control the maximum number of rows 
per FlowFile `MAX_ROWS_PER_FLOW_FILE`.  If this is enabled and multiple files 
are returned then the maxvalue reported on each FlowFile will be different.
    
    I think that is fine, since it would be the max value in that file, except 
it might not be... this is because `getQuery` does not sort by the Max Value 
Columns, so there is no guaranteed order to the rows. Meaning the value 
associated might not be max at all, just the max seen so far across all files.


> Add max values as attributes in QueryDatabaseTable 
> ---------------------------------------------------
>
>                 Key: NIFI-2641
>                 URL: https://issues.apache.org/jira/browse/NIFI-2641
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Matt Burgess
>            Assignee: Matt Burgess
>            Priority: Minor
>             Fix For: 1.0.0
>
>
> The observed maximum values for the specified columns in QueryDatabaseTable 
> are stored in the processor's State for use by the processor. However it may 
> be helpful to have those values available to the user via attributes on the 
> flow file(s) generated by the processor.



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

Reply via email to