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

ASF GitHub Bot commented on NIFI-5854:
--------------------------------------

GitHub user alopresto opened a pull request:

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

    NIFI-5854 Added TimeUnit enhancements (microseconds, decimal parsing)

    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-XXXX where XXXX 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)?
    
    - [ ] 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?
    - [ ] 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/alopresto/nifi NIFI-5854

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

    https://github.com/apache/nifi/pull/3193.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 #3193
    
----
commit 1d4ecd3e4c078e67a6a04c1ffda48d635cf66fb7
Author: Andy LoPresto <alopresto@...>
Date:   2018-11-30T04:17:58Z

    NIFI-5854 Added skeleton logic to convert decimal time units.
    Added helper methods.
    Added unit tests.

commit 50b7b6436454b3b0d7e36fd1f2139dd1f10b9067
Author: Andy LoPresto <alopresto@...>
Date:   2018-11-30T04:25:04Z

    NIFI-5854 [WIP] Cleaned up logic.
    Resolved failing unit tests due to error message change.

commit fc16cf37439e1bee5afe58adbfe61c31bc77df3f
Author: Andy LoPresto <alopresto@...>
Date:   2018-11-30T04:48:21Z

    NIFI-5854 [WIP] All helper method unit tests pass.

commit a0865667f03ad9e1a0ad46277045fa364720cd98
Author: Andy LoPresto <alopresto@...>
Date:   2018-11-30T05:15:27Z

    NIFI-5854 [WIP] FormatUtils#getPreciseTimeDuration() now handles all tested 
inputs correctly.
    Added unit tests.

commit d2031d5a06713b69f1323215afe87efc8d93428f
Author: Andy LoPresto <alopresto@...>
Date:   2018-11-30T19:39:34Z

    NIFI-5854 [WIP] FormatUtils#getTimeDuration() still using long.
    Added unit tests.
    Renamed existing unit tests to reflect method under test.

commit ed51f48a3bee3750864b1415b5e85b42422ecaaf
Author: Andy LoPresto <alopresto@...>
Date:   2018-11-30T20:13:57Z

    NIFI-5854 FormatUtils#getTimeDuration() returns long but now accepts 
decimal inputs.
    Added @Deprecation warnings (will update callers where possible).
    All unit tests pass.

----


> Enhance time unit features
> --------------------------
>
>                 Key: NIFI-5854
>                 URL: https://issues.apache.org/jira/browse/NIFI-5854
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Core Framework
>    Affects Versions: 1.8.0
>            Reporter: Andy LoPresto
>            Assignee: Andy LoPresto
>            Priority: Major
>              Labels: parsing, time, units
>
> There is some ambiguity with time units (specifically around processor 
> properties). Two features which I think should be added:
> * Currently only whole numbers are parsed correctly. For example, {{10 
> milliseconds}} and {{0.010 seconds}} are functionally equivalent, but only 
> the former will be parsed. This is due to the regex used in 
> {{StandardValidators.TIME_PERIOD_VALIDATOR}} which relies on 
> {{FormatUtils.TIME_DURATION_REGEX}} (see below). Decimal amounts should be 
> parsed
> * The enumerated time units are *nanoseconds, milliseconds, seconds, minutes, 
> hours, days, weeks*. While I don't intend to extend this to "millennia", etc. 
> as every unit including and above *months* would be ambiguous, *microseconds* 
> seems like a valid and missing unit
> *Definition of {{FormatUtils.TIME_DURATION_REGEX}}:*
> {code}
>     public static final String TIME_DURATION_REGEX = "(\\d+)\\s*(" + 
> VALID_TIME_UNITS + ")";
>     public static final Pattern TIME_DURATION_PATTERN = 
> Pattern.compile(TIME_DURATION_REGEX);
> {code}



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

Reply via email to