You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/11/22 09:44:53 UTC

[GitHub] [nifi] r-vandenbos opened a new pull request, #6701: NIFI-10845 - JsonQueryElasticsearch processors are not outputting an …

r-vandenbos opened a new pull request, #6701:
URL: https://github.com/apache/nifi/pull/6701

   …empty flow file for a combined response with output_no_hits set to true
   
   <!-- Licensed to the Apache Software Foundation (ASF) under one or more -->
   <!-- contributor license agreements.  See the NOTICE file distributed with -->
   <!-- this work for additional information regarding copyright ownership. -->
   <!-- The ASF licenses this file to You under the Apache License, Version 2.0 -->
   <!-- (the "License"); you may not use this file except in compliance with -->
   <!-- the License.  You may obtain a copy of the License at -->
   <!--     http://www.apache.org/licenses/LICENSE-2.0 -->
   <!-- Unless required by applicable law or agreed to in writing, software -->
   <!-- distributed under the License is distributed on an "AS IS" BASIS, -->
   <!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -->
   <!-- See the License for the specific language governing permissions and -->
   <!-- limitations under the License. -->
   
   # Summary
   
   [NIFI-10845](https://issues.apache.org/jira/browse/NIFI-10845)
   
   # Tracking
   
   Please complete the following tracking steps prior to pull request creation.
   
   ### Issue Tracking
   
   - [x] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue created
   
   ### Pull Request Tracking
   
   - [x] Pull Request title starts with Apache NiFi Jira issue number, such as `NIFI-00000`
   - [x] Pull Request commit message starts with Apache NiFi Jira issue number, as such `NIFI-00000`
   
   ### Pull Request Formatting
   
   - [x] Pull Request based on current revision of the `main` branch
   - [x] 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
     - [x] JDK 11
     - [ ] JDK 17
   
   ### Licensing
   
   - [-] New dependencies are compatible with the [Apache License 2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License Policy](https://www.apache.org/legal/resolved.html)
   - [-] New dependencies are documented in applicable `LICENSE` and `NOTICE` files
   
   ### Documentation
   
   - [x] Documentation formatting appears as expected in rendered files
   


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] asfgit closed pull request #6701: NIFI-10845 - JsonQueryElasticsearch processors are not outputting an …

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #6701: NIFI-10845 - JsonQueryElasticsearch processors are not outputting an …
URL: https://github.com/apache/nifi/pull/6701


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] ChrisSamo632 commented on a diff in pull request #6701: NIFI-10845 - JsonQueryElasticsearch processors are not outputting an …

Posted by GitBox <gi...@apache.org>.
ChrisSamo632 commented on code in PR #6701:
URL: https://github.com/apache/nifi/pull/6701#discussion_r1029386806


##########
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/main/java/org/apache/nifi/processors/elasticsearch/AbstractPaginatedJsonQueryElasticsearch.java:
##########
@@ -297,6 +297,10 @@ List<FlowFile> handleHits(final List<Map<String, Object>> hits, final boolean ne
                 session.transfer(hitsFlowFiles, REL_HITS);
                 hitsFlowFiles.forEach(ff -> session.getProvenanceReporter().receive(ff, transitUri, stopWatch.getElapsed(TimeUnit.MILLISECONDS)));
                 hitsFlowFiles.clear();
+            } else if (getOutputNoHits()) {

Review Comment:
   I think this should be moved into the `combineHits` method, e.g.
   
   ```java
   if (hits != null && !hits.isEmpty()) {
    ...
   } else if (getOutputNoHits()) {
       final FlowFile hitFlowFile = createChildFlowFile(session, parent);
       hitsFlowFiles.add(writeHitFlowFile(0, "", session, hitFlowFile, attributes));
   }
   ```
   
   That leaves the FlowFile creation within the `combineHits` method and the transfer of FlowFiles to output queues within this `handleHits` method



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] ChrisSamo632 commented on a diff in pull request #6701: NIFI-10845 - JsonQueryElasticsearch processors are not outputting an …

