Skip to content

Commit 93ac4e1

Browse files
amanomersrowen
authored andcommitted
[SPARK-29053][WEBUI] Sort does not work on some columns
### What changes were proposed in this pull request? Setting custom sort key for duration and execution time column. ### Why are the changes needed? Sorting on duration and execution time columns consider time as a string after converting into readable form which is the reason for wrong sort results as mentioned in [SPARK-29053](https://issues.apache.org/jira/browse/SPARK-29053). ### Does this PR introduce any user-facing change? No ### How was this patch tested? Test manually. Screenshots are attached. After patch: **Duration** ![Duration](https://user-images.githubusercontent.com/40591404/65339861-93cc9800-dbea-11e9-95e6-63b107a5a372.png) **Execution time** ![Execution Time](https://user-images.githubusercontent.com/40591404/65339870-97601f00-dbea-11e9-9d1d-690c59bc1bde.png) Closes #25855 from amanomer/SPARK29053. Authored-by: aman_omer <amanomer1996@gmail.com> Signed-off-by: Sean Owen <sean.owen@databricks.com>
1 parent 076186e commit 93ac4e1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/ui/ThriftServerPage.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,10 @@ private[ui] class ThriftServerPage(parent: ThriftServerTab) extends WebUIPage(""
9191
<td>{formatDate(info.startTimestamp)}</td>
9292
<td>{if (info.finishTimestamp > 0) formatDate(info.finishTimestamp)}</td>
9393
<td>{if (info.closeTimestamp > 0) formatDate(info.closeTimestamp)}</td>
94-
<td>{formatDurationOption(Some(info.totalTime(info.finishTimestamp)))}</td>
95-
<td>{formatDurationOption(Some(info.totalTime(info.closeTimestamp)))}</td>
94+
<td sorttable_customkey={info.totalTime(info.finishTimestamp).toString}>
95+
{formatDurationOption(Some(info.totalTime(info.finishTimestamp)))} </td>
96+
<td sorttable_customkey={info.totalTime(info.closeTimestamp).toString}>
97+
{formatDurationOption(Some(info.totalTime(info.closeTimestamp)))} </td>
9698
<td>{info.statement}</td>
9799
<td>{info.state}</td>
98100
{errorMessageCell(detail)}
@@ -157,7 +159,8 @@ private[ui] class ThriftServerPage(parent: ThriftServerTab) extends WebUIPage(""
157159
<td> <a href={sessionLink}> {session.sessionId} </a> </td>
158160
<td> {formatDate(session.startTimestamp)} </td>
159161
<td> {if (session.finishTimestamp > 0) formatDate(session.finishTimestamp)} </td>
160-
<td> {formatDurationOption(Some(session.totalTime))} </td>
162+
<td sorttable_customkey={session.totalTime.toString}>
163+
{formatDurationOption(Some(session.totalTime))} </td>
161164
<td> {session.totalExecution.toString} </td>
162165
</tr>
163166
}

0 commit comments

Comments
 (0)