-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-44776][CONNECT] Add ProducedRowCount to SparkListenerConnectOperationFinished #42454
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
Changes from all commits
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 |
|---|---|---|
|
|
@@ -75,6 +75,8 @@ case class ExecuteEventsManager(executeHolder: ExecuteHolder, clock: Clock) { | |
|
|
||
| private var canceled = Option.empty[Boolean] | ||
|
|
||
| private var producedRowCount = Option.empty[Long] | ||
|
|
||
| /** | ||
| * @return | ||
| * Last event posted by the Connect request | ||
|
|
@@ -95,6 +97,13 @@ case class ExecuteEventsManager(executeHolder: ExecuteHolder, clock: Clock) { | |
| */ | ||
| private[connect] def hasError: Option[Boolean] = error | ||
|
|
||
| /** | ||
| * @return | ||
| * How many rows the Connect request has produced @link | ||
| * org.apache.spark.sql.connect.service.SparkListenerConnectOperationFinished | ||
| */ | ||
| private[connect] def getProducedRowCount: Option[Long] = producedRowCount | ||
|
|
||
| /** | ||
| * Post @link org.apache.spark.sql.connect.service.SparkListenerConnectOperationStarted. | ||
| */ | ||
|
|
@@ -192,13 +201,23 @@ case class ExecuteEventsManager(executeHolder: ExecuteHolder, clock: Clock) { | |
|
|
||
| /** | ||
| * Post @link org.apache.spark.sql.connect.service.SparkListenerConnectOperationFinished. | ||
| * @param producedRowsCountOpt | ||
| * Number of rows that are returned to the user. None is expected when the operation does not | ||
|
Member
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. QQ: why not use
Author
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 think returning None would make it clear to us whether the corresponding query should have produced row or not, for example for a SELECT statement that has no result, we would put 0 here. And for query Like INSERT INTO, we would put a None instead of 0 here. This could better tell us whether a produced row is expected or not
Contributor
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. Agreed with gjxdxh that it's clearer with None that no rows are expected for this operation. |
||
| * return any rows. | ||
| */ | ||
| def postFinished(): Unit = { | ||
| def postFinished(producedRowsCountOpt: Option[Long] = None): Unit = { | ||
| assertStatus( | ||
| List(ExecuteStatus.Started, ExecuteStatus.ReadyForExecution), | ||
| ExecuteStatus.Finished) | ||
| producedRowCount = producedRowsCountOpt | ||
|
|
||
| listenerBus | ||
| .post(SparkListenerConnectOperationFinished(jobTag, operationId, clock.getTimeMillis())) | ||
| .post( | ||
| SparkListenerConnectOperationFinished( | ||
| jobTag, | ||
| operationId, | ||
| clock.getTimeMillis(), | ||
| producedRowCount)) | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -395,13 +414,17 @@ case class SparkListenerConnectOperationFailed( | |
| * 36 characters UUID assigned by Connect during a request. | ||
| * @param eventTime: | ||
| * The time in ms when the event was generated. | ||
| * @param producedRowCount: | ||
| * Number of rows that are returned to the user. None is expected when the operation does not | ||
| * return any rows. | ||
gjxdxh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| * @param extraTags: | ||
| * Additional metadata during the request. | ||
| */ | ||
| case class SparkListenerConnectOperationFinished( | ||
| jobTag: String, | ||
| operationId: String, | ||
| eventTime: Long, | ||
| producedRowCount: Option[Long] = None, | ||
gjxdxh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| extraTags: Map[String, String] = Map.empty) | ||
| extends SparkListenerEvent | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.