forked from apache/spark
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-46864][SS] Onboard Arbitrary StateV2 onto New Error Class Fram…
…ework ### What changes were proposed in this pull request? This PR proposes to apply error class framework to the new data source, State API V2. ### Why are the changes needed? Error class framework is a standard to represent all exceptions in Spark. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Refactored unit tests to check that the right error class was being thrown in certain situations ### Was this patch authored or co-authored using generative AI tooling? No Closes apache#44883 from ericm-db/state-v2-error-class. Lead-authored-by: Eric Marnadi <eric.marnadi@databricks.com> Co-authored-by: ericm-db <132308037+ericm-db@users.noreply.github.com> Signed-off-by: Jungtaek Lim <kabhwan.opensource@gmail.com>
- Loading branch information
1 parent
704e9a0
commit 00e63d6
Showing
10 changed files
with
199 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...core/src/main/scala/org/apache/spark/sql/execution/streaming/state/StateStoreErrors.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* 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.state | ||
|
||
import org.apache.spark.{SparkException, SparkUnsupportedOperationException} | ||
|
||
/** | ||
* Object for grouping error messages from (most) exceptions thrown from State API V2 | ||
* | ||
* ERROR_CLASS has a prefix of "STATE_STORE_" to indicate where the error is from | ||
*/ | ||
object StateStoreErrors { | ||
def implicitKeyNotFound(stateName: String): SparkException = { | ||
SparkException.internalError( | ||
msg = s"Implicit key not found in state store for stateName=$stateName", | ||
category = "TWS" | ||
) | ||
} | ||
|
||
def multipleColumnFamiliesNotSupported(stateStoreProvider: String): | ||
StateStoreMultipleColumnFamiliesNotSupportedException = { | ||
new StateStoreMultipleColumnFamiliesNotSupportedException(stateStoreProvider) | ||
} | ||
|
||
def unsupportedOperationException(operationName: String, entity: String): | ||
StateStoreUnsupportedOperationException = { | ||
new StateStoreUnsupportedOperationException(operationName, entity) | ||
} | ||
} | ||
|
||
class StateStoreMultipleColumnFamiliesNotSupportedException(stateStoreProvider: String) | ||
extends SparkUnsupportedOperationException( | ||
errorClass = "UNSUPPORTED_FEATURE.STATE_STORE_MULTIPLE_COLUMN_FAMILIES", | ||
messageParameters = Map("stateStoreProvider" -> stateStoreProvider) | ||
) | ||
|
||
class StateStoreUnsupportedOperationException(operationType: String, entity: String) | ||
extends SparkUnsupportedOperationException( | ||
errorClass = "STATE_STORE_UNSUPPORTED_OPERATION", | ||
messageParameters = Map("operationType" -> operationType, "entity" -> entity) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters