shahidki31 commented on a change in pull request #26756: 
[SPARK-30119][WebUI]Support Pagination for Batch Tables in Streaming Tab
URL: https://github.com/apache/spark/pull/26756#discussion_r358000411
 
 

 ##########
 File path: 
streaming/src/main/scala/org/apache/spark/streaming/ui/AllBatchesTable.scala
 ##########
 @@ -17,39 +17,122 @@
 
 package org.apache.spark.streaming.ui
 
-import scala.xml.Node
+import java.net.URLEncoder
+import java.nio.charset.StandardCharsets.UTF_8
+import javax.servlet.http.HttpServletRequest
+
+import scala.xml.{Node, Unparsed}
+
+import org.apache.spark.ui.{PagedDataSource, PagedTable, UIUtils => 
SparkUIUtils}
+
+private[ui] class StreamingBatchPagedTable(
+    request: HttpServletRequest,
+    parent: StreamingTab,
+    batchInterval: Long,
+    batchData: Seq[BatchUIData],
+    streamingBatchTag: String,
+    basePath: String,
+    subPath: String,
+    parameterOtherTable: Iterable[String],
+    pageSize: Int,
+    sortColumn: String,
+    desc: Boolean) extends PagedTable[BatchUIData] {
+
+  override val dataSource = new StreamingBatchTableDataSource(batchData, 
pageSize, sortColumn, desc)
+  private val parameterPath = 
s"$basePath/$subPath/?${parameterOtherTable.mkString("&")}"
+  private val firstFailureReason = getFirstFailureReason(batchData)
+
+  override def tableId: String = streamingBatchTag
+
+  override def tableCssClass: String =
+    "table table-bordered table-condensed table-striped " +
+      "table-head-clickable table-cell-width-limited"
+
+  override def pageLink(page: Int): String = {
+    val encodedSortColumn = URLEncoder.encode(sortColumn, UTF_8.name())
+    parameterPath +
+      s"&$pageNumberFormField=$page" +
+      s"&$streamingBatchTag.sort=$encodedSortColumn" +
+      s"&$streamingBatchTag.desc=$desc" +
+      s"&$pageSizeFormField=$pageSize"
+  }
 
-import org.apache.spark.ui.{UIUtils => SparkUIUtils}
+  override def pageSizeFormField: String = s"$streamingBatchTag.pageSize"
 
-private[ui] abstract class BatchTableBase(tableId: String, batchInterval: 
Long) {
+  override def pageNumberFormField: String = s"$streamingBatchTag.page"
 
-  protected def columns: Seq[Node] = {
-    <th>Batch Time</th>
-      <th>Records</th>
-      <th>Scheduling Delay
-        {SparkUIUtils.tooltip("Time taken by Streaming scheduler to submit 
jobs of a batch", "top")}
-      </th>
-      <th>Processing Time
-        {SparkUIUtils.tooltip("Time taken to process all jobs of a batch", 
"top")}</th>
+  override def goButtonFormPath: String = {
+    val encodedSortColumn = URLEncoder.encode(sortColumn, UTF_8.name())
+    
s"$parameterPath&$streamingBatchTag.sort=$encodedSortColumn&$streamingBatchTag.desc=$desc"
 
 Review comment:
   Here also it seems we need to add `#tableHeaderId` ?
   
https://github.com/apache/spark/blob/67b644c3d74b0587dd5d498b903383ac4de932fe/sql/core/src/main/scala/org/apache/spark/sql/execution/ui/AllExecutionsPage.scala#L268

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to