Posted by GitBox <gi...@apache.org>.
ChrisSamo632 commented on code in PR #6701:
URL: https://github.com/apache/nifi/pull/6701#discussion_r1029383884


##########
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/main/java/org/apache/nifi/processors/elasticsearch/AbstractJsonQueryElasticsearch.java:
##########
@@ -277,8 +281,8 @@ private void handleAggregations(final Map<String, Object> aggregations, final Pr
         }
     }
 
-    private FlowFile writeHitFlowFile(final int count, final String json, final ProcessSession session,
-                                      final FlowFile hitFlowFile, final Map<String, String> attributes) {
+    public FlowFile writeHitFlowFile(final int count, final String json, final ProcessSession session,

Review Comment:
   Doesn't need to be `public`, package-private should be enough (i.e. remove the access modifier)



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] r-vandenbos commented on a diff in pull request #6701: NIFI-10845 - JsonQueryElasticsearch processors are not outputting an …

Posted by GitBox <gi...@apache.org>.
r-vandenbos commented on code in PR #6701:
URL: https://github.com/apache/nifi/pull/6701#discussion_r1030211669


##########
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/main/java/org/apache/nifi/processors/elasticsearch/AbstractPaginatedJsonQueryElasticsearch.java:
##########
@@ -297,6 +297,10 @@ List<FlowFile> handleHits(final List<Map<String, Object>> hits, final boolean ne
                 session.transfer(hitsFlowFiles, REL_HITS);
                 hitsFlowFiles.forEach(ff -> session.getProvenanceReporter().receive(ff, transitUri, stopWatch.getElapsed(TimeUnit.MILLISECONDS)));
                 hitsFlowFiles.clear();
+            } else if (getOutputNoHits()) {

Review Comment:
   👍🏻 
   



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] r-vandenbos commented on a diff in pull request #6701: NIFI-10845 - JsonQueryElasticsearch processors are not outputting an …

Posted by GitBox <gi...@apache.org>.
r-vandenbos commented on code in PR #6701:
URL: https://github.com/apache/nifi/pull/6701#discussion_r1030211418


##########
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/main/java/org/apache/nifi/processors/elasticsearch/AbstractJsonQueryElasticsearch.java:
##########
@@ -277,8 +281,8 @@ private void handleAggregations(final Map<String, Object> aggregations, final Pr
         }
     }
 
-    private FlowFile writeHitFlowFile(final int count, final String json, final ProcessSession session,
-                                      final FlowFile hitFlowFile, final Map<String, String> attributes) {
+    public FlowFile writeHitFlowFile(final int count, final String json, final ProcessSession session,

Review Comment:
   👍🏻 



##########
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/main/java/org/apache/nifi/processors/elasticsearch/AbstractJsonQueryElasticsearch.java:
##########
@@ -105,6 +105,10 @@
     private String splitUpAggregations;
     private boolean outputNoHits;
 
+    public boolean getOutputNoHits() {

Review Comment:
   👍🏻 



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] ChrisSamo632 commented on a diff in pull request #6701: NIFI-10845 - JsonQueryElasticsearch processors are not outputting an …

Posted by GitBox <gi...@apache.org>.
ChrisSamo632 commented on code in PR #6701:
URL: https://github.com/apache/nifi/pull/6701#discussion_r1029384870


##########
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/main/java/org/apache/nifi/processors/elasticsearch/AbstractJsonQueryElasticsearch.java:
##########
@@ -105,6 +105,10 @@
     private String splitUpAggregations;
     private boolean outputNoHits;
 
+    public boolean getOutputNoHits() {

Review Comment:
   package-privte would be fine, not `public`
   
   Personally I'd move the method lower down the class too rather than putting it in the middle of the class field definitions... but that's more a personal preference than anything so happy to ignore that



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org