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-11123: fix default value and update docs #6899

Closed

Conversation

KalmanJantner
Copy link
Contributor

@KalmanJantner KalmanJantner commented Jan 27, 2023

Summary

NIFI-11123

Tracking

Please complete the following tracking steps prior to pull request creation.

Issue Tracking

Pull Request Tracking

  • Pull Request title starts with Apache NiFi Jira issue number, such as NIFI-00000
  • Pull Request commit message starts with Apache NiFi Jira issue number, as such NIFI-00000

Pull Request Formatting

  • Pull Request based on current revision of the main branch
  • Pull Request refers to a feature branch with one commit containing changes

Verification

Please indicate the verification steps performed prior to pull request creation.

Build

  • Build completed using mvn clean install -P contrib-check
    • JDK 8
    • JDK 11
    • JDK 17

Licensing

  • New dependencies are compatible with the Apache License 2.0 according to the License Policy
  • New dependencies are documented in applicable LICENSE and NOTICE files

Documentation

  • Documentation formatting appears as expected in rendered files

Copy link
Contributor

@exceptionfactory exceptionfactory left a comment

Choose a reason for hiding this comment

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

Thanks for the documentation updates @KalmanJantner. Changing the example value property introduces a Parameter Value reference, as opposed to the current FlowFile attribute reference. Neither one may be provided, so having that JSON snippet as the default value does not seem like the best approach. Recommending Parameter usage in the additional details is one thing, but it should also be possible configure the Processor without reference to a Parameter. Perhaps the default JSON value should be removed if there is no suitable generic value that can be obtained from a FlowFile attribute.

@exceptionfactory
Copy link
Contributor

One additional note, these changes should reference a new Jira issue, not the existing Jira issue, which is already resolved.

@KalmanJantner KalmanJantner changed the title NIFI-10953: fix default value and update docs NIFI-11123: fix default value and update docs Feb 1, 2023
@tpalfy
Copy link
Contributor

tpalfy commented Feb 1, 2023

Instead of relying on a parameter context for the output bucket we could add a property on the processor.
For that property and the incoming flowfile attributes we could build a custom map and add that as parameter to the evaluateAttributeExpression call when getting the value of the payload JSON.
When both the property and a similar flowfile attribute is set, flowfile attributes should have precedence.

Also the type of Vision action (like DOCUMENT_TEXT_DETECTION) could come from a property as well.

@KalmanJantner
Copy link
Contributor Author

One additional note, these changes should reference a new Jira issue, not the existing Jira issue, which is already resolved.

Thanks, I have created a new ticket and updated the PR desc and title according to that.

@KalmanJantner
Copy link
Contributor Author

Instead of relying on a parameter context for the output bucket we could add a property on the processor. For that property and the incoming flowfile attributes we could build a custom map and add that as parameter to the evaluateAttributeExpression call when getting the value of the payload JSON. When both the property and a similar flowfile attribute is set, flowfile attributes should have precedence.

Also the type of Vision action (like DOCUMENT_TEXT_DETECTION) could come from a property as well.

Thank you for the suggestion. I have updated the PR based on your suggestion.

Copy link
Contributor

@exceptionfactory exceptionfactory left a comment

Choose a reason for hiding this comment

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

Thanks for the updates @KalmanJantner. The general approach looks good, but I recommended some additions to the new property descriptions, and style adjustments.

KalmanJantner and others added 6 commits February 2, 2023 06:45
…java/org/apache/nifi/processors/gcp/vision/AbstractStartGcpVisionOperation.java

Co-authored-by: exceptionfactory <exceptionfactory@apache.org>
…java/org/apache/nifi/processors/gcp/vision/AbstractStartGcpVisionOperation.java

Co-authored-by: exceptionfactory <exceptionfactory@apache.org>
…java/org/apache/nifi/processors/gcp/vision/AbstractStartGcpVisionOperation.java

Co-authored-by: exceptionfactory <exceptionfactory@apache.org>
…java/org/apache/nifi/processors/gcp/vision/AbstractStartGcpVisionOperation.java

Co-authored-by: exceptionfactory <exceptionfactory@apache.org>
…java/org/apache/nifi/processors/gcp/vision/AbstractStartGcpVisionOperation.java

Co-authored-by: exceptionfactory <exceptionfactory@apache.org>
@tpalfy
Copy link
Contributor

tpalfy commented Feb 2, 2023

LGTM
@exceptionfactory if you are okay with the recent changes I'll merge into main.

Copy link
Contributor

@exceptionfactory exceptionfactory left a comment

Choose a reason for hiding this comment

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

Thanks for the updates @KalmanJantner!

This looks just about ready to go @tpalfy, I noticed that the default value and examples need to be updated to match the adjusted vision-feature-type. With those changes, it looks good.

@@ -56,12 +56,12 @@ public class StartGcpVisionAnnotateFilesOperation extends AbstractStartGcpVision
" \"mimeType\": \"application/pdf\"\n" +
" },\n" +
" \"features\": [{\n" +
" \"type\": \"DOCUMENT_TEXT_DETECTION\",\n" +
" \"type\": \"${feature-type}\",\n" +
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be adjusted to vision-feature-type:

Suggested change
" \"type\": \"${feature-type}\",\n" +
" \"type\": \"${vision-feature-type}\",\n" +

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks fixed.

@@ -55,21 +55,21 @@ public class StartGcpVisionAnnotateImagesOperation extends AbstractStartGcpVisio
" }\n" +
" },\n" +
" \"features\": [{\n" +
" \"type\": \"FACE_DETECTION\",\n" +
" \"type\": \"${feature-type}\",\n" +
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
" \"type\": \"${feature-type}\",\n" +
" \"type\": \"${vision-feature-type}\",\n" +

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks fixed.

@@ -55,12 +55,12 @@ <h3>Payload</h3>
"mimeType": "application/pdf"
},
"features": [{
"type": "DOCUMENT_TEXT_DETECTION",
"type": "${feature-type}",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"type": "${feature-type}",
"type": "${vision-feature-type}",

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks fixed.

@@ -53,13 +53,13 @@ <h3>Payload</h3>
}
},
"features": [{
"type": "DOCUMENT_TEXT_DETECTION",
"type": "${feature-type}",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"type": "${feature-type}",
"type": "${vision-feature-type}",

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks fixed.

@tpalfy
Copy link
Contributor

tpalfy commented Feb 2, 2023

LGTM
Thank you for your work @KalmanJantner and @exceptionfactory for your review!
Merged into main.

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