You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by MikeThomsen <gi...@git.apache.org> on 2018/03/01 13:01:48 UTC

[GitHub] nifi pull request #2501: NIFI-4743 Added configurable null suppression to Pu...

GitHub user MikeThomsen opened a pull request:

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

    NIFI-4743 Added configurable null suppression to PutElasticsearchHttp…

    …Record using a modified verison of a patch from Robert Bruno.
    
    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-XXXX where XXXX 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/MikeThomsen/nifi NIFI-4743

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

    https://github.com/apache/nifi/pull/2501.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 #2501
    
----
commit 374f9e3f47540aed9cfc955c7d86e215b70910f0
Author: Mike Thomsen <mi...@...>
Date:   2018-03-01T13:00:03Z

    NIFI-4743 Added configurable null suppression to PutElasticsearchHttpRecord using a modified verison of a patch from Robert Bruno.

----


---

[GitHub] nifi issue #2501: NIFI-4743 Added configurable null suppression to PutElasti...

Posted by MikeThomsen <gi...@git.apache.org>.
Github user MikeThomsen commented on the issue:

    https://github.com/apache/nifi/pull/2501
  
    @pvillard31 If you have a min this is a small one that'd be good to have in 1.6. @robertrbruno wrote 95% of it, but I took his patch from Jira and made it into a PR. We've both kicked the tires, and it seems solid.


---

[GitHub] nifi pull request #2501: NIFI-4743 Added configurable null suppression to Pu...

Posted by pvillard31 <gi...@git.apache.org>.
Github user pvillard31 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2501#discussion_r174062370
  
    --- Diff: nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-processors/src/main/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchHttpRecord.java ---
    @@ -284,6 +306,17 @@ public void onTrigger(final ProcessContext context, final ProcessSession session
                     return;
             }
     
    +        final NullSuppression suppression;
    --- End diff --
    
    Not sure we need this variable. We can directly use ````this.nullSuppression````in the below block, no?


---

[GitHub] nifi pull request #2501: NIFI-4743 Added configurable null suppression to Pu...

Posted by MikeThomsen <gi...@git.apache.org>.
Github user MikeThomsen commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2501#discussion_r174483646
  
    --- Diff: nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-processors/src/main/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchHttpRecord.java ---
    @@ -284,6 +306,17 @@ public void onTrigger(final ProcessContext context, final ProcessSession session
                     return;
             }
     
    +        final NullSuppression suppression;
    --- End diff --
    
    Done.


---

[GitHub] nifi issue #2501: NIFI-4743 Added configurable null suppression to PutElasti...

Posted by MikeThomsen <gi...@git.apache.org>.
Github user MikeThomsen commented on the issue:

    https://github.com/apache/nifi/pull/2501
  
    @pvillard31 @robertrbruno I checked in a new commit based on the feedback. Please take a look when you have a min.


---

[GitHub] nifi pull request #2501: NIFI-4743 Added configurable null suppression to Pu...

