[
https://issues.apache.org/jira/browse/DRILL-5230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15851806#comment-15851806
]
ASF GitHub Bot commented on DRILL-5230:
---------------------------------------
Github user paul-rogers commented on a diff in the pull request:
https://github.com/apache/drill/pull/739#discussion_r99385729
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/TableBuilder.java
---
@@ -78,29 +93,8 @@ public void appendTime(final long d, final String link) {
}
public void appendMillis(final long p, final String link) {
- final double secs = p/1000.0;
- final double mins = secs/60;
- final double hours = mins/60;
- final double days = hours / 24;
- SimpleDateFormat timeFormat = null;
- if (days >= 10) {
- timeFormat = this.days;
- } else if (days >= 1) {
- timeFormat = this.sdays;
- } else if (hours >= 10) {
- timeFormat = this.hours;
- }else if(hours >= 1){
- timeFormat = this.shours;
- }else if (mins >= 10){
- timeFormat = this.mins;
- }else if (mins >= 1){
- timeFormat = this.smins;
- }else if (secs >= 10){
- timeFormat = this.secs;
- }else {
- timeFormat = this.ssecs;
- }
- appendCell(timeFormat.format(new Date(p)), null);
+ String shortReadableDuration = shortDurationFormat(p);
+ appendCell(shortReadableDuration, link);
--- End diff --
In Drill, we like brevity:
```
appendCell(shortDurationFormat(p), link);
```
> Translation of millisecond duration into hours is incorrect
> -----------------------------------------------------------
>
> Key: DRILL-5230
> URL: https://issues.apache.org/jira/browse/DRILL-5230
> Project: Apache Drill
> Issue Type: Bug
> Components: Web Server
> Affects Versions: 1.9.0
> Reporter: Kunal Khatua
> Labels: easyfix, ready-to-commit
> Fix For: 1.10.0
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> The method
> {code:JAVA}org.apache.drill.exec.server.rest.profile.TableBuilder.appendMillis(long,
> String){code}
> has a bug where the human readable translation of a 1+ hr duration in
> milliseconds is reported incorrectly.
> This has to do with the {code:JAVA}SimpleDateFormat.format() {code} method
> incorectly translating it.
> For e.g.
> {code:JAVA}
> long x = 4545342L; //1 hour 15 min 45.342 sec
> public void appendMillis(x, null);
> {code}
> This formats the value as {noformat}17h15m{noformat} instead of
> {noformat}1h15m{noformat}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)