Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NIFI-2641: Add max values as attributes to QueryDatabaseTable #928

Closed
wants to merge 1 commit into from

Conversation

mattyb149
Copy link
Contributor

No description provided.

@brosander
Copy link
Contributor

Ran contrib-check on nifi-standard bundle, ran full build with tests.

Set up QueryDatabaseTable pointed at Postgres instance, tried numeric and string values for max value. Seems to work as expected, adding maxvalue.column to the FlowFile.

+1

@asfgit asfgit closed this in ad7808f Aug 25, 2016
@@ -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());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@patricker patricker mentioned this pull request Sep 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants