nifi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ijokaruma...@apache.org
Subject nifi git commit: NIFI-4862: Keep incoming flowfile attributes in outgoing flowfiles from SelectHiveQL
Date Mon, 09 Apr 2018 07:29:06 GMT
Repository: nifi
Updated Branches:
  refs/heads/master 501375311 -> ae1d3e394


NIFI-4862: Keep incoming flowfile attributes in outgoing flowfiles from SelectHiveQL

This closes #2605.

Signed-off-by: Koji Kawamura <ijokarumawak@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/ae1d3e39
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/ae1d3e39
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/ae1d3e39

Branch: refs/heads/master
Commit: ae1d3e39456b364b776d73f46b39e87272e52865
Parents: 5013753
Author: Matthew Burgess <mattyb149@apache.org>
Authored: Wed Apr 4 15:38:24 2018 -0400
Committer: Koji Kawamura <ijokarumawak@apache.org>
Committed: Mon Apr 9 12:31:05 2018 +0900

----------------------------------------------------------------------
 .../org/apache/nifi/processors/hive/SelectHiveQL.java     |  2 +-
 .../org/apache/nifi/processors/hive/TestSelectHiveQL.java | 10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/ae1d3e39/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/processors/hive/SelectHiveQL.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/processors/hive/SelectHiveQL.java
b/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/processors/hive/SelectHiveQL.java
index 0bbddf5..2526ef5 100644
--- a/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/processors/hive/SelectHiveQL.java
+++ b/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/processors/hive/SelectHiveQL.java
@@ -352,7 +352,7 @@ public class SelectHiveQL extends AbstractHiveQLProcessor {
                 String baseFilename = (fileToProcess != null) ? fileToProcess.getAttribute(CoreAttributes.FILENAME.key())
: null;
                 while (true) {
                     final AtomicLong nrOfRows = new AtomicLong(0L);
-                    flowfile = (flowfile == null) ? session.create() : session.create(flowfile);
+                    flowfile = (fileToProcess == null) ? session.create() : session.create(fileToProcess);
                     if (baseFilename == null) {
                         baseFilename = flowfile.getAttribute(CoreAttributes.FILENAME.key());
                     }

http://git-wip-us.apache.org/repos/asf/nifi/blob/ae1d3e39/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/test/java/org/apache/nifi/processors/hive/TestSelectHiveQL.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/test/java/org/apache/nifi/processors/hive/TestSelectHiveQL.java
b/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/test/java/org/apache/nifi/processors/hive/TestSelectHiveQL.java
index bb919d8..43c47c8 100644
--- a/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/test/java/org/apache/nifi/processors/hive/TestSelectHiveQL.java
+++ b/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/test/java/org/apache/nifi/processors/hive/TestSelectHiveQL.java
@@ -135,11 +135,11 @@ public class TestSelectHiveQL {
         assertEquals(2, provenanceEvents.size());
 
         final ProvenanceEventRecord provenance0 = provenanceEvents.get(0);
-        assertEquals(ProvenanceEventType.FETCH, provenance0.getEventType());
-        assertEquals("jdbc:derby:target/db;create=true", provenance0.getTransitUri());
+        assertEquals(ProvenanceEventType.FORK, provenance0.getEventType());
 
         final ProvenanceEventRecord provenance1 = provenanceEvents.get(1);
-        assertEquals(ProvenanceEventType.FORK, provenance1.getEventType());
+        assertEquals(ProvenanceEventType.FETCH, provenance1.getEventType());
+        assertEquals("jdbc:derby:target/db;create=true", provenance1.getTransitUri());
     }
 
 
@@ -405,6 +405,10 @@ public class TestSelectHiveQL {
 
         runner.run();
         runner.assertAllFlowFilesTransferred(SelectHiveQL.REL_SUCCESS, 1);
+        MockFlowFile flowFile = runner.getFlowFilesForRelationship(SelectHiveQL.REL_SUCCESS).get(0);
+        // Assert the attributes from the incoming flow file are preserved in the outgoing
flow file(s)
+        flowFile.assertAttributeEquals("hiveql.args.1.value", "1");
+        flowFile.assertAttributeEquals("hiveql.args.1.type", String.valueOf(Types.INTEGER));
         runner.clearTransferState();
     }
 


Mime
View raw message