New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-15580][SQL]Add ContinuousQueryInfo to make ContinuousQueryListener events serializable #13335
[SPARK-15580][SQL]Add ContinuousQueryInfo to make ContinuousQueryListener events serializable #13335
Changes from 12 commits
4f7ee7f
e6bb76c
621a867
3669df2
9b539cd
7df7e9c
e5e405f
e665c26
00ccfdf
be4b8c3
8dfc105
3230a12
1f00c60
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* 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.streaming | ||
|
||
import org.apache.spark.annotation.Experimental | ||
|
||
/** | ||
* :: Experimental :: | ||
* A class used to report information about the progress of a [[ContinuousQuery]]. | ||
* | ||
* @param name The [[ContinuousQuery]] name | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Super Nit: missing period after name. |
||
* @param sourceStatuses The current statuses of the [[ContinuousQuery]]'s sources. | ||
* @param sinkStatus The current status of the [[ContinuousQuery]]'s sink. | ||
*/ | ||
@Experimental | ||
class ContinuousQueryInfo private[sql]( | ||
val name: String, | ||
val sourceStatuses: Seq[SourceStatus], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should also probably be an Array. No need to be a Seq. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Offline discussion: this is okay. this is how it is for SparkListener, and avoid problems like the array being accidentally modified internally by the listener generator. |
||
val sinkStatus: SinkStatus) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
package org.apache.spark.sql.streaming | ||
|
||
import org.apache.spark.annotation.Experimental | ||
import org.apache.spark.scheduler.SparkListenerEvent | ||
|
||
/** | ||
* :: Experimental :: | ||
|
@@ -70,26 +71,43 @@ abstract class ContinuousQueryListener { | |
object ContinuousQueryListener { | ||
|
||
/** | ||
* Base type of [[ContinuousQueryListener]] events. | ||
* :: Experimental :: | ||
* Base type of [[ContinuousQueryListener]] events | ||
* @since 2.0.0 | ||
*/ | ||
trait Event | ||
@Experimental | ||
trait Event extends SparkListenerEvent | ||
|
||
/** | ||
* Event representing the start of a query. | ||
* :: Experimental :: | ||
* Event representing the start of a query | ||
* @since 2.0.0 | ||
*/ | ||
class QueryStarted private[sql](val query: ContinuousQuery) extends Event | ||
@Experimental | ||
class QueryStarted private[sql](val queryInfo: ContinuousQueryInfo) extends Event | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldnt these also be marked with Experimental? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
||
/** | ||
* Event representing any progress updates in a query. | ||
* :: Experimental :: | ||
* Event representing any progress updates in a query | ||
* @since 2.0.0 | ||
*/ | ||
class QueryProgress private[sql](val query: ContinuousQuery) extends Event | ||
@Experimental | ||
class QueryProgress private[sql](val queryInfo: ContinuousQueryInfo) extends Event | ||
|
||
/** | ||
* Event representing that termination of a query. | ||
* :: Experimental :: | ||
* Event representing that termination of a query | ||
* | ||
* @param queryInfo Information about the status of the query. | ||
* @param exception The exception message of the [[ContinuousQuery]] if the query was terminated | ||
* with an exception. Otherwise, it will be `None`. | ||
* @param stackTrace The stack trace of the exception if the query was terminated with an | ||
* exception. It will be empty if there was no error. | ||
* @since 2.0.0 | ||
*/ | ||
class QueryTerminated private[sql](val query: ContinuousQuery) extends Event | ||
@Experimental | ||
class QueryTerminated private[sql]( | ||
val queryInfo: ContinuousQueryInfo, | ||
val exception: Option[String], | ||
val stackTrace: Seq[StackTraceElement]) extends Event | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isnt it more Java friendly to make this Array instead of Seq? It does not need to be Seq. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't want to expose a mutable Array to the user. Secondly, this one is not Java friendly already since it uses There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What mutable about this Array? And for Options, there is no workaround. And Option is pretty simple to deal with in Java. Seq is more annoying, need to look up Scala doc etc.? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. E.g., the user can change the content of an array. |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to make this a deep copy, especially for
sourceStatuses
andsinkStatus
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. They are immutable.