Github user tdas commented on a diff in the pull request:
https://github.com/apache/spark/pull/16220#discussion_r91630421
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/streaming/StreamingQueryManager.scala
---
@@ -206,21 +219,21 @@ class StreamingQueryManager private[sql]
(sparkSession: SparkSession) {
recoverFromCheckpointLocation: Boolean = true,
trigger: Trigger = ProcessingTime(0),
triggerClock: Clock = new SystemClock()): StreamingQuery = {
- activeQueriesLock.synchronized {
- val name = userSpecifiedName match {
- case Some(n) =>
- if (activeQueries.values.exists(_.name ==
userSpecifiedName.get)) {
- throw new IllegalArgumentException(
- s"Cannot start query with name $n as a query with that name
is already active")
- }
- n
- case None => null
+ userSpecifiedName foreach { name =>
+ activeQueriesLock.synchronized {
+ if (activeQueries.values.exists(_.name == name) ||
pendingQueryNames.contains(name)) {
+ throw new IllegalArgumentException(
+ s"Cannot start query with name $name as a query with that name
is already active")
+ }
+ pendingQueryNames += name
}
+ }
+ try {
val checkpointLocation = userSpecifiedCheckpointLocation.map {
userSpecified =>
new Path(userSpecified).toUri.toString
}.orElse {
df.sparkSession.sessionState.conf.checkpointLocation.map {
location =>
- new Path(location, name).toUri.toString
+ new Path(location,
userSpecifiedName.getOrElse(UUID.randomUUID().toString)).toUri.toString
--- End diff --
very good catch! thanks @zsxwing
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]