HeartSaVioR commented on a change in pull request #26201: [SPARK-29543][SS][UI] 
Init structured streaming ui
URL: https://github.com/apache/spark/pull/26201#discussion_r350005086
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/StreamQueryStore.scala
 ##########
 @@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.streaming
+
+import java.util.UUID
+import java.util.concurrent.ConcurrentHashMap
+
+import scala.collection.JavaConverters._
+
+import org.apache.spark.sql.streaming.StreamingQuery
+
+/**
+ * A class that holds [[StreamingQuery]] active across all sessions to manage 
the lifecycle
+ * of the stream.
+ */
+private[sql] class StreamQueryStore {
+  private val activeStreamingQueries = new ConcurrentHashMap[UUID, 
(StreamingQuery, Long)]()
+  // There maybe more than one inactive stream query with same query ID, as we 
can run same
+  // stream query many times after it failed or terminated.
+  private val inactiveStreamingQueries = new ConcurrentHashMap[(UUID, Long), 
StreamingQuery]()
 
 Review comment:
   I'd like to hear the voices of tracking inactive streaming queries (with 
details), as it brings the code complexity as well as query information will be 
no longer be cleaned up. Technically, the only reason of introducing 
StreamQueryStore is tracking inactive streaming queries - otherwise existing 
`activeStreamingQueries` can serve the necessary features well.

----------------------------------------------------------------
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