drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paul-rogers <...@git.apache.org>
Subject [GitHub] drill pull request #739: DRILL-5230: Translation of millisecond duration int...
Date Mon, 06 Feb 2017 23:26:57 GMT
Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/739#discussion_r99688930
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileResources.java
---
    @@ -73,18 +73,35 @@
        * e.g. getPrettyDuration(1468368841695,1468394096016) = '7 hr 00 min 54.321 sec'
        * @param startTimeMillis Start Time in milliseconds
        * @param endTimeMillis   End Time in milliseconds
    +   * @param format          Display format
        * @return                Human-Readable Elapsed Time
        */
    -  public static String getPrettyDuration(long startTimeMillis, long endTimeMillis) {
    +  public static String getPrettyDuration(long startTimeMillis, long endTimeMillis, DurationFormat
format) {
    --- End diff --
    
    It is often cleaner to just have two methods, rather than one method with a "command".
Since we need to split out the data into a bunch of fields, this can be done by another method
that creates a structure. Then, since you've created the structure, it might as well be the
class that does the format, and offer two format methods: compact and verbose.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message