You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "sarutak (via GitHub)" <gi...@apache.org> on 2025/09/08 09:03:59 UTC
[PR] [SPARK-50888][CONNECT][TESTS][4.0] Remove flaky assertion from `SparkConnectServiceSuite` [spark]
sarutak opened a new pull request, #52265:
URL: https://github.com/apache/spark/pull/52265
### What changes were proposed in this pull request?
This PR backports #52248 to `branch-4.0`.
This PR removes an assertion from `SparkConnectServiceSuite.scala` to eliminate flakiness which affects the following tests in the test suite.
* `SPARK-44776: LocalTableScanExec`
* `SPARK-41224: collect data using arrow`
In those tests, [VerifyEvents#onNext](https://github.com/apache/spark/blob/9d27db940673196f64b1568d73c459f83eb6f788/sql/connect/server/src/test/scala/org/apache/spark/sql/connect/planner/SparkConnectServiceSuite.scala#L913) is called and checked `assert(executeHolder.eventsManager.status == ExecuteStatus.Analyzed)`, which can fail and this PR proposes to remove this assertion.
If this assertion fails, an exception will be thrown and [VerifyEvents#onError](https://github.com/apache/spark/blob/9d27db940673196f64b1568d73c459f83eb6f788/sql/connect/server/src/test/scala/org/apache/spark/sql/connect/planner/SparkConnectServiceSuite.scala#L921) is called but the reason this `onError` is called is not due to a query/command fails. So `executeHolder.eventsManager.hasError.isDefined` never changes to `true`.
`VerifyEvents#onNext` is indirectly called from [ExecuteGrpcResponseSender#sendResponse](https://github.com/apache/spark/blob/9d27db940673196f64b1568d73c459f83eb6f788/sql/connect/server/src/main/scala/org/apache/spark/sql/connect/execution/ExecuteGrpcResponseSender.scala#L398), which runs on a sender thread.
On the other hand, an operation status is changed on another thread. Especially, transition to `Analyzed` status is done [here](https://github.com/apache/spark/blob/9d27db940673196f64b1568d73c459f83eb6f788/sql/connect/server/src/main/scala/org/apache/spark/sql/connect/execution/SparkConnectPlanExecution.scala#L75). But the status can transition to `ReadyForExecution` or `Finished` before `VerifyEvents#onNext` is called.
So, those tests can occasionally fail.
You can easily reproduce this issue by inserting sleep like as follows and then run those tests.
```
def onNext(v: proto.ExecutePlanResponse): Unit = {
if (v.hasSchema) {
+ Thread.sleep(5000)
assert(executeHolder.eventsManager.status == ExecuteStatus.Analyzed)
}
```
The solution this PR proposes is just removing the assertion.
In `VerifyEvents#onNext`, there is another assertion `assert(executeHolder.eventsManager.status == ExecuteStatus.Finished)` and I think having only this assertion is enough because the status changes to `Finished` through `Analyzed`.
### Why are the changes needed?
For test stability.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Inserting sleep into `onNext` like explained above and run the problematic tests.
### Was this patch authored or co-authored using generative AI tooling?
No.
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-50888][CONNECT][TESTS][4.0] Remove flaky assertion from `SparkConnectServiceSuite` [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #52265:
URL: https://github.com/apache/spark/pull/52265#issuecomment-3266930509
Merged to branch-4.0.
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-50888][CONNECT][TESTS][4.0] Remove flaky assertion from `SparkConnectServiceSuite` [spark]
Posted by "sarutak (via GitHub)" <gi...@apache.org>.
sarutak commented on PR #52265:
URL: https://github.com/apache/spark/pull/52265#issuecomment-3265826850
GA failure seems not relevant this change and try to fix it in #52267
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-50888][CONNECT][TESTS][4.0] Remove flaky assertion from `SparkConnectServiceSuite` [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun closed pull request #52265: [SPARK-50888][CONNECT][TESTS][4.0] Remove flaky assertion from `SparkConnectServiceSuite`
URL: https://github.com/apache/spark/pull/52265
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org