[jira] [Commented] (NIFI-5060) UpdateRecord substringAfter and substringAfterLast only increments by 1

2018-04-25 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/NIFI-5060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16452953#comment-16452953
 ] 

ASF GitHub Bot commented on NIFI-5060:
--

Github user markap14 commented on the issue:

https://github.com/apache/nifi/pull/2623
  
@GreenCee thanks for submitting the JIRA, and the PR! Code looks good. Was 
able to verify that it addresses the issue. +1 merged to master! Thanks again.


> UpdateRecord substringAfter and substringAfterLast only increments by 1
> ---
>
> Key: NIFI-5060
> URL: https://issues.apache.org/jira/browse/NIFI-5060
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Extensions
>Affects Versions: 1.5.0, 1.6.0
>Reporter: Chris Green
>Priority: Major
>  Labels: easyfix, newbie
> Attachments: Validate_substringafter_Behavior.xml
>
>
> This is my first submitted issue, so please feel free to point me in the 
> correct direction if I make process mistakes.
> Replication:
> Drag a GenerateFlowFile onto the canvas and configure this property, and set 
> run schedule to some high value like 600 seconds
> "Custom Text" \{"value": "01230123"}
> Connect GenerateFlowFile with an UpdateAttribute set to add the attribute 
> "avro.schema" with a value of 
>  
> {code:java}
> { 
> "type": "record", 
> "name": "test", 
> "fields" : [{"name": "value", "type": "string"}]
> }
> {code}
>  
>  
> Connect UpdateAttribute to an UpdateRecord onto the canvas, Autoterminate 
> success and failure. Set the Record Reader to a new JSONTreeReader. On the 
> JsonTreeReader configure it to use the "Use 'Schema Text' Attribute".
> Create a JsonRecordSetWriter and set the Schema Text to:
>  
>  
> {code:java}
> { 
> "type": "record", 
> "name": "test", 
> "fields" : [
> {"name": "value", "type": "string"},
> {"name": "example1", "type": "string"},
> {"name": "example2", "type": "string"},
> {"name": "example3", "type": "string"},
> {"name": "example4", "type": "string"}
> ]
>  }
> {code}
>  
> Add the following properties to UpdateRecord
>  
> ||Heading 1||Heading 2||
> |/example1|substringAfter(/value, "1") |
> |/example2|substringAfter(/value, "123") |
> |/example3|substringAfterLast(/value, "1")|
> |/example4|substringAfterLast(/value, "123")|
>  
> Resulting record currently:
>  
> {code:java}
> [{ 
> "value" : "01230123", 
> "example1" : "230123", 
> "example2" : "30123", 
> "example3" : "23", 
> "example4" : "3" 
> }]
> {code}
>  
>  
>  
> Problem:
> When using the UpdateRecord processor, and the substringAfter() function 
> after the search phrase is found it will only increment the substring 
> returned by 1 rather than the length of the search term. 
> Based off XPath and other implementations of substringAfter functions I've 
> seen the value returned should remove the search term rather than just the 
> first character of the search term.
>  
>  
> Resulting record should be:
>  
> {code:java}
> [{ 
> "value" : "01230123", 
> "example1" : "230123", 
> "example2" : "0123", 
> "example3" : "23", 
> "example4" : "" 
> }]
> {code}
>  
>  
> I'm cleaning up a fix with test code that will change the increment from 1 to 
> the length of the search terms. 
> It appears substringBefore are not impacted by the behavior as always returns 
> the index before the found search term which is the expected behavior



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (NIFI-5060) UpdateRecord substringAfter and substringAfterLast only increments by 1

2018-04-25 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/NIFI-5060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16452951#comment-16452951
 ] 

ASF GitHub Bot commented on NIFI-5060:
--

Github user asfgit closed the pull request at:

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


> UpdateRecord substringAfter and substringAfterLast only increments by 1
> ---
>
> Key: NIFI-5060
> URL: https://issues.apache.org/jira/browse/NIFI-5060
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Extensions
>Affects Versions: 1.5.0, 1.6.0
>Reporter: Chris Green
>Priority: Major
>  Labels: easyfix, newbie
> Attachments: Validate_substringafter_Behavior.xml
>
>
> This is my first submitted issue, so please feel free to point me in the 
> correct direction if I make process mistakes.
> Replication:
> Drag a GenerateFlowFile onto the canvas and configure this property, and set 
> run schedule to some high value like 600 seconds
> "Custom Text" \{"value": "01230123"}
> Connect GenerateFlowFile with an UpdateAttribute set to add the attribute 
> "avro.schema" with a value of 
>  
> {code:java}
> { 
> "type": "record", 
> "name": "test", 
> "fields" : [{"name": "value", "type": "string"}]
> }
> {code}
>  
>  
> Connect UpdateAttribute to an UpdateRecord onto the canvas, Autoterminate 
> success and failure. Set the Record Reader to a new JSONTreeReader. On the 
> JsonTreeReader configure it to use the "Use 'Schema Text' Attribute".
> Create a JsonRecordSetWriter and set the Schema Text to:
>  
>  
> {code:java}
> { 
> "type": "record", 
> "name": "test", 
> "fields" : [
> {"name": "value", "type": "string"},
> {"name": "example1", "type": "string"},
> {"name": "example2", "type": "string"},
> {"name": "example3", "type": "string"},
> {"name": "example4", "type": "string"}
> ]
>  }
> {code}
>  
> Add the following properties to UpdateRecord
>  
> ||Heading 1||Heading 2||
> |/example1|substringAfter(/value, "1") |
> |/example2|substringAfter(/value, "123") |
> |/example3|substringAfterLast(/value, "1")|
> |/example4|substringAfterLast(/value, "123")|
>  
> Resulting record currently:
>  
> {code:java}
> [{ 
> "value" : "01230123", 
> "example1" : "230123", 
> "example2" : "30123", 
> "example3" : "23", 
> "example4" : "3" 
> }]
> {code}
>  
>  
>  
> Problem:
> When using the UpdateRecord processor, and the substringAfter() function 
> after the search phrase is found it will only increment the substring 
> returned by 1 rather than the length of the search term. 
> Based off XPath and other implementations of substringAfter functions I've 
> seen the value returned should remove the search term rather than just the 
> first character of the search term.
>  
>  
> Resulting record should be:
>  
> {code:java}
> [{ 
> "value" : "01230123", 
> "example1" : "230123", 
> "example2" : "0123", 
> "example3" : "23", 
> "example4" : "" 
> }]
> {code}
>  
>  
> I'm cleaning up a fix with test code that will change the increment from 1 to 
> the length of the search terms. 
> It appears substringBefore are not impacted by the behavior as always returns 
> the index before the found search term which is the expected behavior



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (NIFI-5060) UpdateRecord substringAfter and substringAfterLast only increments by 1

2018-04-25 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/NIFI-5060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16452949#comment-16452949
 ] 

ASF subversion and git services commented on NIFI-5060:
---

Commit fdea876ede6b503c703e9a816e9a29137be868f9 in nifi's branch 
refs/heads/master from [~greenCee]
[ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=fdea876 ]

NIFI-5060 Updated SubstringAfter record processing to support multi-character 
search trimming

This closes #2623.

Signed-off-by: Mark Payne 


> UpdateRecord substringAfter and substringAfterLast only increments by 1
> ---
>
> Key: NIFI-5060
> URL: https://issues.apache.org/jira/browse/NIFI-5060
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Extensions
>Affects Versions: 1.5.0, 1.6.0
>Reporter: Chris Green
>Priority: Major
>  Labels: easyfix, newbie
> Attachments: Validate_substringafter_Behavior.xml
>
>
> This is my first submitted issue, so please feel free to point me in the 
> correct direction if I make process mistakes.
> Replication:
> Drag a GenerateFlowFile onto the canvas and configure this property, and set 
> run schedule to some high value like 600 seconds
> "Custom Text" \{"value": "01230123"}
> Connect GenerateFlowFile with an UpdateAttribute set to add the attribute 
> "avro.schema" with a value of 
>  
> {code:java}
> { 
> "type": "record", 
> "name": "test", 
> "fields" : [{"name": "value", "type": "string"}]
> }
> {code}
>  
>  
> Connect UpdateAttribute to an UpdateRecord onto the canvas, Autoterminate 
> success and failure. Set the Record Reader to a new JSONTreeReader. On the 
> JsonTreeReader configure it to use the "Use 'Schema Text' Attribute".
> Create a JsonRecordSetWriter and set the Schema Text to:
>  
>  
> {code:java}
> { 
> "type": "record", 
> "name": "test", 
> "fields" : [
> {"name": "value", "type": "string"},
> {"name": "example1", "type": "string"},
> {"name": "example2", "type": "string"},
> {"name": "example3", "type": "string"},
> {"name": "example4", "type": "string"}
> ]
>  }
> {code}
>  
> Add the following properties to UpdateRecord
>  
> ||Heading 1||Heading 2||
> |/example1|substringAfter(/value, "1") |
> |/example2|substringAfter(/value, "123") |
> |/example3|substringAfterLast(/value, "1")|
> |/example4|substringAfterLast(/value, "123")|
>  
> Resulting record currently:
>  
> {code:java}
> [{ 
> "value" : "01230123", 
> "example1" : "230123", 
> "example2" : "30123", 
> "example3" : "23", 
> "example4" : "3" 
> }]
> {code}
>  
>  
>  
> Problem:
> When using the UpdateRecord processor, and the substringAfter() function 
> after the search phrase is found it will only increment the substring 
> returned by 1 rather than the length of the search term. 
> Based off XPath and other implementations of substringAfter functions I've 
> seen the value returned should remove the search term rather than just the 
> first character of the search term.
>  
>  
> Resulting record should be:
>  
> {code:java}
> [{ 
> "value" : "01230123", 
> "example1" : "230123", 
> "example2" : "0123", 
> "example3" : "23", 
> "example4" : "" 
> }]
> {code}
>  
>  
> I'm cleaning up a fix with test code that will change the increment from 1 to 
> the length of the search terms. 
> It appears substringBefore are not impacted by the behavior as always returns 
> the index before the found search term which is the expected behavior



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (NIFI-5060) UpdateRecord substringAfter and substringAfterLast only increments by 1

2018-04-11 Thread Pierre Villard (JIRA)

[ 
https://issues.apache.org/jira/browse/NIFI-5060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16434468#comment-16434468
 ] 

Pierre Villard commented on NIFI-5060:
--

Hi [~ioneethling], welcome in the NiFi community and thanks for having a look 
at how to contribute. I'd suggest you to have a look at the documentation on 
this subject: 
[https://cwiki.apache.org/confluence/display/NIFI/Contributor+Guide]

Also, if you pick a Jira you want to work on, I'd recommend ensuring no one is 
working on it yet. For this one you can see that a pull request is already 
opened. However you're more than welcome to help reviewing the PR by giving it 
a try and commenting/sharing your thoughts on the Github PR page. For 
NIFI-4908, there is also existing PRs, and I'm sure we'd highly appreciate help 
to review the new processors. For NIFI-4517, best is to discuss your thoughts 
on the Jira if you're not sure how to proceed, otherwise you can go ahead and 
submit a PR on github.

> UpdateRecord substringAfter and substringAfterLast only increments by 1
> ---
>
> Key: NIFI-5060
> URL: https://issues.apache.org/jira/browse/NIFI-5060
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Extensions
>Affects Versions: 1.6.0
>Reporter: Chris Green
>Priority: Major
>  Labels: easyfix, newbie
> Attachments: Validate_substringafter_Behavior.xml
>
>
> This is my first submitted issue, so please feel free to point me in the 
> correct direction if I make process mistakes.
> Replication:
> Drag a GenerateFlowFile onto the canvas and configure this property, and set 
> run schedule to some high value like 600 seconds
> "Custom Text" \{"value": "01230123"}
> Connect GenerateFlowFile with an UpdateAttribute set to add the attribute 
> "avro.schema" with a value of 
>  
> {code:java}
> { 
> "type": "record", 
> "name": "test", 
> "fields" : [{"name": "value", "type": "string"}]
> }
> {code}
>  
>  
> Connect UpdateAttribute to an UpdateRecord onto the canvas, Autoterminate 
> success and failure. Set the Record Reader to a new JSONTreeReader. On the 
> JsonTreeReader configure it to use the "Use 'Schema Text' Attribute".
> Create a JsonRecordSetWriter and set the Schema Text to:
>  
>  
> {code:java}
> { 
> "type": "record", 
> "name": "test", 
> "fields" : [
> {"name": "value", "type": "string"},
> {"name": "example1", "type": "string"},
> {"name": "example2", "type": "string"},
> {"name": "example3", "type": "string"},
> {"name": "example4", "type": "string"}
> ]
>  }
> {code}
>  
> Add the following properties to UpdateRecord
>  
> ||Heading 1||Heading 2||
> |/example1|substringAfter(/value, "1") |
> |/example2|substringAfter(/value, "123") |
> |/example3|substringAfterLast(/value, "1")|
> |/example4|substringAfterLast(/value, "123")|
>  
> Resulting record currently:
>  
> {code:java}
> [{ 
> "value" : "01230123", 
> "example1" : "230123", 
> "example2" : "30123", 
> "example3" : "23", 
> "example4" : "3" 
> }]
> {code}
>  
>  
>  
> Problem:
> When using the UpdateRecord processor, and the substringAfter() function 
> after the search phrase is found it will only increment the substring 
> returned by 1 rather than the length of the search term. 
> Based off XPath and other implementations of substringAfter functions I've 
> seen the value returned should remove the search term rather than just the 
> first character of the search term.
>  
>  
> Resulting record should be:
>  
> {code:java}
> [{ 
> "value" : "01230123", 
> "example1" : "230123", 
> "example2" : "0123", 
> "example3" : "23", 
> "example4" : "" 
> }]
> {code}
>  
>  
> I'm cleaning up a fix with test code that will change the increment from 1 to 
> the length of the search terms. 
> It appears substringBefore are not impacted by the behavior as always returns 
> the index before the found search term which is the expected behavior



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (NIFI-5060) UpdateRecord substringAfter and substringAfterLast only increments by 1

2018-04-11 Thread Ian Neethling (JIRA)

[ 
https://issues.apache.org/jira/browse/NIFI-5060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16433502#comment-16433502
 ] 

Ian Neethling commented on NIFI-5060:
-

Hi, I am pretty new here, how does one go about taking on one of these newbie 
tasks?

> UpdateRecord substringAfter and substringAfterLast only increments by 1
> ---
>
> Key: NIFI-5060
> URL: https://issues.apache.org/jira/browse/NIFI-5060
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Extensions
>Affects Versions: 1.6.0
>Reporter: Chris Green
>Priority: Major
>  Labels: easyfix, newbie
> Attachments: Validate_substringafter_Behavior.xml
>
>
> This is my first submitted issue, so please feel free to point me in the 
> correct direction if I make process mistakes.
> Replication:
> Drag a GenerateFlowFile onto the canvas and configure this property, and set 
> run schedule to some high value like 600 seconds
> "Custom Text" \{"value": "01230123"}
> Connect GenerateFlowFile with an UpdateAttribute set to add the attribute 
> "avro.schema" with a value of 
>  
> {code:java}
> { 
> "type": "record", 
> "name": "test", 
> "fields" : [{"name": "value", "type": "string"}]
> }
> {code}
>  
>  
> Connect UpdateAttribute to an UpdateRecord onto the canvas, Autoterminate 
> success and failure. Set the Record Reader to a new JSONTreeReader. On the 
> JsonTreeReader configure it to use the "Use 'Schema Text' Attribute".
> Create a JsonRecordSetWriter and set the Schema Text to:
>  
>  
> {code:java}
> { 
> "type": "record", 
> "name": "test", 
> "fields" : [
> {"name": "value", "type": "string"},
> {"name": "example1", "type": "string"},
> {"name": "example2", "type": "string"},
> {"name": "example3", "type": "string"},
> {"name": "example4", "type": "string"}
> ]
>  }
> {code}
>  
> Add the following properties to UpdateRecord
>  
> ||Heading 1||Heading 2||
> |/example1|substringAfter(/value, "1") |
> |/example2|substringAfter(/value, "123") |
> |/example3|substringAfterLast(/value, "1")|
> |/example4|substringAfterLast(/value, "123")|
>  
> Resulting record currently:
>  
> {code:java}
> [{ 
> "value" : "01230123", 
> "example1" : "230123", 
> "example2" : "30123", 
> "example3" : "23", 
> "example4" : "3" 
> }]
> {code}
>  
>  
>  
> Problem:
> When using the UpdateRecord processor, and the substringAfter() function 
> after the search phrase is found it will only increment the substring 
> returned by 1 rather than the length of the search term. 
> Based off XPath and other implementations of substringAfter functions I've 
> seen the value returned should remove the search term rather than just the 
> first character of the search term.
>  
>  
> Resulting record should be:
>  
> {code:java}
> [{ 
> "value" : "01230123", 
> "example1" : "230123", 
> "example2" : "0123", 
> "example3" : "23", 
> "example4" : "" 
> }]
> {code}
>  
>  
> I'm cleaning up a fix with test code that will change the increment from 1 to 
> the length of the search terms. 
> It appears substringBefore are not impacted by the behavior as always returns 
> the index before the found search term which is the expected behavior



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (NIFI-5060) UpdateRecord substringAfter and substringAfterLast only increments by 1

2018-04-10 Thread Chris Green (JIRA)

[ 
https://issues.apache.org/jira/browse/NIFI-5060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16432226#comment-16432226
 ] 

Chris Green commented on NIFI-5060:
---

Good catch, I corrected the description and put them in codeblocks so its a 
little easier to read.

> UpdateRecord substringAfter and substringAfterLast only increments by 1
> ---
>
> Key: NIFI-5060
> URL: https://issues.apache.org/jira/browse/NIFI-5060
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Extensions
>Affects Versions: 1.6.0
>Reporter: Chris Green
>Priority: Major
>  Labels: easyfix, newbie
> Attachments: Validate_substringafter_Behavior.xml
>
>
> This is my first submitted issue, so please feel free to point me in the 
> correct direction if I make process mistakes.
> Replication:
> Drag a GenerateFlowFile onto the canvas and configure this property, and set 
> run schedule to some high value like 600 seconds
> "Custom Text" \{"value": "01230123"}
> Connect GenerateFlowFile with an UpdateAttribute set to add the attribute 
> "avro.schema" with a value of 
>  
> {code:java}
> { 
> "type": "record", 
> "name": "test", 
> "fields" : [{"name": "value", "type": "string"}]
> }
> {code}
>  
>  
> Connect UpdateAttribute to an UpdateRecord onto the canvas, Autoterminate 
> success and failure. Set the Record Reader to a new JSONTreeReader. On the 
> JsonTreeReader configure it to use the "Use 'Schema Text' Attribute".
> Create a JsonRecordSetWriter and set the Schema Text to:
>  
>  
> {code:java}
> { 
> "type": "record", 
> "name": "test", 
> "fields" : [
> {"name": "value", "type": "string"},
> {"name": "example1", "type": "string"},
> {"name": "example2", "type": "string"},
> {"name": "example3", "type": "string"},
> {"name": "example4", "type": "string"}
> ]
>  }
> {code}
>  
> Add the following properties to UpdateRecord
>  
> ||Heading 1||Heading 2||
> |/example1|substringAfter(/value, "1") |
> |/example2|substringAfter(/value, "123") |
> |/example3|substringAfterLast(/value, "1")|
> |/example4|substringAfterLast(/value, "123")|
>  
> Resulting record currently:
>  
> {code:java}
> [{ 
> "value" : "01230123", 
> "example1" : "230123", 
> "example2" : "30123", 
> "example3" : "23", 
> "example4" : "3" 
> }]
> {code}
>  
>  
>  
> Problem:
> When using the UpdateRecord processor, and the substringAfter() function 
> after the search phrase is found it will only increment the substring 
> returned by 1 rather than the length of the search term. 
> Based off XPath and other implementations of substringAfter functions I've 
> seen the value returned should remove the search term rather than just the 
> first character of the search term.
>  
>  
> Resulting record should be:
>  
> {code:java}
> [{ 
> "value" : "01230123", 
> "example1" : "230123", 
> "example2" : "0123", 
> "example3" : "23", 
> "example4" : "" 
> }]
> {code}
>  
>  
> I'm cleaning up a fix with test code that will change the increment from 1 to 
> the length of the search terms. 
> It appears substringBefore are not impacted by the behavior as always returns 
> the index before the found search term which is the expected behavior



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (NIFI-5060) UpdateRecord substringAfter and substringAfterLast only increments by 1

2018-04-10 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/NIFI-5060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16432224#comment-16432224
 ] 

ASF GitHub Bot commented on NIFI-5060:
--

GitHub user GreenCee opened a pull request:

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

NIFI-5060 Updated SubstringAfter record processing to support multi-c…

…haracter search trimming

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.

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

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

### For code changes:
- [X] 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?
- [N/A] 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)? 
- [N/A] If applicable, have you updated the LICENSE file, including the 
main LICENSE file under nifi-assembly?
- [N/A] If applicable, have you updated the NOTICE file, including the main 
NOTICE file found under nifi-assembly?
- [N/A] If adding new Properties, have you added .displayName in addition 
to .name (programmatic access) for each of the new properties?

### For documentation related changes:
- [N/A] 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/GreenCee/nifi NIFI-5060

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

https://github.com/apache/nifi/pull/2623.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 #2623






> UpdateRecord substringAfter and substringAfterLast only increments by 1
> ---
>
> Key: NIFI-5060
> URL: https://issues.apache.org/jira/browse/NIFI-5060
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Extensions
>Affects Versions: 1.6.0
>Reporter: Chris Green
>Priority: Major
>  Labels: easyfix, newbie
> Attachments: Validate_substringafter_Behavior.xml
>
>
> This is my first submitted issue, so please feel free to point me in the 
> correct direction if I make process mistakes.
> Replication:
> Drag a GenerateFlowFile onto the canvas and configure this property, and set 
> run schedule to some high value like 600 seconds
> "Custom Text" \{"value": "01230123"}
> Connect GenerateFlowFile with an UpdateAttribute set to add the attribute 
> "avro.schema" with a value of 
>  
> {code:java}
> { 
> "type": "record", 
> "name": "test", 
> "fields" : [{"name": "value", "type": "string"}]
> }
> {code}
>  
>  
> Connect UpdateAttribute to an UpdateRecord onto the canvas, Autoterminate 
> success and failure. Set the Record Reader to a new JSONTreeReader. On the 
> JsonTreeReader configure it to use the "Use 'Schema Text' Attribute".
> Create a JsonRecordSetWriter and set the Schema Text to:
>  
>  
> {code:java}
> { 
> "type": "record", 
> "name": "test", 
> "fields" : [
> {"name": "value", "type": "string"},
> {"name": "example1", "type": "string"},
> {"name": "example2", "type": "string"},
> {"name": "example3", "type": "string"},
> {"name": "example4", "type": "string"}
> ]
>  }
> {code}
>  
> Add the following properties to UpdateRecord
>  
> ||Heading 1||Heading 2||
> |/example1|substringAfter(/value, "1") |
> |/example2|substringAfter(/value, "123") |
> |/example3|substringAfterLast(/value, "1")|
> |/example4|substringAfterLast(/value, "123")|
>  
> Resulting record currently:
>  
> {code:java}
> [{ 
> "value" : "01230123", 
> "example1" : "230123", 
> "example2" : "30123", 
> "example3" : "23", 
> "example4" : "3" 
> }]
> {code}
>  
>  
>  
> Problem:
> When using the UpdateRecord processor, and the substringAfter() function 
> after the search phrase is found it will 

