mirror of https://github.com/apache/nifi.git
NIFI-4862: Keep incoming flowfile attributes in outgoing flowfiles from SelectHiveQL
This closes #2605. Signed-off-by: Koji Kawamura <ijokarumawak@apache.org>
This commit is contained in:
parent
5013753119
commit
ae1d3e3945
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue