When using the executeSQL and executeSQLRecord processors, we can use input flowfiles with a certain number of attributes. If we don't set the Output Batch Size, all these attributes are copied to the output flowfile. However, if we set it, only the flowfiles from the first batch will have the attributes copied to. The flowfiles in the following batches will only have the default attributes.
In the source code of the method onTrigger in the class AbstractExecuteSQL, we have the following piece of code that is supposed to create an output flowfile and copy the original attributes into it:
However the fix for the issue
NIFI-6040 introduced this snippet way below in the same method:
As you can see, it sets the variable fileToProcess to null, preventing the flowfiles in the next batch to copy its attributes