[jira] [Commented] (NIFI-5060) UpdateRecord substringAfter and substringAfterLast only increments by 1

2018-04-09 Thread Mark Payne (JIRA)

[ 
https://issues.apache.org/jira/browse/NIFI-5060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16431092#comment-16431092
 ] 

Mark Payne commented on NIFI-5060:
--

[~greenCee] thanks for reporting the bug. I think you may have copied & pasted 
the same value for the "Resulting record currently" and "Resulting record 
should be". What I believe the Resulting Record should be is:
{code:java}
[
{ "value": "01230123", "example1": "230123", "example2": "0123", "example3": 
"23", "example4": "" }

]{code}
Do you agree?

> UpdateRecord substringAfter and substringAfterLast only increments by 1
> ---
>
> Key: NIFI-5060
> URL: https://issues.apache.org/jira/browse/NIFI-5060
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Extensions
>Affects Versions: 1.6.0
>Reporter: Chris Green
>Priority: Major
>  Labels: easyfix, newbie
> Attachments: Validate_substringafter_Behavior.xml
>
>
> This is my first submitted issue, so please feel free to point me in the 
> correct direction if I make process mistakes.
> Replication:
> Drag a GenerateFlowFile onto the canvas and configure this property, and set 
> run schedule to some high value like 600 seconds
> "Custom Text" \{"value": "01230123"}
> Connect GenerateFlowFile with an UpdateAttribute set to add the attribute 
> "avro.schema" with a value of "{ "type": "record",
>  "name": "test",
>  "fields" : [\{"name": "value", "type": "string"}]
> }"
>  
> Connect UpdateAttribute to an UpdateRecord onto the canvas, Autoterminate 
> success and failure. Set the Record Reader to a new JSONTreeReader. On the 
> JsonTreeReader configure it to use the "Use 'Schema Text' Attribute".
> Create a JsonRecordSetWriter and set the Schema Text to:
> "{ "type": "record",
> "name": "test",
> "fields" : [\{"name": "value", "type": "string"},
> {"name": "example1", "type": "string"},
> {"name": "example2", "type": "string"},
> {"name": "example3", "type": "string"},
> {"name": "example4", "type": "string"}]
> }"
> Add the following properties to UpdateRecord
>  
> ||Heading 1||Heading 2||
> |/example1|substringAfter(/value, "1") |
> |/example2|substringAfter(/value, "123") |
> |/example3|substringAfterLast(/value, "1")|
> |/example4|substringAfterLast(/value, "123")|
>  
> Resulting record currently:
> [ {
>  "value" : "01230123",
>  "example1" : "230123",
>  "example2" : "30123",
>  "example3" : "23",
>  "example4" : "3"
> } ]
>  
>  
> Problem:
> When using the UpdateRecord processor, and the substringAfter() function 
> after the search phrase is found it will only increment the substring 
> returned by 1 rather than the length of the search term. 
> Based off XPath and other implementations of substringAfter functions I've 
> seen the value returned should remove the search term rather than just the 
> first character of the search term.
>  
>  
> Resulting record should be:
> [ {
>  "value" : "01230123",
>  "example1" : "230123",
>  "example2" : "30123",
>  "example3" : "23",
>  "example4" : "3"
> } ]
>  
> I'm cleaning up a fix with test code that will change the increment from 1 to 
> the length of the search terms. 
> It appears substringBefore are not impacted by the behavior as always returns 
> the index before the found search term which is the expected behavior



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)