Posted by robertrbruno <gi...@git.apache.org>.
Github user robertrbruno commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2501#discussion_r174307349
  
    --- Diff: nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-processors/src/main/java/org/apache/nifi/processors/elasticsearch/NullSuppression.java ---
    @@ -0,0 +1,24 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.nifi.processors.elasticsearch;
    +
    +public enum NullSuppression {
    +    ALWAYS_SUPPRESS,
    +    NEVER_SUPPRESS,
    +    SUPPRESS_MISSING
    --- End diff --
    
    Agreed that allowable values could be used where enum is used.   Enum was only used to be consistent with how JsonRecordSetWriter was written.  I feel it would be simpler without the enum though.


---

[GitHub] nifi issue #2501: NIFI-4743 Added configurable null suppression to PutElasti...

Posted by MikeThomsen <gi...@git.apache.org>.
Github user MikeThomsen commented on the issue:

    https://github.com/apache/nifi/pull/2501
  
    This isn't easily tested with a unit test, so here's a flowfile that can be tested against an ES instance running on localhost:9200 (ie defaults)
    
    [Nullable_ES_Test.xml.txt](https://github.com/apache/nifi/files/1771209/Nullable_ES_Test.xml.txt)



---

[GitHub] nifi issue #2501: NIFI-4743 Added configurable null suppression to PutElasti...

Posted by MikeThomsen <gi...@git.apache.org>.
Github user MikeThomsen commented on the issue:

    https://github.com/apache/nifi/pull/2501
  
    @pvillard31 Added integration tests.


---

[GitHub] nifi issue #2501: NIFI-4743 Added configurable null suppression to PutElasti...

Posted by pvillard31 <gi...@git.apache.org>.
Github user pvillard31 commented on the issue:

    https://github.com/apache/nifi/pull/2501
  
    Actually, I forgot to mention it last time but it would be great to have unit tests for this or, if unit tests are not easy to develop, have integration tests like you did with Mongo (assuming user is running a vanilla docker container when running the integration tests).


---

[GitHub] nifi issue #2501: NIFI-4743 Added configurable null suppression to PutElasti...

Posted by MikeThomsen <gi...@git.apache.org>.
Github user MikeThomsen commented on the issue:

    https://github.com/apache/nifi/pull/2501
  
    @pvillard31 Can you close this?


---

[GitHub] nifi issue #2501: NIFI-4743 Added configurable null suppression to PutElasti...

Posted by MikeThomsen <gi...@git.apache.org>.
Github user MikeThomsen commented on the issue:

    https://github.com/apache/nifi/pull/2501
  
    Ok.


---

[GitHub] nifi pull request #2501: NIFI-4743 Added configurable null suppression to Pu...

Posted by pvillard31 <gi...@git.apache.org>.
Github user pvillard31 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2501#discussion_r174062211
  
    --- Diff: nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-processors/src/main/java/org/apache/nifi/processors/elasticsearch/NullSuppression.java ---
    @@ -0,0 +1,24 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.nifi.processors.elasticsearch;
    +
    +public enum NullSuppression {
    +    ALWAYS_SUPPRESS,
    +    NEVER_SUPPRESS,
    +    SUPPRESS_MISSING
    --- End diff --
    
    Not sure to see what is the value of an enum since we already have the allowable values, no?


---

[GitHub] nifi issue #2501: NIFI-4743 Added configurable null suppression to PutElasti...

Posted by robertrbruno <gi...@git.apache.org>.
Github user robertrbruno commented on the issue:

    https://github.com/apache/nifi/pull/2501
  
    @MikeThomsen changes look good to me.


---

[GitHub] nifi issue #2501: NIFI-4743 Added configurable null suppression to PutElasti...

Posted by MikeThomsen <gi...@git.apache.org>.
Github user MikeThomsen commented on the issue:

    https://github.com/apache/nifi/pull/2501
  
    @pvillard31 I think we can close this one too.


---

[GitHub] nifi pull request #2501: NIFI-4743 Added configurable null suppression to Pu...

Posted by robertrbruno <gi...@git.apache.org>.
Github user robertrbruno commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2501#discussion_r174305856
  
    --- Diff: nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-processors/src/main/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchHttpRecord.java ---
    @@ -284,6 +306,17 @@ public void onTrigger(final ProcessContext context, final ProcessSession session
                     return;
             }
     
    +        final NullSuppression suppression;
    --- End diff --
    
    Agreed that this.nullSuppression could be directly set without the need of this variable.


---

[GitHub] nifi pull request #2501: NIFI-4743 Added configurable null suppression to Pu...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

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


---

[GitHub] nifi issue #2501: NIFI-4743 Added configurable null suppression to PutElasti...

Posted by pvillard31 <gi...@git.apache.org>.
Github user pvillard31 commented on the issue:

    https://github.com/apache/nifi/pull/2501
  
    Thanks @MikeThomsen - will try to have a look this evening.


---

[GitHub] nifi issue #2501: NIFI-4743 Added configurable null suppression to PutElasti...

Posted by robertrbruno <gi...@git.apache.org>.
Github user robertrbruno commented on the issue:

    https://github.com/apache/nifi/pull/2501
  
    Gave your addition a quick look.   You should be fine, but I believe unnecessary since the writevalue function will never be called when the value is "null" due to the continue statement that happen when a null is found.  Again will not hurt though.  Double check my logic for sure.  I wrestled with that for a bit as well.


---

[GitHub] nifi pull request #2501: NIFI-4743 Added configurable null suppression to Pu...

Posted by MikeThomsen <gi...@git.apache.org>.
Github user MikeThomsen commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2501#discussion_r174483710
  
    --- Diff: nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-processors/src/main/java/org/apache/nifi/processors/elasticsearch/NullSuppression.java ---
    @@ -0,0 +1,24 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.nifi.processors.elasticsearch;
    +
    +public enum NullSuppression {
    +    ALWAYS_SUPPRESS,
    +    NEVER_SUPPRESS,
    +    SUPPRESS_MISSING
    --- End diff --
    
    Done.


---