Github user alopresto commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2467#discussion_r167957594
--- Diff:
nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/processors/hive/SelectHiveQL.java
---
@@ -437,6 +451,16 @@ private void onTrigger(final ProcessContext context,
final ProcessSession sessio
resultSetFlowFiles.set(i,
session.putAttribute(resultSetFlowFiles.get(i), "fragment.count",
Integer.toString(fragmentIndex)));
}
+
+ if(copyAttributtes)
+ {
+ for(Map.Entry<String, String> entry :
fileToProcess.getAttributes().entrySet()) {
--- End diff --
The attributes on the original flowfile are static, but this logic is
placed inside a loop which iterates over every resulting flowfile (there may be
many) and performs the same extraction multiple times. Please move the
retrieval of the original attributes outside of the loop and store them in a
local variable, then use `session.putAllAttributes(resultSetFlowFiles.get(i),
map);` inside the loop to copy all the original attributes into the new
flowfile.
---