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

    https://github.com/apache/nifi/pull/2243#discussion_r183391339
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteSQL.java
 ---
    @@ -278,8 +289,18 @@ public void onTrigger(final ProcessContext context, 
final ProcessSession session
                     } else {
                         fileToProcess = session.write(fileToProcess, 
JdbcCommon::createEmptyAvroStream);
     
    +                    fileToProcess = session.putAttribute(fileToProcess, 
CoreAttributes.MIME_TYPE.key(), JdbcCommon.MIME_TYPE_AVRO_BINARY);
                         session.transfer(fileToProcess, REL_SUCCESS);
                     }
    +            } else if(resultCount == 0){
    +                //If we had no inbound FlowFile, no exceptions, and the 
SQL generated no result sets (Insert/Update/Delete statements only)
    +                // Then generate an empty Output FlowFile
    +                FlowFile resultSetFF = session.create();
    +
    +                resultSetFF = session.write(resultSetFF, out -> 
JdbcCommon.createEmptyAvroStream(out));
    +
    +                resultSetFF = session.putAttribute(resultSetFF, 
CoreAttributes.MIME_TYPE.key(), JdbcCommon.MIME_TYPE_AVRO_BINARY);
    --- End diff --
    
    This is a good suggestion. I'll update the `else` to cover this scenario 
with a `0` `RESULT_ROW_COUNT`.


---

Reply via email to