[GitHub] nifi pull request #2467: NIFI-4862 Add Copy original attributtes to SelectHi...

2018-02-27 Thread jles01
GitHub user jles01 reopened a pull request:

https://github.com/apache/nifi/pull/2467

NIFI-4862 Add Copy original attributtes to SelectHiveQL processer

Thank you for submitting a contribution to Apache NiFi.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

### For all changes:
- [x] Is there a JIRA ticket associated with this PR? Is it referenced 
 in the commit message?

- [x] Does your PR title start with NIFI- where  is the JIRA number 
you are trying to resolve? Pay particular attention to the hyphen "-" character.

- [ ] Has your PR been rebased against the latest commit within the target 
branch (typically master)?

- [ ] Is your initial contribution a single, squashed commit?

### For code changes:
- [ ] Have you ensured that the full suite of tests is executed via mvn 
-Pcontrib-check clean install at the root nifi folder?
- [x] Have you written or updated unit tests to verify your changes?
- [ ] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)? 
- [ ] If applicable, have you updated the LICENSE file, including the main 
LICENSE file under nifi-assembly?
- [ ] If applicable, have you updated the NOTICE file, including the main 
NOTICE file found under nifi-assembly?
- [x] If adding new Properties, have you added .displayName in addition to 
.name (programmatic access) for each of the new properties?

### For documentation related changes:
- [ ] Have you ensured that format looks appropriate for the output in 
which it is rendered?

### Note:
Please ensure that once the PR is submitted, you check travis-ci for build 
issues and submit an update to your PR as soon as possible.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/jles01/nifi-1 nifi-4862

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/nifi/pull/2467.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2467






---


[GitHub] nifi pull request #2467: NIFI-4862 Add Copy original attributtes to SelectHi...

2018-02-27 Thread jles01
Github user jles01 closed the pull request at:

https://github.com/apache/nifi/pull/2467


---


[GitHub] nifi pull request #2467: NIFI-4862 Add Copy original attributtes to SelectHi...

2018-02-13 Thread alopresto
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 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. 


---


[GitHub] nifi pull request #2467: NIFI-4862 Add Copy original attributtes to SelectHi...

2018-02-13 Thread alopresto
Github user alopresto commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2467#discussion_r167956282
  
--- 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)
--- End diff --

Please follow the [style guide located 
here](https://cwiki.apache.org/confluence/display/NIFI/Contributor+Guide#ContributorGuide-CodeStyle)
 for consistency. 


---


[GitHub] nifi pull request #2467: NIFI-4862 Add Copy original attributtes to SelectHi...

2018-02-13 Thread alopresto
Github user alopresto commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2467#discussion_r167955721
  
--- Diff: 
nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/processors/hive/SelectHiveQL.java
 ---
@@ -306,6 +319,7 @@ private void onTrigger(final ProcessContext context, 
final ProcessSession sessio
 final boolean quote = 
context.getProperty(HIVEQL_CSV_QUOTE).asBoolean();
 final boolean escape = 
context.getProperty(HIVEQL_CSV_HEADER).asBoolean();
 final String fragmentIdentifier = UUID.randomUUID().toString();
+final boolean copyAttributtes = 
context.getProperty(HIVEQL_COPY_ATRIBUTTES).asBoolean();
--- End diff --

Please correct typo in the variable name -- `copyAttributes`. 


---


[GitHub] nifi pull request #2467: NIFI-4862 Add Copy original attributtes to SelectHi...

2018-02-13 Thread alopresto
Github user alopresto commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2467#discussion_r167955630
  
--- Diff: 
nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/processors/hive/SelectHiveQL.java
 ---
@@ -261,6 +273,7 @@ public void onTrigger(ProcessContext context, 
ProcessSessionFactory sessionFacto
 
 private void onTrigger(final ProcessContext context, final 
ProcessSession session) throws ProcessException {
 FlowFile fileToProcess = (context.hasIncomingConnection() ? 
session.get() : null);
+Attributes originalAttributes;
--- End diff --

This variable is unused. 


---


[GitHub] nifi pull request #2467: NIFI-4862 Add Copy original attributtes to SelectHi...

2018-02-13 Thread alopresto
Github user alopresto commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2467#discussion_r167955428
  
--- Diff: 
nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/processors/hive/SelectHiveQL.java
 ---
@@ -203,6 +203,16 @@
 .expressionLanguageSupported(false)
 .build();
 
+public static final PropertyDescriptor HIVEQL_COPY_ATRIBUTTES = new 
PropertyDescriptor.Builder()
--- End diff --

Please correct typos in the field name and in `.displayName()`, 
`.description()`, and `.name()` -- "attributes". 


---


[GitHub] nifi pull request #2467: NIFI-4862 Add Copy original attributtes to SelectHi...

2018-02-13 Thread alopresto
Github user alopresto commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2467#discussion_r167955177
  
--- Diff: 
nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/processors/hive/SelectHiveQL.java
 ---
@@ -32,7 +32,7 @@
 import java.util.UUID;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicLong;
-
+import java.util.jar.Attributes;
--- End diff --

I think this import is unused. 


---


[GitHub] nifi pull request #2467: NIFI-4862 Add Copy original attributtes to SelectHi...

2018-02-13 Thread jles01
GitHub user jles01 opened a pull request:

https://github.com/apache/nifi/pull/2467

NIFI-4862 Add Copy original attributtes to SelectHiveQL processer

Thank you for submitting a contribution to Apache NiFi.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

### For all changes:
- [ ] Is there a JIRA ticket associated with this PR? Is it referenced 
 in the commit message?

- [ ] Does your PR title start with NIFI- where  is the JIRA number 
you are trying to resolve? Pay particular attention to the hyphen "-" character.

- [ ] Has your PR been rebased against the latest commit within the target 
branch (typically master)?

- [ ] Is your initial contribution a single, squashed commit?

### For code changes:
- [ ] Have you ensured that the full suite of tests is executed via mvn 
-Pcontrib-check clean install at the root nifi folder?
- [ ] Have you written or updated unit tests to verify your changes?
- [ ] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)? 
- [ ] If applicable, have you updated the LICENSE file, including the main 
LICENSE file under nifi-assembly?
- [ ] If applicable, have you updated the NOTICE file, including the main 
NOTICE file found under nifi-assembly?
- [ ] If adding new Properties, have you added .displayName in addition to 
.name (programmatic access) for each of the new properties?

### For documentation related changes:
- [ ] Have you ensured that format looks appropriate for the output in 
which it is rendered?

### Note:
Please ensure that once the PR is submitted, you check travis-ci for build 
issues and submit an update to your PR as soon as possible.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/jles01/nifi-1 nifi-4862

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/nifi/pull/2467.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2467


commit efa37937980a300f6362118fcea50c8469c31782
Author: Jakub Leś 
Date:   2018-02-13T16:14:14Z

NIFI-4862 Add Copy original attributtes to SelectHiveQL processer




---